Twilight Forums

Idle chat for wannabe heroes
It is currently Sat Sep 20, 2014 5:02 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 353 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next
Author Message
 Post subject: Re: Greasemonkey
PostPosted: Tue Sep 29, 2009 8:47 pm 
Offline
User avatar

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

_________________
Image
Vote for TH on global rankings!


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Tue Sep 29, 2009 9:23 pm 
Offline
User avatar

Joined: Thu Sep 06, 2007 10:56 pm
Posts: 1466
Location: Berkeley when at school, San Diego when at home
Funny story.

THIS ISN'T CHATHZZAR'S SCRIPTS.

WTF.

_________________
Image
Vote for TH on global rankings!


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Thu Oct 01, 2009 5:41 am 
Offline
User avatar

Joined: Mon Dec 17, 2007 8:24 pm
Posts: 1234
Location: Baton Rouge, LA
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"


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Thu Oct 01, 2009 3:07 pm 
Offline

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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Thu Oct 01, 2009 8:27 pm 
Offline

Joined: Mon Nov 19, 2007 6:29 pm
Posts: 1827
Location: Florida
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.


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Wed Oct 07, 2009 3:18 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Wed Oct 07, 2009 9:52 am 
Offline
User avatar

Joined: Thu Oct 01, 2009 10:49 am
Posts: 460
Location: Florida, USA
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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Wed Oct 07, 2009 11:15 am 
Offline

Joined: Mon Nov 19, 2007 6:29 pm
Posts: 1827
Location: Florida
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.


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Wed Oct 07, 2009 5:31 pm 
Offline
User avatar

Joined: Thu Oct 01, 2009 10:49 am
Posts: 460
Location: Florida, USA
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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Fri Oct 09, 2009 1:27 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Sun Oct 11, 2009 8:19 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Sun Oct 11, 2009 9:04 pm 
Offline
User avatar

Joined: Sun Apr 08, 2007 1:01 am
Posts: 4553
Location: the Conservatory with the lead pipe
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).

_________________
Image
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Tue Oct 13, 2009 3:27 am 
Offline
User avatar

Joined: Sun Apr 08, 2007 1:01 am
Posts: 4553
Location: the Conservatory with the lead pipe
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.

_________________
Image
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Tue Oct 13, 2009 4:18 am 
Offline
User avatar

Joined: Mon Dec 17, 2007 8:24 pm
Posts: 1234
Location: Baton Rouge, LA
I agree. That would be awesome.

_________________
Image
I've won the 100k DD bet so many times, I should have the title "Mr. Luck"


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Tue Oct 13, 2009 6:19 am 
Offline

Joined: Mon Nov 19, 2007 6:29 pm
Posts: 1827
Location: Florida
Remind me the javascript for ring the fuck out of your computer's bell, I'll get right on it.


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Tue Oct 13, 2009 8:44 pm 
Offline
User avatar

Joined: Thu Sep 06, 2007 10:56 pm
Posts: 1466
Location: Berkeley when at school, San Diego when at home
Told ya people would want monster specific strategies...

_________________
Image
Vote for TH on global rankings!


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Tue Oct 13, 2009 8:47 pm 
Offline
User avatar

Joined: Sun Apr 08, 2007 1:01 am
Posts: 4553
Location: the Conservatory with the lead pipe
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.

_________________
Image
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Tue Oct 13, 2009 10:49 pm 
Offline

Joined: Mon Nov 19, 2007 6:29 pm
Posts: 1827
Location: Florida
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.


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Wed Oct 14, 2009 12:25 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Wed Oct 14, 2009 12:41 am 
Offline
User avatar

Joined: Sun Apr 08, 2007 1:01 am
Posts: 4553
Location: the Conservatory with the lead pipe
For what it's worth, clicking "Wear Things" will automatically refresh the left pane.

_________________
Image
The churches are empty / The priest has gone home / And we are left standing / Together alone
--October Project: "Dark Time"


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Wed Oct 28, 2009 1:53 am 
Offline

Joined: Mon Nov 03, 2008 12:54 am
Posts: 732
All's Quiet on the Nearby Front please? Here's the source

Code:
<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>


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Thu Oct 29, 2009 12:53 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Thu Oct 29, 2009 12:55 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Thu Oct 29, 2009 2:28 pm 
Offline
User avatar

Joined: Mon Dec 17, 2007 8:24 pm
Posts: 1234
Location: Baton Rouge, LA
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"


Top
 Profile  
 
 Post subject: Re: Greasemonkey
PostPosted: Thu Oct 29, 2009 2:52 pm 
Offline

Joined: Mon Nov 19, 2007 6:29 pm
Posts: 1827
Location: Florida
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 353 posts ]  Go to page Previous  1 ... 4, 5, 6, 7, 8, 9  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group