Greasemonkey

Talk about the game. What game? The game with the power? What power? The power of ... aw, skip it.

Moderator: Moderators

User avatar
MagiNinjA
Posts: 1466
Joined: Thu Sep 06, 2007 10:56 pm
Location: Berkeley when at school, San Diego when at home
Contact:

Re: Greasemonkey

Post 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?
User avatar
MagiNinjA
Posts: 1466
Joined: Thu Sep 06, 2007 10:56 pm
Location: Berkeley when at school, San Diego when at home
Contact:

Re: Greasemonkey

Post by MagiNinjA »

Funny story.

THIS ISN'T CHATHZZAR'S SCRIPTS.

WTF.
User avatar
Corrupt Shadow
Posts: 1234
Joined: Mon Dec 17, 2007 8:24 pm
Location: Baton Rouge, LA
Contact:

Re: Greasemonkey

Post 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
Image
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"
Satan
Posts: 1855
Joined: Mon Nov 19, 2007 6:29 pm
Location: Florida
Contact:

Re: Greasemonkey

Post by Satan »

Uh, I'm not a GM expert, but isn't it possible to simply regex it from the already loaded nav frame?
Satan
Posts: 1855
Joined: Mon Nov 19, 2007 6:29 pm
Location: Florida
Contact:

Re: Greasemonkey

Post 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.
Muhandes
Posts: 732
Joined: Mon Nov 03, 2008 12:54 am
Contact:

Re: Greasemonkey

Post 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>
User avatar
AldenteVonTino
Posts: 461
Joined: Thu Oct 01, 2009 10:49 am
Location: Florida, USA
Contact:

Re: Greasemonkey

Post 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: :?
When you do the best you can it's called a try!
If you don't you need to ask yourself why?
Just give it a thought,
And failure is worth naught.
And then like an eagle you shall fly!
Image
Satan
Posts: 1855
Joined: Mon Nov 19, 2007 6:29 pm
Location: Florida
Contact:

Re: Greasemonkey

Post 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.
User avatar
AldenteVonTino
Posts: 461
Joined: Thu Oct 01, 2009 10:49 am
Location: Florida, USA
Contact:

Re: Greasemonkey

Post 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)
When you do the best you can it's called a try!
If you don't you need to ask yourself why?
Just give it a thought,
And failure is worth naught.
And then like an eagle you shall fly!
Image
Muhandes
Posts: 732
Joined: Mon Nov 03, 2008 12:54 am
Contact:

Re: Greasemonkey

Post 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.
Muhandes
Posts: 732
Joined: Mon Nov 03, 2008 12:54 am
Contact:

Re: Greasemonkey

Post 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.
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: Greasemonkey

Post 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).
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: Greasemonkey

Post 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.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
User avatar
Corrupt Shadow
Posts: 1234
Joined: Mon Dec 17, 2007 8:24 pm
Location: Baton Rouge, LA
Contact:

Re: Greasemonkey

Post by Corrupt Shadow »

I agree. That would be awesome.
Image
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"
Satan
Posts: 1855
Joined: Mon Nov 19, 2007 6:29 pm
Location: Florida
Contact:

Re: Greasemonkey

Post by Satan »

Remind me the javascript for ring the fuck out of your computer's bell, I'll get right on it.
User avatar
MagiNinjA
Posts: 1466
Joined: Thu Sep 06, 2007 10:56 pm
Location: Berkeley when at school, San Diego when at home
Contact:

Re: Greasemonkey

Post by MagiNinjA »

Told ya people would want monster specific strategies...
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: Greasemonkey

Post 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.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
Satan
Posts: 1855
Joined: Mon Nov 19, 2007 6:29 pm
Location: Florida
Contact:

Re: Greasemonkey

Post 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.
Muhandes
Posts: 732
Joined: Mon Nov 03, 2008 12:54 am
Contact:

Re: Greasemonkey

Post 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.
User avatar
Cristiona
Posts: 5118
Joined: Sun Apr 08, 2007 1:01 am
Location: the Conservatory with the lead pipe
Contact:

Re: Greasemonkey

Post by Cristiona »

For what it's worth, clicking "Wear Things" will automatically refresh the left pane.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
Muhandes
Posts: 732
Joined: Mon Nov 03, 2008 12:54 am
Contact:

Re: Greasemonkey

Post 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>
Muhandes
Posts: 732
Joined: Mon Nov 03, 2008 12:54 am
Contact:

Re: Greasemonkey

Post 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.
Muhandes
Posts: 732
Joined: Mon Nov 03, 2008 12:54 am
Contact:

Re: Greasemonkey

Post 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.
User avatar
Corrupt Shadow
Posts: 1234
Joined: Mon Dec 17, 2007 8:24 pm
Location: Baton Rouge, LA
Contact:

Re: Greasemonkey

Post by Corrupt Shadow »

I only use "Attack Only" anyway, so that wouldn't bother me.
Image
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"
Satan
Posts: 1855
Joined: Mon Nov 19, 2007 6:29 pm
Location: Florida
Contact:

Re: Greasemonkey

Post 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.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests