Verifex's Script Discussion v2 (in Off-topic)


AdminQBVerifex February 16 2007 6:25 PM EST

Hi Everyone,

Since I've been seeing quite a bit of use out of the script, I was thinking of putting up a thread so you all can voice your opinions on certain things. I like to add new things in it, but I can't always please everyone. So here is your chance to tell me what you like, don't like, or what you want in the script.

Already the script is a pretty hefty beast as it is, so I am looking to mainly optimize and reduce the size of it as I move forward. Here are some of the things that some people seem to have some issues with:

1) Forgemaster-Problem: when you click the button too fast you can get confused and screw up forging.

My Response: Now I haven't personally experienced this, but it may just be because I know the limitations of the script. If you press the button really fast the script might possibly advance to the next forge step before the previous forge step has completed.

To avoid this: Don't press the button faster then the page can load, the script is dynamically checking the "forge" page that is loaded in the other frame for it's document title and checking to ensure it isn't a bot-check or other "error" page before advancing to the next step. If you click it faster then the page can load, then the script will look at the page title and see that the current page is not the actual page that is loaded. The only way for me to get around this is by putting timers and other crap in that button, all of which is very complex and not something I'm looking forward to refactoring in the code.

2) Recent fight page-Description: I added some "fight/add" buttons on this page as well as a little frame to store the results of the add or fight for quick adding to your fight list. I also made it so when you click a persons name it inspects them in the little frame as opposed to loading a new page.

Problem:Some people like this, some people don't. I'm not sure what to do about this, or if there are any alternative solutions that would work for everyone, so I'm thinking about putting a setting to toggle this functionality.

3) Training Sets on Train Page: Problem: "When I click the training set button it doesn't always immediately train the amount I set"

My Response: When you click the "Train" page on CB, CB performs some initial calculations that reduce the CPU load on CB. When you click the training set, it hasn't always necessarily performed these operations first, so an incorrect amount is trained.

To avoid this: Simply click the train button before clicking the Training Set you have created. I prefer not to make the script click the train button automatically two times as that just seems excessive.

Miandrital February 16 2007 6:29 PM EST

I modified the fight advancing function to auto-reset to the top of my list when everyone is comatose, posting it here in case you want to include it.

switch (adv) {
case "Advance: On":
while (o.options[i].text.match(/^\*/))
{ i++;
if (i==o.options.length)
{ o.selectedIndex=0;
return;
}
}
o.selectedIndex=i;
break;
case "Advance: Off":
return;
break;
case "Advance: Clan":
while (!o.options[i].text.match(/^\C /))
{ i++;
if (i==o.options.length)
{ var j=0;
while(!o.options[j].text.match(/^\*C /))
{ j++;
if (j==o.options.length) break;
}
o.selectedIndex=j;
return;
}
}
if (o.options[i].text.match(/^\C /)) o.selectedIndex=i;
break;
}

Arg, the tabs are getting removed, but hopefully it is still readable.

Sir Leon [Soup Ream] February 16 2007 6:31 PM EST

Not to get picky or anything but..

I'd like to see a small icon added to the forging sections for weapons that will allow you to choose between "p" and "X"

I'm not complaining but i think this slight adjustment could avoid confusion and let the weapons be a little more organized instead of one enormous list.

(isn't a necessary change but i wouldn't mind seeing it implemented)

AdminQBnovice [Cult of the Valaraukar] February 16 2007 6:32 PM EST

I've yet to see the old clicking too fast problem, but this linux box is slow on the click anyway...

What do you think about my idea of preventing overheating with the script?
Too bottish?

Miandrital February 16 2007 6:35 PM EST

Or, instead of nov's idea, you could just have the script remember the current point in the cycle of the item you are working on. That would be useful if you have to leave in the middle of a cycle or something like that.

AdminQBnovice [Cult of the Valaraukar] February 16 2007 6:39 PM EST

hmm, so instead of it opening a new window or tab and being at step 1, the script would parse the set formula, and the output from the forge page?

The forge page doesn't always have enough info on it to figure that out, I think it watching for the right item temp sounds easier to pull off.

Miandrital February 16 2007 6:45 PM EST

No, it would just remember where you were at before you closed Firefox. It already does that with PBP settings, Advance settings, etc.

Sir Leon [Soup Ream] February 16 2007 6:47 PM EST

On another note, I have seen the double click problem numerous times but this is a user problem not the script.

AdminG Beee February 16 2007 6:55 PM EST

Make it work on the latest version of IE - I don't like FF anymore ;)

AdminQBVerifex February 16 2007 7:27 PM EST

G_Beee: Believe it or not GB I started a script to try and branch into IE, but it was very difficult to get even the most basic functionality implemented. I'll let you know how it goes though. GM on IE isn't quite as far along as it's firefox brethren.

Mian: That is hilarious! My script used to reset to the top of the list when everyone was comatose but some people asked if I could have it simply "stay" where it was last so that farming people would be easier, so maybe I'll have to make this an option as well. ;)

Novice: Making the script remember the step it was forging last wouldn't be that difficult, but the only thing I can think of to improve forging would be to try and tie some events to different browser actions in hopes of capturing when the page changes so that the button wouldn't actually DO anything if you click it when the page hasn't loaded yet and the user has clicked it. But I didn't get that far into pursuing that, yet.

Slashundhack [We Forge Our Own Stuff] February 16 2007 9:40 PM EST

I don't have any problems with it like it is . I do how ever have to write were I am in the forge cycle IE:heat 10 min. (9) . This works but I got scribbled up paper around the comp. all the time .

AdminQBVerifex February 16 2007 10:06 PM EST

My suggestion: If you haven't quite finished a cycle, simply buy that 1-20 extra BA that you need to finish the cycle, it's much easier then trying to remember that stuff, and it is what I do when I'm forging :)

Miandrital February 17 2007 6:33 AM EST

Or do this (makes your GM script remember which forge step you were on, even after closing FF):

Find the comment: "// forge button"
And replace the whole block (down to where it says "},false);" ) with this:

// forge button
spanner.childNodes[10].addEventListener('click', function(){
maintit=unsafeWindow.top.frames[1].document.title
curplace=unsafeWindow.top.frames[1].location.href
if (!(curplace.match(/blacksmith.diy.2.tcl/))) {unsafeWindow.top.frames[1].location.href='/blacksmith-diy.tcl'}
if (curplace.match(/blacksmith.diy/)&&(maintit!="No BA")&&(maintit!="Security")) {
selectedbranch = document.getElementById('forgesteps').selectedIndex;
branchlen = document.getElementById('forgesteps').options.length;
hostfill=location.host
random1=Math.round(3*Math.random()*Math.random());
random2=Math.round(5*Math.random()*Math.random());
popurl="http://"+hostfill+"/blacksmith-diy-2.tcl?action=";
popurl=popurl+document.getElementById('forgesteps').options[document.getElementById('forgesteps').selectedIndex].value;
if ((branchlen-1)>selectedbranch) {
document.getElementById('forgesteps').selectedIndex=document.getElementById('forgesteps').selectedIndex+1;
currentForgeStep=GM_setValue('cb2currentforgestep',document.getElementById('forgesteps').selectedIndex);
} else {
document.getElementById('forgesteps').selectedIndex=0;
currentForgeStep=GM_setValue('cb2currentforgestep',document.getElementById('forgesteps').selectedIndex);
}
popurl=popurl+"&"+random1+"="+random2;
unsafeWindow.top.frames[1].location.href=popurl;
}
},false);


Find the comment: "// get forge prefs and display forge"
And append this to the end of the block that the comment is referring to:

var lastForgeStep=GM_getValue('cb2currentforgestep',1);
document.getElementById('forgesteps').selectedIndex=lastForgeStep-1;

I hope I am not treading on your toes here fex, but I was curious to see how difficult this was, and it really isn't too bad with Greasemonkey. (Although, it would have helped if your program had a few more comments explaining things :P)

Miandrital February 17 2007 7:08 AM EST

I had to add one more thing to make the forge "memory" perfect so instead of me posting that, I will provide you with a file containing all the needed changes.

Vicious Cat February 17 2007 2:31 PM EST

2) Recent fight page-Description: I added some "fight/add" buttons on this page as well as a little frame to store the results of the add or fight for quick adding to your fight list. I also made it so when you click a persons name it inspects them in the little frame as opposed to loading a new page.

I like the first part of this, but the second part - the inspect thing is so cramped that it doesn't look very good.

As a side note - is there any chance of a 'delete' button on the page, so that if you have someone in your fight list and want to get rid of them you can do it from there, also reporting in the small frame?

Thanks Veri, and your contribution is definitely appreciated here :-)

AdminNightStrike February 17 2007 3:50 PM EST

I was working on a way to transload the information form the train page into my calculator on shade's site. It might be useful. I also was decoding the play by play to serve up all sorts of useful summarizing information.

A good suggestion might be to modularize your script so that people who don't forge don't pull in the forge code. It might speed things up.

AdminQBVerifex February 17 2007 6:16 PM EST

No it's all good Mian! I appreciate anyone contributing to the code. Making the script remember the forge step it is currently on isn't the thing that I was imagining would be terribly difficult.

It's the checking to make sure the page they are on currently is not a bot-check or error page step that gets hairy. As I need to attach an event to another pages "unload" event that changes a variable on my script that says the page hasn't reloaded yet, then attaching another event onload for the newly loaded page that changes a variable on the script to tell it that it is okay to advance to the next forging step.

Miandrital February 17 2007 9:44 PM EST

@Vicious Cat:

Check out the changes I made to my GM script. If you can't understand that, you may be interested in looking at the guide which will hopefully help you to figure out what the changes do. With a little effort you should be able to mod your own script. Let me know if you need help with that.

@fex:
Those two links might also interest you :)

I'm off to go see what else I can do to make cb easier for me :)

Vicious Cat February 18 2007 4:30 AM EST

Mian - cheers, I shall have a look at that, however I have very limited time to learn new stuff and I looked at GM once before. That said - is there an easy way in GM to do as NS says, and get selected information from the pbp into a text file? If there is, I will make the effort to learn, as it is something I have wanted to do for a while.

ScY February 18 2007 8:36 AM EST

This is just another weird thing which happened to me twice already

-when i forge, and run out of BA, but press the forge button (on vex's script) when i have 0 BA, the forge job doesn't advance (meaning that it doesn't go to the next step) and it goes to a buy BA page (BA restores every 10 minutes etc. etc.)

thats not the problem however, when i buy BA and then go back to the forge, whatever the next step i forge is always the wrong step, thus the dwarf comes back to tell me that "that is not how you do it"

this is only slightly annoying as both times i had already spent like 13 BA on teh current cycle, and for it to get reset is just "arrrgrhh"

again, the weird thing is that the forge doesn't advance, i checked that. And what I know about coding wouldn't fill a children's book. ;)
This thread is closed to new posts. However, you are welcome to reference it from a new thread; link this with the html <a href="/bboard/q-and-a-fetch-msg.tcl?msg_id=00221k">Verifex's Script Discussion v2</a>