Page 7 of 9

Re: Greasemonkey

Posted: Tue Sep 29, 2009 8:47 pm
by MagiNinjA
Er. I think you're misunderstanding me. It's MUCH LESS work if you moved the choice adventure things into the choice adventure script. Literally code for the 4th choice and you're done.

I think it's better to have two scripts that are cleaner (not to mention you don't have to manage the second one after you're done!) and actually function as they're supposed to. Modularity.

After all, most of the function you need in the Choice Adventure script is already done for you.

Again, what I'm saying, ultimately, is that you'll do LESS WORK, make LESS MISTAKES and be MORE COMPATIBLE with users who have both scripts already. Is this a bad thing, somehow?

Re: Greasemonkey

Posted: Tue Sep 29, 2009 9:23 pm
by MagiNinjA
Funny story.

THIS ISN'T CHATHZZAR'S SCRIPTS.

WTF.

Re: Greasemonkey

Posted: Thu Oct 01, 2009 5:41 am
by Corrupt Shadow
Magi's just a cranky, old coot. Ignore him. :lol:

Oh, Doc, is there a way to code in something to the effect of:
if hit_points <= num1
then stop auto_attack

Re: Greasemonkey

Posted: Thu Oct 01, 2009 3:07 pm
by Satan
Uh, I'm not a GM expert, but isn't it possible to simply regex it from the already loaded nav frame?

Re: Greasemonkey

Posted: Thu Oct 01, 2009 8:27 pm
by Satan
Well, JS can be a bitch, so I'm not often willing to do tons of work in it, but I /do/ know it. I just don't know how GM differs (do you use actual JS, or is it some kind of modified version of JS, etc.). But, assuming it was actual JS, you could access what's in that pane with parent.nav.innerHTML, then regex it with a match for whatever's necessary (I'm sure you know how to do that). This is assuming that your location of the script is done from the perspective of the middle pane, so that calling the parent would get the main window, then nav gets the nav frame, then innerHTML gets its contents.

Re: Greasemonkey

Posted: Wed Oct 07, 2009 3:18 am
by Muhandes
I tried to add the "Trapped!" adventure on my own but I guess I'm missing something. Adding the line:

numComChoice["Trapped!"+"choice"] = "1";

makes the script stop working.

Here is the frame source for this adventure:

Code: Select all

<HTML><head><link rel='stylesheet' href='includes/style.css'><script type='text/javascript'>if (self.location == top.location)
top.location.href = 'index2.php';</script><script language=Javascript src='http://www.twilightheroes.com/scripts/popup.js'></script></head><BODY> 
<table border=0 cellspacing=0 cellpadding=4 width='100%'><tr valign=top><td width='100%'><h2>Trapped!</h2><font class='text'>

On what should have been a routine patrol along the edges of the hive, you stumble into what appears to be an entire squadron of renegade robots. There are way too many to fight at once, so you duck back into an alley, but it's too late. One of the scouts sounds an alarm, and in moments dozens of robots are after you!<BR><BR>Over the course of a few minutes of sprinting, you manage to lose most of the robots. But then you turn down what turns out to be a dead-end alley, sealed at the end by a towering brick wall. You turn, but you can see the glow of a headlight approaching the opening to the alley. There could be anything out there, maybe just one robot, maybe an entire swarm. What do you do?<form action=fight.php method=post><input type=radio name=choice value='1' checked>Run away!<BR><input type=radio name=choice value='2'>Run towards the foe! <BR><input type=submit value='Which way to run?'></form> 


</td><td align=center><img src='images/foes/brick-wall.jpg' height=200 width=200 border=3><BR><b></b></td></tr></table><script type='text/javascript'>top.nav.location='nav.php';</script> 

</font>

</BODY>
</HTML>

Re: Greasemonkey

Posted: Wed Oct 07, 2009 9:52 am
by AldenteVonTino
Somehow I feel as if I have stepped into another dimension.
I know all of this has to be important for the game, but is all this something *I* need to be concerned with? I only know a bit of BASIC and even less of Visual Basic!
I could be in serious trouble now!
:? :shock: :?

Re: Greasemonkey

Posted: Wed Oct 07, 2009 11:15 am
by Satan
Actually, scripts are usually made to be user-accessible. All you'd have to do is add them to Grease Monkey (an FF add-on). They make certain aspects of the game less-repetitive/more convenient. But they're not necessary, and the only people dealing with code are the people who make them.

Re: Greasemonkey

Posted: Wed Oct 07, 2009 5:31 pm
by AldenteVonTino
Personally I find things acceptable as they are, but then again I just got here lol!
I suppose later on I might 'deserve' some assistance with this code, but for now I'll take it as it comes.
Thanks for getting me off the hook about programming though!

8)

Re: Greasemonkey

Posted: Fri Oct 09, 2009 1:27 am
by Muhandes
Doc Igor wrote:
Muhandes wrote:I tried to add the "Trapped!" adventure on my own but I guess I'm missing something. Adding the line:

numComChoice["Trapped!"+"choice"] = "1";

makes the script stop working.
I'll assume that was a typo, and just say that the problem was likely forgetting the line:
nonComChoice["Trapped!"+"submitvalue"] = "Which way to run?";

But I've updated the script, and even set it for your preferred choice, muh.
Bah, silly muh.

Re: Greasemonkey

Posted: Sun Oct 11, 2009 8:19 am
by Muhandes
Anyone willing to have a look at the rest link script and make it work with the new rest page? I'm thinking of a link that will always do a "simple" rest when clicked.

Re: Greasemonkey

Posted: Sun Oct 11, 2009 9:04 pm
by Cristiona
Doc Igor wrote:If you want to modify the script in a simple way (by using different choices for the choice adventures, or making some different strategies be included in the options given) the code has plenty of explanation how to do so, even for luddites.
Very easy, actually. All the extra comments make it pretty easy, even to do more involved editing. Switch a choice adventure's easy enough, but it was also easy to figure out how to add new attack combinations (such as Voodoo Doll, Then 2 Stars, Then Attack).

Re: Greasemonkey

Posted: Tue Oct 13, 2009 3:27 am
by Cristiona
Since many people would like to actually see the UR adventure they've blindly stumbled into, would it be possible to have this (autoadventure) script abort if it encounters one of the known UR combats (Big Chinned Wise Guy, Kraken, some wacky pit beastie, Azathoth, and the squirrel)? That way you could change tactics (um... if you... wanted to...) or just look up and noticed it happened. It don't know how big a pain in the ass that would be, but it sounds neat to me.

Re: Greasemonkey

Posted: Tue Oct 13, 2009 4:18 am
by Corrupt Shadow
I agree. That would be awesome.

Re: Greasemonkey

Posted: Tue Oct 13, 2009 6:19 am
by Satan
Remind me the javascript for ring the fuck out of your computer's bell, I'll get right on it.

Re: Greasemonkey

Posted: Tue Oct 13, 2009 8:44 pm
by MagiNinjA
Told ya people would want monster specific strategies...

Re: Greasemonkey

Posted: Tue Oct 13, 2009 8:47 pm
by Cristiona
It's not so much monster-specific as a triggered abort. On KoL, I used a speed scriptlet for the longest time that was nothing other than attacking and picking option #1 on every choice adventure (it didn't run through GM, so it was a single, complex, line), but it had an abort for the UR encounters. And one that could be easily edited to abort for other things.

I'm fine using the same strategy on every monster, there's no need to store specific tactics.

Re: Greasemonkey

Posted: Tue Oct 13, 2009 10:49 pm
by Satan
The only UR that 'times out' is the cube one, which isn't a battle anyways. As far as I know, you'll still be in the UR battle when you log back in, just like the rest.

Re: Greasemonkey

Posted: Wed Oct 14, 2009 12:25 am
by Muhandes
Another small request. Can someone add a "refersh" link to the left pane? I keep using items through mid-clicking which opens a new page, and then I need to manually refresh.

Re: Greasemonkey

Posted: Wed Oct 14, 2009 12:41 am
by Cristiona
For what it's worth, clicking "Wear Things" will automatically refresh the left pane.

Re: Greasemonkey

Posted: Wed Oct 28, 2009 1:53 am
by Muhandes
All's Quiet on the Nearby Front please? Here's the source

Code: Select all

<HTML><head><link rel='stylesheet' href='includes/style.css'><script type='text/javascript'>if (self.location == top.location)
top.location.href = 'index2.php';</script><script language=Javascript src='http://www.twilightheroes.com/scripts/popup.js'></script></head><BODY> 
<table border=0 cellspacing=0 cellpadding=4 width='100%'><tr valign=top><td width='100%'><h2>All's Quiet on the Nearby Front</h2><font class='text'>

You walk through the slums, alert for danger. Everything is quiet ... too quiet. At first you think maybe that's a sign something is about to happen, but the longer the silence goes on, you decide maybe there's just something good on TV right now. What do you feel like doing? <form action=fight.php method=post><input type=radio name=choice value='1' checked> See if anything is going on at the park<BR><input type=radio name=choice value='2'> Spend some time exploring back alleys<BR><input type=radio name=choice value='3'> Forget it, let's play pool!<BR><input type=submit value='Make your choice'></form> 


</td><td align=center><img src='images/foes/alls-quiet.jpg' height=200 width=200 border=3><BR><b></b></td></tr></table><script type='text/javascript'>top.nav.location='nav.php';</script> 

</font>

</BODY>
</HTML>

Re: Greasemonkey

Posted: Thu Oct 29, 2009 12:53 am
by Muhandes
Doc Igor wrote:Muh, why are you asking for something that's already included to be included?

oops. Just noticed that I hadn't posted my version of the script lately... and never got around to including that change. Sorry Muh.

Anyhow, the adventure is added. Also included an update that stops the script and resets the round counter if you die. I'll probably start working on a 'chicken' option for the script, to stop the script if your HP drops 'too low'. No promises on how soon that'll be done, though.
Thanks for adding it.

Re: Greasemonkey

Posted: Thu Oct 29, 2009 12:55 am
by Muhandes
Doc Igor wrote: edit: yeah... disregard that last. The new script is finished, and I've even made it available to anyone interested in seeing what I've been asking about.
http://userscripts.org/scripts/show/59951
minor note: apparently because of the way CSS sheets weren't used, the moved text becomes black. I didn't notice because of the userstyle I had been using, but a tester brought it to my attention.
This has a strange effect on the forums. It paints them green.

Re: Greasemonkey

Posted: Thu Oct 29, 2009 2:28 pm
by Corrupt Shadow
I only use "Attack Only" anyway, so that wouldn't bother me.

Re: Greasemonkey

Posted: Thu Oct 29, 2009 2:52 pm
by Satan
The problem is it's attempting to grab the value before the content is fully loaded, I think. You have to use something to check and see if content is loaded. I need to look up what it is again.