Greasemonkey
Moderator: Moderators
- MagiNinjA
- Posts: 1466
- Joined: Thu Sep 06, 2007 10:56 pm
- Location: Berkeley when at school, San Diego when at home
- Contact:
Re: Greasemonkey
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?
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?
- Corrupt Shadow
- Posts: 1234
- Joined: Mon Dec 17, 2007 8:24 pm
- Location: Baton Rouge, LA
- Contact:
Re: Greasemonkey
Magi's just a cranky, old coot. Ignore him.
Oh, Doc, is there a way to code in something to the effect of:
if hit_points <= num1
then stop auto_attack
Oh, Doc, is there a way to code in something to the effect of:
if hit_points <= num1
then stop auto_attack
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"
Re: Greasemonkey
Uh, I'm not a GM expert, but isn't it possible to simply regex it from the already loaded nav frame?
Re: Greasemonkey
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
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:
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>
- AldenteVonTino
- Posts: 461
- Joined: Thu Oct 01, 2009 10:49 am
- Location: Florida, USA
- Contact:
Re: Greasemonkey
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!
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!
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!
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!
Re: Greasemonkey
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.
- AldenteVonTino
- Posts: 461
- Joined: Thu Oct 01, 2009 10:49 am
- Location: Florida, USA
- Contact:
Re: Greasemonkey
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!
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!
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!
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!
Re: Greasemonkey
Bah, silly muh.Doc Igor wrote:I'll assume that was a typo, and just say that the problem was likely forgetting the line: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.
nonComChoice["Trapped!"+"submitvalue"] = "Which way to run?";
But I've updated the script, and even set it for your preferred choice, muh.
Re: Greasemonkey
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.
- Cristiona
- Posts: 5118
- Joined: Sun Apr 08, 2007 1:01 am
- Location: the Conservatory with the lead pipe
- Contact:
Re: Greasemonkey
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).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.
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"
--October Project: "Dark Time"
- Cristiona
- Posts: 5118
- Joined: Sun Apr 08, 2007 1:01 am
- Location: the Conservatory with the lead pipe
- Contact:
Re: Greasemonkey
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"
--October Project: "Dark Time"
- Corrupt Shadow
- Posts: 1234
- Joined: Mon Dec 17, 2007 8:24 pm
- Location: Baton Rouge, LA
- Contact:
Re: Greasemonkey
I agree. That would be awesome.
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"
Re: Greasemonkey
Remind me the javascript for ring the fuck out of your computer's bell, I'll get right on it.
- MagiNinjA
- Posts: 1466
- Joined: Thu Sep 06, 2007 10:56 pm
- Location: Berkeley when at school, San Diego when at home
- Contact:
Re: Greasemonkey
Told ya people would want monster specific strategies...
- Cristiona
- Posts: 5118
- Joined: Sun Apr 08, 2007 1:01 am
- Location: the Conservatory with the lead pipe
- Contact:
Re: Greasemonkey
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.
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"
--October Project: "Dark Time"
Re: Greasemonkey
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
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.
- Cristiona
- Posts: 5118
- Joined: Sun Apr 08, 2007 1:01 am
- Location: the Conservatory with the lead pipe
- Contact:
Re: Greasemonkey
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"
--October Project: "Dark Time"
Re: Greasemonkey
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
Thanks for adding it.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.
Re: Greasemonkey
This has a strange effect on the forums. It paints them green.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.
- Corrupt Shadow
- Posts: 1234
- Joined: Mon Dec 17, 2007 8:24 pm
- Location: Baton Rouge, LA
- Contact:
Re: Greasemonkey
I only use "Attack Only" anyway, so that wouldn't bother me.
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"
Re: Greasemonkey
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.
Who is online
Users browsing this forum: No registered users and 4 guests