Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Anferny
Newbie


Joined: 17 Mar 2003
Posts: 7

PostPosted: Mon Mar 17, 2003 3:02 pm   

Script help
 
I am trying to figure out how to make a script and not having much luck.

Basically here is what I want to do.

I want to have a script I can turn off and on (Doesn't always do it)

Now for as what the script does I want to be able to have it so that whenever I flee while the script is on I automatically go back into the room and attack again. For example.

I type kill orc

You stab an orc
An orc stabs you

Then I type flee

You sprint southeast.

I want to then go back into the room (Opposite direction)

Have it attack the orc again, and then have me flee, and repeat the process until they die

Please help.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Mar 17, 2003 7:29 pm   
 
#VAR autoreturn 0 0
#AL autoreturn {#MATH autoreturn !@autoreturn}
#AL flee {#IF (@autoreturn) {#T+ autoreturn;~flee} {#T- autoreturn;~flee}}
#AL kill {#VAR target {%-1};~kill %-1}
#CLASS autoreturn disable
#TR {You sprint southeast} {northwest;~kill @target;~flee}
#TR {is dead} {#T- autoreturn}
#CLASS 0

You'll need additional triggers for other directions.
(Optional) You can easily display the status of the script on the status line.
#ST AutoReturn: %if( @autoreturn, "ON", "off")

LightBulb
Advanced Member
Reply with quote
Anferny
Newbie


Joined: 17 Mar 2003
Posts: 7

PostPosted: Mon Mar 17, 2003 11:48 pm   
 
How do I actually get that in?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Mar 18, 2003 12:16 am   
 
Just copy and paste it into the command line and press Enter.

Kjata
Reply with quote
Anferny
Newbie


Joined: 17 Mar 2003
Posts: 7

PostPosted: Tue Mar 18, 2003 12:26 am   
 
Allright :)
I got it in and everything so everything is great so far. Only one small problem.

It is reading me going back in the other direction after the flee, to attack, as me leaving again so in turn it tries to go back the opposite way and attack.

kill orc
You slap an orc around
flee
You sprint nw
(se from the script)
You sprint se
(kill orc from the script)
(flee from the script)
(nw from the script)
(kill orc from the script)
(flee from the script)
You slap an orc
(First flee kicks in)
You sprint north
(Commands for going back south, killing orc, and fleeing are all outputted)
(Commands from the sprint southeast that shouldn't be recognized go off causing it to go in the wrong direction etc etc and throw off the rest of the script.)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Mar 18, 2003 3:04 am   
 
I didn't realize sprint was your normal movement description. That does complicate things. One solution is to add another variable to indicate whether you are fleeing or returning.

#VAR autoreturn 0 0
#VAR fleeing 0 0
#AL autoreturn {#MATH autoreturn !@autoreturn}
#AL flee {#IF (@autoreturn) {#T+ autoreturn;~flee} {#T- autoreturn;~flee}}
#AL kill {#VAR target {%-1};~kill %-1}
#CLASS autoreturn disable
#TR {You sprint southeast} {#IF (@fleeing = 0) {#VAR fleeing 1;northwest;~kill @target;~flee}}
#TR {is dead} {#T- autoreturn}
#CLASS 0

LightBulb
Advanced Member
Reply with quote
Scouts
Newbie


Joined: 17 Mar 2003
Posts: 5
Location: USA

PostPosted: Tue Mar 18, 2003 3:44 am   
 
I could use some help with three issues please. The MUD I’m playing is Gemstone.

1. I’d like to have certain variables change based on the character I’m playing. I set up a database hoping to match the character name with a database key and thus pull the data I need from fields. I’m having no luck.

2. For scripting help, could someone please write an instructional simple script that:
a. “LOOK”s is a room
b. identifies a creature. (@critter)
c. “KILL”s the creature
d. waits a specified “Round Time: 5”
e. than “ATTACK”s again

3. Is there a list of the gemstone gsl triggers and what their vales mean?

Thanks.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Mar 18, 2003 12:46 pm   
 
Please post this in a new thread. The original post in here belongs to someone else.

Also, you might want to try looking in the Finished Scripts forum. There are a lot of scripts there posted for Gemstone. Another place to look in would the Beta Forum, which has a post of the various GSL tags and what each means. If you don't have access to the Beta Forum, just apply using the link in the All Forums page and you get access automatically.

Kjata
Reply with quote
Anferny
Newbie


Joined: 17 Mar 2003
Posts: 7

PostPosted: Wed Mar 19, 2003 7:53 pm   
 
Thanks for the large amount of help so far. I think I am starting to understand some.

I am now having the problem of it not working at all...

Let me see if I can't look at it and figure out what might be causing it.

Well. If fleeing isn't set to 1 or on than the script stops basically...

How is fleeing triggered. The begining of the script looks like it dimensionalizes it.

And nothing my small small brain can see actually sets the fleeing variable to 1 or sets it back to 0

Once again. Thanks for the help so far, hopefully you can help some more because I really think I am starting to understand it.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Mar 20, 2003 2:55 pm   
 
@fleeing is initially set to 0, with a default value of 0. The default value will be applied whenever you connect to the MUD so the script should work (at least) once per session.

However, you're right. Once @fleeing is set to 1 there's nothing to set it back to 0 other than a reconnect. That was an oversight on my part.

#VAR autoreturn 0 0
#VAR fleeing 0 0
#AL autoreturn {#MATH autoreturn !@autoreturn}
#AL flee {#IF (@autoreturn) {#T+ autoreturn;~flee} {#T- autoreturn;~flee}}
#AL kill {#VAR target {%-1};~kill %-1}
#CLASS autoreturn disable
#TR {You sprint southeast} {#IF (@fleeing = 0) {#VAR fleeing 1;northwest;~kill @target;~flee} {#VAR fleeing 0}}
#TR {is dead} {#T- autoreturn}
#CLASS 0

LightBulb
Advanced Member
Reply with quote
Anferny
Newbie


Joined: 17 Mar 2003
Posts: 7

PostPosted: Thu Mar 20, 2003 6:22 pm   
 
{#VAR fleeing 1;west;kill worm;flee}{#VAR fleeing 0}

That is what I get as output whenever I flee east.

Also I am getting

{#VAR fleeing 1;south;kill worm;flee}{#VAR fleeing 0}

Whenever I go north without fleeing.

Everything seems to be working except it is outputting stuff it shouldnt and the wrong way.

You have been a great help so far.
Think you can help me finish it off?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Mar 20, 2003 7:04 pm   
 
You are missing spaces; change from }{ to } {
quote:

{#VAR fleeing 1;west;kill worm;flee} {#VAR fleeing 0}
{#VAR fleeing 1;south;kill worm;flee} {#VAR fleeing 0}



Ton Diening
Reply with quote
Anferny
Newbie


Joined: 17 Mar 2003
Posts: 7

PostPosted: Thu Mar 20, 2003 9:30 pm   
 
Great! Thank you alot! I am really starting to get the hang of this.

Here is a related question.

What if instead of just killing them from the same room I wanted to use a ranged attack that put me into the room with them again

For Example

kill orc
You slash an orc
flee
You sprint to the northwest

And then here you wanted to see

leap southeast orc

And the game would return

You sprint southeast
Your leap wounds the orc.

And then you would want it to flee

And leap again at the orc from whatever direction. Just like the current script except with this ranged attack.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Mar 21, 2003 5:37 am   
 
You can easily change the commands used.
#TR {You sprint northwest} {#IF (@fleeing = 0) {#VAR fleeing 1;leap southeast @target;~flee} {#VAR fleeing 0}}


LightBulb
Advanced Member
Reply with quote
Anferny
Newbie


Joined: 17 Mar 2003
Posts: 7

PostPosted: Fri Mar 21, 2003 7:46 am   
 
Here is what I have for the modified script

#VAR autoreturn 0 0

#VAR fleeing 0 0
#AL autoreturn {#MATH autoreturn !@autoreturn}
#AL flee {#IF (@autoreturn) {#T+ autoreturn;~flee} {#T- autoreturn;~flee}}
#AL leap {#VAR target {%-1};~leap %-1}
#CLASS autoreturn disable
#TR {You sprint southeast} {#IF (@fleeing = 0) {#VAR fleeing 1;leap northwest @target;~flee} {#VAR fleeing 0}}
#TR {You sprint northwest} {#IF (@fleeing = 0) {#VAR fleeing 1;leap southeast @target;~flee} {#VAR fleeing 0}}
#TR {You sprint southwest} {#IF (@fleeing = 0) {#VAR fleeing 1;leap northeast @target;~flee} {#VAR fleeing 0}}
#TR {You sprint northeast} {#IF (@fleeing = 0) {#VAR fleeing 1;leap southwest @target;~flee} {#VAR fleeing 0}}
#TR {You sprint north} {#IF (@fleeing = 0) {#VAR fleeing 1;leap south @target;~flee} {#VAR fleeing 0}}
#TR {You sprint south} {#IF (@fleeing = 0) {#VAR fleeing 1;leap north @target;~flee} {#VAR fleeing 0}}
#TR {You sprint east} {#IF (@fleeing = 0) {#VAR fleeing 1;leap west @target;~flee} {#VAR fleeing 0}}
#TR {You sprint west} {#IF (@fleeing = 0) {#VAR fleeing 1;leap east @target;~flee} {#VAR fleeing 0}}
#TR {You sprint up} {#IF (@fleeing = 0) {#VAR fleeing 1;leap down @target;~flee} {#VAR fleeing 0}}
#TR {You sprint down} {#IF (@fleeing = 0) {#VAR fleeing 1;leap up @target;~flee} {#VAR fleeing 0}}
#TR {is dead} {#T- autoreturn}
#CLASS 0
#ST AutoReturn: %if( @autoreturn, "ON", "off")


Now I am having a problem like this.

leap nyo
A nyogtha dodges your attack.
flee
You sprint south.
leap north north nyo
flee

As you can see I cam getting a double direction which is making it basically leap to the north at north and the game ignores the nyogtha target.

Any idea on how to fix this small bug would be appreciated
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Mar 21, 2003 8:33 am   
 
You are nesting it with the alias.
#VAR autoreturn 0 0

#AL leap {#VAR target {%-1};~leap %-1}
#CLASS autoreturn disable
#TR {You sprint southeast} {#IF (@fleeing = 0) {#VAR fleeing 1;leap northwest @target;~flee} {#VAR fleeing 0}}
..


Simple fix to your logic is to quote the leap command:
#TR {You sprint southeast} {#IF (@fleeing = 0) {#VAR fleeing 1;~leap northwest @target;~flee} {#VAR fleeing 0}}


Ton Diening
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net