Script GM script for Westinsider and Weststats

DeletedUser

[box=black]Script Details
Available From: Userscript.org
Script Version: 0.61
Works on Version: Unknown[/box]

I originally made this add-on for my hometown, but I figured the public might also find some use for it. It's now on over 700 downloads! If you have any questions or requests, just shout out in this thread. The code in this script is mostly copy-paste from other good coders and would not be possible without: Shulik, Glasis, Jesper Karsrud. Thanks guys. This add-on is compatible with # 2,3,4,5 and 6 of Shulik's GM addons. It is intended to replace #1 and is indeed built on top of this.


Install here.
Adds 3 ingame buttons.

* Export to and open Westinsider
* Open Weststats
* Export Duel report
You will also need Firefox and Greasemonkey.









Screenshots:

west tools.jpg
This is a screenshot of the game with The West Extra Tools enabled.

West tools with other mods.jpg
This is a screenshot of the game, with 5 of Shulik's scripts and The West Extra Tools enabled (please note that the original resolution is 1920x1280, hence the blurry image).


How to use the export duel button:

1. Open your duel report ingame and switch to flash view.
2. Close all other popup windows (also close the Reports window behind the duel window).
3. Press the Export duel button.
If you want to export your character data to weststats, there is code inside the script that can accomplish this for you. You need to hack in your own login data and enable the button made for this purpose. There is a small guide inside the script, on how to do it.
 
Last edited by a moderator:

DeletedUser

The next thing I would like to do, is to merge the two weststats buttons. I am not sure how though, tips are welcome!

Also, if possible, the scripts should open and close the inventory, before the rest of the scripts are run. However, if this slow the scripts down with more than 1 second, I will abandon this idea.
 

DeletedUser

Good lucking interface. Installed easily. Pity that West Stats is out of action at the moment.
 

DeletedUser

The next thing I would like to do, is to merge the two weststats buttons. I am not sure how though, tips are welcome!

Also, if possible, the scripts should open and close the inventory, before the rest of the scripts are run. However, if this slow the scripts down with more than 1 second, I will abandon this idea.

Try
Code:
if(!document.getElementById('weststats_link')){var weststats_link = document.createElement("li");
weststats_link.id="weststats_link";
if(actual_region=="en"){
weststats_link.innerHTML = '<a style="background:url(http://dump.ninjapirat.org/files/weststats.jpg) no-repeat" href="http://www.weststats.com/?change_world='+actual_world+'" target="_blank"></a>';
}
else
{
weststats_link.innerHTML = '<a style="background:url(http://dump.ninjapirat.org/files/weststats.jpg) no-repeat" href="http://'+actual_region+'.weststats.com/?change_world='+actual_world+'" target="_blank"></a>';
}}

I don't warrant that it'll work.
 

DeletedUser

I don't know how much you know javascript, maybe I'm saying rubbish, but if you want to fix the two Weststats icons, it's really easy - put the creating WS icon into a condition if(doument.getElementById('weststats_link')){..code..}

BTW: I think you have a problem there with importing inventory: Everyone has unique uid which is used in the import script. I think everybody import into you account now.
 

DeletedUser

I don't know how much you know javascript, maybe I'm saying rubbish, but if you want to fix the two Weststats icons, it's really easy - put the creating WS icon into a condition if(doument.getElementById('weststats_link')){..code..}
My knowledge of javascript is very limited I am afraid, so I am not sure what you are doing here, sorry. However I tested your code and it did not work in it's current state.


BTW: I think you have a problem there with importing inventory: Everyone has unique uid which is used in the import script. I think everybody import into you account now.

Yes, you are right. Everything is exported to my weststats account. :( I wonder how to solve this...
 

DeletedUser

Oh, sorry, next time I'll test my scripts before publishing them :laugh:

Now it should work:

Code:
if(!document.getElementById('weststats_link')){menu_work.parentNode.insertBefore(weststats_link, menu_work.nextSibling);}
Put it into the code instead of this:
Code:
menu_work.parentNode.insertBefore(weststats_link, menu_work.nextSibling);

(Tested with Mozilla Firefox 3.5.1)

//EDIT:
Yes, you are right. Everything is exported to my weststats account. :( I wonder how to solve this...

I think there're two ways:
  • Everyone who use your script now will have to install new, without the link to script.
  • Or you will have to create a new WS account, but also make a new version of this script without WS import.
 
Last edited by a moderator:

DeletedUser

Code:
if(!document.getElementById('weststats_link')){menu_work.parentNode.insertBefore(weststats_link, menu_work.nextSibling);}
Put it into the code instead of this:
Code:
menu_work.parentNode.insertBefore(weststats_link, menu_work.nextSibling);
(Tested with Mozilla Firefox 3.5.1)

What is this meant to accomplish, my friend?




I think there're two ways:
  • Everyone who use your script now will have to install new, without the link to script.
  • Or you will have to create a new WS account, but also make a new version of this script without WS import.

Are you saying that the export to weststats button doesn't work? Are people able to utilize the data, or not? :sad:
 

DeletedUser

If you want to have only one WS button here, with Glasis, my etc. scripts work, if you put the part of script which put WS icon to page to a condition, which detect if is there already one button (by selecting it document.getElementById()).

So the part of code on the bottom of the script ( menu_work.parentNode.insertBefore(weststats_link, menu_work.nextSibling); ) should be in condition if(!document.getElementById('weststats_link')){}

And it will look so:

Code:
if(!document.getElementById('weststats_link')){menu_work.parentNode.insertBefore(weststats_link, menu_work.nextSibling);}


Export to WS cannot work, jus if you create a GM script for everybody.
Or if such script would be in WS page (there is able to find out the player uid).
I think about something, how to make it without WS and IMHO is there only one way: After instalation would user write his uid and script would save it by cookies. But it's a bit complicated for you, I think.
 

DeletedUser

If you want to have only one WS button here, with Glasis, my etc. scripts work, if you put the part of script which put WS icon to page to a condition, which detect if is there already one button (by selecting it document.getElementById()).

So the part of code on the bottom of the script ( menu_work.parentNode.insertBefore(weststats_link, menu_work.nextSibling); ) should be in condition if(!document.getElementById('weststats_link')){}

And it will look so:

Code:
if(!document.getElementById('weststats_link')){menu_work.parentNode.insertBefore(weststats_link, menu_work.nextSibling);}

I see, that's interesting!



Export to WS cannot work, jus if you create a GM script for everybody.
Or if such script would be in WS page (there is able to find out the player uid).
I think about something, how to make it without WS and IMHO is there only one way: After instalation would user write his uid and script would save it by cookies. But it's a bit complicated for you, I think.

Yes, you are totally right, it's a bit too complicated. I also find that I never use the button myself, since Westinsider's jobcalculator is much faster. Therefore I have just disabled the button for now.


If someone want to enable the button, I have however, added a userguide to the script, on how to edit your own login data into the script.
 
Last edited by a moderator:

DeletedUser

The script has been updated with a button to export duel reports, only made possible by Shulik. ;)



How to use the export duel button:


1. Open your duel report ingame and switch to flash view.
2. Close all other popup windows (also close the Reports window behind the duel window).
3. Press the Export duel button.
 
Last edited by a moderator:

DeletedUser

The duel exporter is working. I belive the problem was local, on my machine.
 

DeletedUser

Pff, after a HD crash I had to reinstall everything. I surely had an issue finding this script again. And then to have to read the replies to be remembered about editing the script for WestStats export.

Maybe you could make that feature more prominent in this thread (first post) and that userscript post?

Thanks for the great script!
 

DeletedUser

Pff, after a HD crash I had to reinstall everything. I surely had an issue finding this script again. And then to have to read the replies to be remembered about editing the script for WestStats export.

Maybe you could make that feature more prominent in this thread (first post) and that userscript post?

Thanks for the great script!

You're welcome mate. I added a pinpointer at the end of my first post :)
 

DeletedUser

Does it only work with Firefox 3.5? It doesn't seem to be working entirely as intended. I don't know if it would be possible, but what I'd love to see is a TWI link at the top of inventory or just as you have it, but open inventory and then export it with one click.



Click the thumbnail to see the full pic. It was too big to post directly or as an attachment.
 

DeletedUser

Does it only work with Firefox 3.5? It doesn't seem to be working entirely as intended. I don't know if it would be possible, but what I'd love to see is a TWI link at the top of inventory or just as you have it, but open inventory and then export it with one click.



Click the thumbnail to see the full pic. It was too big to post directly or as an attachment.
Hmm, it seems you're blocking 'external' images. The script is adding the buttons but you can't see them.
The one on the left is the one that (exports and) opens WestInsider.
Then on the right it's Export Duel, (Export to WestStats if you enabled that in the script), and as last a simple link to WestStats.

The button on the left is using this image:
http://dump.ninjapirat.org/files/westinsider_left.jpg
 

DeletedUser

Hmm, it seems you're blocking 'external' images.

The buttons from Shulik's town buttons script are obviously still working. The only thing that should be blocking them is ABP, but it's not. The images are given as blockable, but not blocked. /files/ads is blocked, but not just /files.
 

DeletedUser

The buttons from Shulik's town buttons script are obviously still working. The only thing that should be blocking them is ABP, but it's not. The images are given as blockable, but not blocked. /files/ads is blocked, but not just /files.
Well that was the only thing I could think of. You could try the DOM inspector and check that the a-tags of the buttons have the background image set.
 
Top