adipiciu / Travian-scripts

Userscripts for Travian. Resource bar plus. Wave builder. Task queue.
GNU General Public License v3.0
38 stars 23 forks source link

Possible Solution to Market Neded Function [(M)(M+)] #47

Closed oGabrielFreitas closed 8 months ago

oGabrielFreitas commented 10 months ago

One of the functions I like most about this script is being able to add necessary resources with (M) and (M+), and then being able to easily send them from my capital to other villages.

Since Travina updated the resource submission interface (which I hated by the way), this plugin feature has not been working correctly.

In my tests, I ended up discovering the reason and then programming a temporary "workaround", which could be a solution.


The problem:

For the send resources screen to appear, you need to click on "Send Resources".

However, this is a screen that the Script does not detect (if it is already running).

Therefore, I decided to add a delay of 3 seconds, when the current page is the market shipping page.


But there are some problems in my implementation.

  1. I use a fixed ID (because I always build the market in the same place). I believe that the ideal would be to save the market ID and each village.
  2. You have to "be fast" and click in "Send Resources" before the script loads.


Anyway...

I don't believe this is the best solution, but it's working for me for now.

I really like the script! Hugs



Code:

The initial code should be like that:

function Main () {

var RunTime = [Date.now()];

function allInOneOpera () {
var version = '2.23.14';

You should also remove the () from the END of function, AND also the () that surrounds ALL the function.

The id verification:

function containsParameters(url) {
    return url.includes("gid=17");
}

var currentUrl = window.location.href;

if (containsParameters(currentUrl)) {
    setTimeout(Main, 3500);
} else {
    Main();
}
adipiciu commented 10 months ago

Hi, the market buttons work if you use the script send resources buttons. If you go directly in the market to enter the village coordinates, or if you go on the map and select the village to send resources, it will not work. I will try to see if I can add some events for the market popup.

adipiciu commented 10 months ago

Another info. Right now the script is using a 0.7sec delay to load the market buttons. Maybe your PC is not fast enough and needs a longer delay? Try to modify this line and increase the timeout value.

setTimeout(marketSend,700); setTimeout(marketSumm,700); marketOffer(); marketBuy(); setTimeout(marketTradeRoutes,700); stopRP();

adipiciu commented 9 months ago

I guess with the new Tavian update that removed the popup, this issue is no longer valid.

kikuman commented 9 months ago

But the M function isn't working after latest server update.

adipiciu commented 9 months ago

function isn't working after latest server update.

Did you update the script?

kikuman commented 9 months ago

Yes, using latest script.

adipiciu commented 9 months ago

image

No market popup on update servers. M functions works fine. What is the problem?

Yes, using latest script.

kikuman commented 9 months ago

After recording M from building requirement, then trying to retrieve it in market, nothing happens after clicking M

adipiciu commented 9 months ago

After recording M from building requirement, then trying to retrieve it in market, nothing happens after clicking M

It works fine. There is something wrong on your account maybe? Do you have a different language, date?

adipiciu commented 9 months ago

After recording M from building requirement, then trying to retrieve it in market, nothing happens after clicking M

If you don't use the script send resources button, or you are in the market, you need to press M 2 times. One to load the correct village coordinates, and the 2nd time to load the resources.

adipiciu commented 9 months ago

After recording M from building requirement, then trying to retrieve it in market, nothing happens after clicking M

Check new version 2.23.17. I did some improvements and you need to click M only one time.

kikuman commented 9 months ago

Updated script but M still doesn't load for me, = % C work fine.

adipiciu commented 9 months ago

Updated script but M still doesn't load for me, = % C work fine.

M works only if there are missing resources. Are you sure Memory has saved anything? If you have enough resources, it will not save anything in M.

kikuman commented 9 months ago

Yes memory is saved. And village next to each other. Screenshot 2023-11-27 021340

adipiciu commented 9 months ago

Yes memory is saved. And village next to each other.

:( I guess there is a particular scenario on your account. I can't think of anything else. If you want, you can contact me on skype id: adipiciu We can do a remote session so I can debug the script if you want.

adipiciu commented 9 months ago

Updated script but M still doesn't load for me, = % C work fine.

I think I know what's the problem. Please check in the script settings the map size and the server speed. It's possible the script does not read these settings properly.

kikuman commented 9 months ago

Settings are correct. Tried reset with 0 and still correct.

oGabrielFreitas commented 9 months ago

It's working fine for me also, after Travian update.

image

Finally they removed that annoying popup from the market page

raedzzzzz commented 8 months ago

M , M+ not working , % and = working

adipiciu commented 8 months ago

M , M+ not working , % and = working

What browser, what script manager? can you check in the script console tab if there is any error? (Press F12 to open the developer tools)

raedzzzzz commented 8 months ago

M , M+ not working , % and = working

What browser, what script manager? can you check in the script console tab if there is any error? (Press F12 to open the developer tools)

tempaermonkey - google chrome or brave and firefox , no error

raedzzzzz commented 8 months ago

Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute') i have this error 3316

kikuman commented 8 months ago

M , M+ not working , % and = working

What browser, what script manager? can you check in the script console tab if there is any error? (Press F12 to open the developer tools)

Latest Chrome with Violentmonkey ( tried Tampermonkey, same issue)

Gets this error when clicking M Travian Resource bar plus.user.js:3316 Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute') at HTMLAnchorElement.mhRowLinkMem (Travian Resource bar plus.user.js:3316:37) mhRowLinkMem @ Travian Resource bar plus.user.js:3316

raedzzzzz commented 8 months ago

M , M+ not working , % and = working

What browser, what script manager? can you check in the script console tab if there is any error? (Press F12 to open the developer tools)

Latest Chrome with Violentmonkey

Gets this error when clicking M Travian Resource bar plus.user.js:3316 Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute') at HTMLAnchorElement.mhRowLinkMem (Travian Resource bar plus.user.js:3316:37) mhRowLinkMem @ Travian Resource bar plus.user.js:3316

Me as well same problem

adipiciu commented 8 months ago

M , M+ not working , % and = working

What browser, what script manager? can you check in the script console tab if there is any error? (Press F12 to open the developer tools)

Latest Chrome with Violentmonkey ( tried Tampermonkey, same issue)

Gets this error when clicking M Travian Resource bar plus.user.js:3316 Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute') at HTMLAnchorElement.mhRowLinkMem (Travian Resource bar plus.user.js:3316:37) mhRowLinkMem @ Travian Resource bar plus.user.js:3316

Check the new script version 2.23.19 and let me know if it's working or if there are other errors.

kikuman commented 8 months ago

M , M+ not working , % and = working

What browser, what script manager? can you check in the script console tab if there is any error? (Press F12 to open the developer tools)

Latest Chrome with Violentmonkey ( tried Tampermonkey, same issue) Gets this error when clicking M Travian Resource bar plus.user.js:3316 Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute') at HTMLAnchorElement.mhRowLinkMem (Travian Resource bar plus.user.js:3316:37) mhRowLinkMem @ Travian Resource bar plus.user.js:3316

Check the new script version 2.23.19 and let me know if it's working or if there are other errors.

Working now! You're the best!

adipiciu commented 8 months ago

Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute') i have this error 3316

Fixed in new script version 2.23.19