Bugs
|
|
Hi, the script doesn't work on welt6.travian.de. No truck is visible :-) |
|
|
Hi, this is because it is a mixed server if I'm right. T3.1 - 3.5 |
|
|
Hmmm.... thanks for letting me know. Quite probably Booboo's right, that sounds like it could be the problem - I haven't tried it out on T3.* at all. I imagine they have modified the UI, which would screw with this... |
|
|
Very handy script, i knew someone else had to hate different village layouts...! ;p Anyway, i just found out about this script and tried to use it...first two villages were a big success, the thirdwas already as i wanted it, and on the fourth one i think i hit a bug or something. As i was changing around the buildings, after i already changed like 4-5, the truck disappeared completely...checkedanother village and it was there, went back to the 'bugged' one, and it was still missing.
|
|
|
Hmm.... that's very interesting. Glad you like the script though - saves me no end of annoyances, too. Anyways, the problem's probably in the saved values - do you think you could type "about:config" in your address bar in a new tab, search for "mapping", right-click on the value that pops up -> copy value, and paste the result here? You might have to click through a few warning messages, "this might void your warranty" (what warranty? :P) etc first. Also, it would be very helpful if you could get the error log of the bug - ctrl+shift+j, clear, visit the buggy village again, and tell me what shows up in the error console (which popped up when you pressed ctrl-shift-j). To fix it, at least temporarily - if you go back to the mapping variable in about:config, right-click and press "reset", you'll lose all your mappings, but it should work if you try again. If you press modify, look through the string to find the "did" of the village in question, and just delete that one section of the string, then you'll only lose that one village's mappings, but again it should work. |
|
|
Error: document.evaluate("//a[@class=\"active_vl\"]", document, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue is null
that's the error i get |
|
|
@jakesanchard, This is because you have only one village, and the program doesn't handle it yet. @Arandia I have made a modification in your script to solve this problem. Here you are. An added Init section:
// Init
var server = location.host;
var uid = document.evaluate("id('navi_table')//a[contains(@href, 'spieler.php')]/@href", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.textContent.match(/uid=(\d+)/)[1];
GM_log("uid: " + uid);
And the main modification:
// Get the active village, to store the new mappings
// We don't have to worry about postfixes because we're only running on one page
var did = document.evaluate('//a[@class="active_vl"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (!did)
{ var single_villages = eval(GM_getValue('single_villages', '({})'));
if (!single_villages[server + "_" + uid])
{ GM_xmlhttpRequest
({ method: 'GET',
url: "http://" + server + "/dorf3.php",
onload: function(xhr)
{ var did = xhr.responseText.match(/newdid=(\d+)/)[1];
single_villages[server + "_" + uid] = did;
GM_setValue('single_villages', uneval(single_villages));
}
});
return;
}
else
did = single_villages[server + "_" + uid];
}
else
did = did.href.match(/newdid=(\d+)/)[1];
GM_log("did: " + did);
if (mapping[did] == undefined) mapping[did] = {};If the user has only one village the script steals its newdid from dorf3.php, and stores it in an additional object (single_village), like mapping.After you refresh this page the script will work like charm. ;-) |
|
|
Hi Booboo, Thanks for the code - that looks like a good way of handling it. Probably shouldn't be doing this at the moment, of course... might not get around to updating/including it until tomorrowish. One small thing that we may as well try and fix while we're at it - this fix still screw up when we have a single-village account sitting for another single-village account. It would probably be too much of a pain to try and figure out the player's name... but we could add the village name as a postfix on single_villages, so it'll catch 99% of those cases. |
|
|
@Arandia Hi, This patch never falls into that case, because the server names and the user ids are used to be the prefixes. ;) Look at the code's init section, the second line is where we get the user id. If we use the village name as a prefix, it could screw things up every times the user changes their village names... :S Keep up the good work! ;-) Booboo |
|
|
@Booboo Ha ha, must've missed that :-/. A good fix to the problem - I think I might implement a similar solution in another script I'm working on, if you don't mind. :P Anyways, got it all up now - thanks for the fix! |
|
|
@Arandia Please feel free. ;) |
|
|
How come when I click on the truck nothing happens? |
|
|
@720 Could you be a little more specific? Nothing happens at all? If you could try opening up the error console (ctrl+shift+j), clear it, click on the truck again and tell me what shows up in the console, it would be most helpful...? |
|
|
The error console won't open up. I hit ctrl+shift+j and nothing happened. For the script, when I click onto the truck, no prompt or anything appears and when I try to click onto the buildings nothing happens. If I reload the page the links work again or if I hit the buttons at the top (to get to the map, the village, and the fields). |
|
|
@720 Hmm.... that is very interesting. So the problem is not with the clicking on the truck, but the clicking on the buildings.... Could you try with the error console again? You can also open it by going to Tools -> Error Console. Also, is your server relatively new? (like, Travian version 3 or higher?) That might be a problem, I haven't tested it too much on the newest servers... |
|
|
I am on the US speed server, its been going for a while. Natars are supposed to be release by end of month. So this is the error is said. Error: img[i].addEventListener is not a function
Hope that helps |
|
|
@720 Hmmm... so it's not an issue with a later version of Travian then... well, a lot of servers just switched over to a new UI (new images etc). If yours did too, you could try the new version, which should fix it? (hopefully :P) If yours hasn't... well, then I'm at a bit of a loss. That's a very odd place for it to fail. Last resort, maybe reinstalling the script? (make sure to uninstall preferences if/when you do). |
|
|
OK well i tried reinstalling the script and it didn't work :(. When I reinstalled it and looked at the error console these appeared: Error: thisDiv has no properties
Error: lmidlcDIV has no properties
Error: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE)
Error: poly[i].addEventListener is not a function
I hope that helps. |
|
|
Hmmm.... well, first it looks like you have a bunch of other scripts giving problems too - the travian_search and travian_under-attack_check are responsible for the first few errors there. The last one... that's this script. "poly[i].addEventListener is not a function". It should be! That's really weird - I just created an account on speed.travian.us, and it's working fine for me. Maybe one of those other buggy scripts are screwing things up, which impact this one? Try disabling all other scripts, see if it works, and if it does enable the other scripts one-by-one until it screws up. If and when, I'd appreciate knowing what it conflicts with... if it does, the problem's more likely to be on their side than on mine - there isn't much I could change here, reason being this script's pretty bare-bones simple. :-/ |
|
|
Well I tried it with only the Buidling Mover and it gave me this error: Error: poly[i].addEventListener is not a function
|
|
|
Wow, this bug is really proving difficult, eh? Thanks for working through this, btw... Hmmm... just had a thought. Are you using a graphics pack? That might screw with things, I've never tried using them before... |
|
|
Not currently. |
|
|
Gah... I'm at a bit of a loss here, then... do your other scripts work? Maybe it's a problem with greasemonkey.... :-S |
|
|
All my other scripts work fine. Do you think I should reinstall grease monkey or maybe upgrade my Firefox or something. |
|
|
... mystery to me... from where I'm standing, I'm utterly confused as to why it's not working. I know where it's screwing up, but not why are either your greasemonkey or firefox out of date? It would be a strech to find those responsible... but can't hurt for trying? :-/ |