About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
littleron
Beginner


Joined: 05 Feb 2005
Posts: 11

PostPosted: Sat Feb 05, 2005 7:54 pm   

Zmud Script
 
I was reading over multiple tutorials, yet I did not find this. I was curious when Im scripting and I want my bot to move around while the combat is at zero, so I set a class {move}. How would I have him move around then when com = 1, he stops moving, but then when com = 0 it moves onto the next direction as located in #CLASS {Move}. In class move I have a list of directions I want the character to go, then when he is attacked, or sees something to attack (which I labeled under the combat class) I want him to stay and fight, but when the fight is over, continue from where he was.
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Fri Feb 11, 2005 12:18 am   
 
if you have set up his path in speedwalk you could just use #step
_________________
megamog75 Smile
I will do this.Nothing in my life matters except this.No moment in my life exists except this moment.I am born in this moment, and if I fail, I will die in this moment. Raistlin Majere
Reply with quote
Lomion
Newbie


Joined: 12 Feb 2005
Posts: 2

PostPosted: Sat Feb 12, 2005 1:41 am   
 
What do you do when your "path" includes actions in addition to directions? For example, I may want to have all of my characters recall once they get to a certain point in the path (in this case, the recall does not take them to recall, but activates a portal to a nearby room) and then continue with the path.

I was not smart enough to use paths from the start, and instead created lists of directions in the form {n|w|s|e|s|s|s|e|n} etc, popping items off of the list and executing them when I was done slaughtering things in a room. However, I'm having the same type of problem - I cannot include alias commands within my list, as they do not get expanded properly.

Either way, I am having trouble figuring out how to incorporate actions in the form of aliases into my paths. Any advice?

Thanks,

Lomion
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Feb 12, 2005 2:35 am   
 
to execute the commands in an alias named doit in the default class,do this
Code:
#exec %session.GetAlias("doit","").Value


to execute commands in a list that includes the path instructions

Code:
#var pathlist {north|east|west|do a command|north}
#loop %numitems(@pathlist) {#exec %item(@pathlist,%i}
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Lomion
Newbie


Joined: 12 Feb 2005
Posts: 2

PostPosted: Sat Feb 12, 2005 4:21 am   
 
Thank you very much for your reply, Dharkael! Worked like a charm, of course. =)

Lomion
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Feb 12, 2005 5:20 am   
 
sure thing but i just found a function that does it too so you can skip that %session.GetVar bit
just do
#exec %alias(doit)
you cant specify a class but can pass in parameters,
and if you want to use aliases from a certain class
just use the #CLASS command to switch classes
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Feb 13, 2005 5:08 am   
 
The class character is a wonderful thing.
.\doit
.\class\doit

There really is no reason to #EXEC with an alias in the %alias fashion.
#EXEC is needed when using %item because the return value of %item actually has "" around it.

littleron, the common methods for preforming a movement bot are:
Use paths and slow walk mode. The integration with the mapper can be tricky with #STEP, #STOP, and #PAUSE; but the mapper keeps track of the path for you, and preforms door actions in a consistent manner.
Write you own path system with lists. This sounds like what you started. In general the triggers required are nearly the same as the path method. The only big difference is that you have to have your own counter for indexing the list.

The most common item to trigger on to detect a successful movement is an exits line. This line is generally only seen in response to a movement or a look. So is a good indicator that the step was successful. My first rule with all major scripts is wait for a prompt to send the next command. This insures that all available data has been received and the script can then make an intelligent choice about what to do. For the bot you wish to make you would follow these rough steps.
issue 'look' on activation set a pending movement flag.
trigger for exit line clears pending movement flag.
triggers for mob record what is there.
trigger for prompt
if move not pending then if mob present issue 'kill' else issue movement

The main things for preforming movements would be %item, #ADD, %numitems, and #EXEC (if you are going to use aliases or multiple commands with a ; as a single movement item).
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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