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 Goto page Previous  1, 2
darkfenix Posted: Sat Feb 02, 2002 8:27 am
Robot Script
Tarn
GURU


Joined: 10 Oct 2000
Posts: 867
Location: USA

PostPosted: Tue Feb 12, 2002 10:05 pm   
 
Keeping everything in separate scripts would make your debugging a lot easier. This will be in pseudocode so everyone can follow what it's trying to do.

Part 2: The walker

We want a variable to keep track of where we are, and one to store the desired path.

#var Position 1
#var Path "n|e|s|w|STOP"

We want to periodically check if we're doing anything, and, if not, advance another step.

#VAR busy 0

#ALARM 5 {CHECK_AND_STEP}

That's an alarm that will fire every five seconds. In place of CHECK_AND_STEP, we want to check the value of busy. If it's zero, we want to take another step. If not, we just wait for the next time the alarm fires.

What we want to do if we're stepping:
#EXEC %item(@path,@position)
#add position 1

which gets the appropriate direction step out of the path list, and advances us to the next position. We could also store other things in the path list, like "open door", if that's required. We will want to do something when we hit "STOP", but what is likely to be a personal thing. (Start again, go somewhere else, etc.)

Any time the rat triggers notice something to fight, we let the alarm know we're busy:
#var busy 1

Any time the rat triggers are done killing and picking up rats, we let the alarm know it can take another step:
#var busy 0

Part of the rationale for a custom slow-walk is that other things can be incorporated. As an example, each step might have another path associated with it that is an escape route if the bot thinks it's being attacked. The fleeing for the exit of the sewers can then be handled by the same mechanism.

-Tarn
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Wed Feb 13, 2002 12:08 pm   
 
TaisharMalkier thanx for the contribution....but should i run SLOWWALK then use alias rat1? im not sure how to do it =)

as for tarn im not sure what to replace in yours hehe.

fleeing isnt really important so we can scrath that extra head ache out =)
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Wed Feb 13, 2002 12:48 pm   
 
hmmm ok i tried out the ur script TaisharMalkier

changing the first to lines to

#ALIAS rat1 {s|s|se|se
#ALIAS rat2 {s|s|se|se

i assume i am to use this area for directions....but i end up not getting anywhere and giving the command {s|s|se|se

am i doing it rite?
Reply with quote
TaisharMalkier
Novice


Joined: 28 Sep 2001
Posts: 45
Location: USA

PostPosted: Wed Feb 13, 2002 1:38 pm   
 
No, you shouldnt run SLOWWALK..this is a script for that path.
To start it, you should stand in the room to start in then type your first alias, rat1.

#ALIAS rat1 {#var next rat2;#var skiproom 0;#T+ CheckForPpl;look;#ALARM {+10} {#T- CheckForPpl;#if (skiproom=0) {#T+ Attack;co rat} {{#T- CheckForPpl;@next}}}
#ALIAS rat2 {n;e;e;#var next rat2;#var skiproom 0;#T+ CheckForPpl;look;#ALARM {+10} {#T- CheckForPpl;#if (skiproom=0) {#T+ Attack;co rat} {{#T- CheckForPpl;@next}}}
#ALIAS rat3....
#ALIAS rat4....
and so on and so forth.
The part in red should be the directions that you have to move from room to room. You are going to have to make as many aliases as there are rooms in your exping path.

Contain rather than hurt.
Hurt rather than maim.
Maim rather than kill.
Kill rather than be killed.
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Thu Feb 14, 2002 11:00 am   
 
hmmm a bit tiring but ill give it a shot hehe
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 867
Location: USA

PostPosted: Thu Feb 14, 2002 6:57 pm   
 
Ok, part 2, more specific this time

The following is the script of a class named SlowWalk. It's tested offline in 6.16, but retyped here:

#CLASS {SlowWalk}
#ALIAS StartWalk {
#var walking 1
#var pos 1
#alarm +5 {DoWalk}
}
#alias PauseWalk {#var walking 0}
#alias ResumeWalk {#var walking 1;#alarm +5 {DoWalk}}
#alias DoWalk {#if (@walking=1) {
#exec %item( @path, @pos)
#add pos 1
#alarm +5 {DoWalk}
}}
#var walking {1} {0}
#var Path {"#echo Path test|#var walking 0;#echo End of Path"} {}
#var pos {1}
#CLASS 0

Put the sequence of direction commands in the variable Path, separated by |, the standard list separator.

StartWalk to begin from scratch.
PauseWalk to suspend for a bit.
ResumeWalk to start up again where you left off.

You would invoke PauseWalk any time you wanted to wait for a little while to do something in the room. The alarms are set for 5 seconds; that's easy to change. (The + means a one time only trigger, different than I proposed earlier but easier to deal with).

-Tarn
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Fri Feb 15, 2002 9:51 am   
 
hmmm i tried both ur scripts...and they still dont work...i

#ALIAS rat1 {s;#var next rat2;#var skiproom 0;#T+ CheckForPpl;ql;#ALARM {+10} {#T- CheckForPpl;#if (skiproom=0) {#T+ Attack;co rat} {{#T- CheckForPpl;@next}}}
#ALIAS rat2 {s;#var next rat3;#var skiproom 0;#T+ CheckForPpl;ql;#ALARM {+10} {#T- CheckForPpl;#if (skiproom=0) {#T+ Attack;co rat} {{#T- CheckForPpl;@next}}}

sends the command

{s;#var

to the mud

#CLASS {SlowWalk}
#ALIAS StartWalk {s|s|s|se|nw|w|w|sw|s}

sends the commmand

s|s|s|se|nw|w|w|sw|s

to the mud all at ounce hehe

if there is a way to get around it pls let me know =)

oh and like i said before is theer a way to just set SLOW WALK on a 10 sec timer and NOT make it abort....this would work fine i think
slow walking works but it aborts after it moves ounce.....i cant figure out how to not make it abort and wait 10 secs in a room if you know how i think this will solve my problem
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Feb 15, 2002 1:08 pm   
 
darkfenix, please don't take this the wrong way, but do you know anything about zScript's (that's the name of zMUD's code) syntax, commands and functions? In the last few replies, you have been describing problems which are clearly syntax errors and should have been catched by you. If you can't even do this, you can't attempt to create a project as large and complex as a killing bot.

The problem you just described about the alias sending:
{s;#var

to the MUD is clearly a syntax problem and it is all because the two alias are missing a closing } at the end. Then you say that:
#ALIAS StartWalk {s|s|s|se|nw|w|w|sw|s}

sends:
s|s|s|se|nw|w|w|sw|s

Well, of course it will, because the syntax for the #ALIAS command is:
#ALIAS aliasName {commands}

Since you are puttinga string list in the commands part and a stringlist is no known zMUD command or function, then zMUD assumes that this is a command of the MUD and thus sends it as is.

You said that you have read the 4.62 help file, and you are right, that won't help too much, but if you did read it completly it would be abig step. I wonder, why don't you have the 6.16 help file? However, if you don't have it, the help file is online and you can find it right here in the Support section.

A good help file reading will start by reading all of the topics under the Getting Started section. After that is done, you proceed to familiarize yourself with zMUD's commands and functions by looking at the listing under Command Reference and Function Reference. Also, when inside any of these two sections, there is a link at the top to see the pre-defined variables. This is very good reading too. Doing all this will give you an idea of what zMUD is capable. If there is a particular command or function you don't understand from reading the short description in there, click on it for a more detailed explanation and possibly some examples.

There isn't any book on learning zScript, nor will you find any classes anywhere. The help file is how we all learned zScript and we believe that is something anyone can do.

If you don't want to read the help file then the only option you have is to hope that someone will make a complete script without bugs that you can put into zMUD. This, however, as states many times before, requires detailed information of the problem at hand including sample MUD output. After this, then you just have to hope that someone will be kind enough and will have enough time to create the script.

Again, I do not want you take all of this the wrong way, because it is not an attack agaisnt you or anything, but you are trying to run without knowing how to walk.

Kjata
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Sat Feb 16, 2002 3:44 pm   
 
well yes the mud isnt accepting the sintaxs.....oh and im not offended one bit =) i know ive been annoying hehe but if i understood it and wat the ppl have been suggesting worked it would have been done a long time ago. dont think im not trying on my end cuz i am i really am and well im failing which is pretty obvious

right now ive tried to manipulate the code in ever way possible but it doesnt work so im taking a different approach

simply makin my guy slow walk and not abort with a 10 sec delay per room....no triggers and stuff just walk room to room with 10 secs in each room.....4.62 had an option for this as the help files show so im wondering now if 6.16 can do it....if not well ill drop the robot idea or find 4.62 and DL it.....
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Feb 16, 2002 5:18 pm   
 
That's exactly the problem, you need to understand what the people are doing. A help file will never be able to teach you programming logic, because that is something which is acquired by practice and natural problem-solving skills. It can, however, teach you syntax and the diferent purposes of each command and function. If you understand both of these, you should be able to follow any script that is given to you and understand what it should do. Furthermore, by understanding the syntax of the language, you can spot common errors like leaving a ;, a }, or a space.

It generally not that the scripts people provide do not work it is more often one of two cases: 1) The script has a syntax error (which you should be able to spot), 2) The script is made with some specifc information or output in mind which does not exactly match your MUD (in which case it is solved by providing more detailed information).

About the slow walk, I really don't remember 4.62 that much anymore, but I know that in 6.16 you can set how much time the slow walk will wait before it aborts (or disable the abort timer completly.) The way slow walk works, it sends the first direction in the path and then it waits for one of two things: 1) The timer reaches zero and the slow walk is aborted, 2)The user sends the #OK command which tells zMUD the move was succesful. You can find the settings for slow walk by clicking in the Prefs button and going to the Slow Walk section in here.

To make slow walk work, you need to create triggers that will fire of something letting them know the move was succesful and then the triggers will use the #OK. An alternate method to this is found in the Preferences for Slow Walk. You will see a box here that lets you enter messages received from the MDU that let zMUD know the move was succesful (this is equivalent to creating the triggers yourself.)

Again, this is all explained in the help file and reading about all of the commands that are under Speedwalking Commands in the Command Reference would help you out a lot.

Kjata
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Sun Feb 17, 2002 2:48 am   
 
ok i got the slow walking to work without spamming the mud....now all i need is for it to wait in the room for at least 10 secs so that rat will appear do i use the #ALARM command?

below is the script i made following 4.62 help file...should work i think but need the 10 sec delay....i should use #ALARM rite? im not sure

#CLASS {robot}
#TRIGGER {exits leading} {#OK}
#VAR victim "rat"
#TRIGGER {A ({@victim}) noses its way cautiously} {#STOP;cor %1}
#TRIGGER {A baby ({@victim}) noses its way cautiously} {#STOP;cor %1}
#TRIGGER {I see no "rat" to take.} {#STEP}
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Feb 17, 2002 1:32 pm   
 
Ok, first, #STOP will not confirm the last step, so when you use #STEP to continue the slow walk, it will sned the last direction again. What you want to use is #PAUSE which confirms the last step and waits for you to use #STEP before it continues.

Also, since you want to wait 10 seconds in each room, you must first get rid of the Timer to abort slow walk. Go into Prefs, then to the Slow Walking section and uncheck the Timeout aborts walk option. You also do not want to send #OK right when you see the exits since the slow walk will continue as soon as the exits are show. What you want, just like you said, is an alarm. Just create a temporary alarm (I'm not sure if these are in the 4.62 help file, but the 6.16 help file is online in this webpage) that will fire in ten seconds and sends the #OK command. You can put the command to create the alarm where you have #OK right now (in the tirgger for the exits.) This will work because once you use #PAUSE, it doesn't matter if you send #OK, the slow walk won't continue until you send #STEP.

Kjata
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Sun Feb 17, 2002 2:49 pm   
 
ok almost done now!! hehe

#CLASS {robot}
#VAR victim "rat"
#ALIAS cor {sdk @target;ucp @target;ucp @target}
#TRIGGER {exits leading} {#ALARM +15}
#TRIGGER {A ({@victim}) noses its way cautiously} {#PAUSE;cor %1} "" {prompt}
#TRIGGER {A baby ({@victim}) noses its way cautiously} {#PAUSE;cor %1} "" {prompt}
#TRIGGER {A young ({@victim}) noses its way cautiously} {#PAUSE;cor %1} "" {prompt}

it doesnt move for 15 secs now but a new problem has arisen hehe when the rat pops up it doesnt register for some reason and the trigger (#PAUSE) isnt done...wat now? oh i added (prompt) since it thoguht it would help.

my guess is i did something wrong with the VAR maybe?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun Feb 17, 2002 5:29 pm   
 
Is @victim always going to be a rat or could it also be a string list?

Also, the #ALARM should sned #OK, example:
#ALARM +15 {#OK}

Kjata
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Mon Feb 18, 2002 10:59 am   
 
hmmm the target will always be a rat =)
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Feb 18, 2002 12:54 pm   
 
Well then, there is no reason to use a variable, since the value will always be fixed. Replace @victim with "rat" and the %1 in the triggers with "rat" too. Also, the prompt option is not necessary since the message should come on a line by itself. Then, you call the alias and send it as a parameter "rat", but the alias doesn't use that, it just does some commands to @target which I see defined nowhere. I think your script should look like:
#CLASS {robot}
#VAR victim "rat"
#ALIAS cor {#VAR target %1;sdk @target;ucp @target;ucp @target}
#TRIGGER {exits leading} {#ALARM +15 {#OK}}
#TRIGGER {A rat noses its way cautiously} {#PAUSE;cor rat}
#TRIGGER {A baby rat noses its way cautiously} {#PAUSE;cor rat}
#TRIGGER {A young rat noses its way cautiously} {#PAUSE;cor rat}
#TRIGGER {I see no "rat" to take.} {#STEP}
#CLASS 0

Aside from that, everything else looks fine.

Kjata
Reply with quote
darkfenix
Wanderer


Joined: 02 Feb 2002
Posts: 58

PostPosted: Mon Feb 18, 2002 3:06 pm   
 
BINGO!!! THANX FOR THE HELP AND PATIENCE KJATA!!! it all good now =) works just as i want it to =)
Reply with quote
dk92870
Newbie


Joined: 07 Mar 2002
Posts: 4
Location: USA

PostPosted: Thu Mar 07, 2002 2:56 am   
 

I am trying to create a bot that only walk between two rooms (basically left room and right room). I want to be able to monitor my hit point (HP) and my magic point (MP) so that it does not fall under certian number.
Also I want to make sure my weapon is not fumble or shatter or broken and if they are broken or fumble, the bot should be able to use alternative weapon.
The rooms, assume Left and Right, has following info. Left is where the Monster is and Right is rest area. I was thinking if it is possible (is it reall hard?) to do a bot just walk to Left and hit the monster once then walk back to Right room, without getting hit by monster. (when I use macro key, I won't get hit).
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Thu Mar 07, 2002 5:28 am   
 
dk, please start a new thread with your request, some mud output, things you've tried and the like. While this is a bot script, it sounds like what you want doesn't really match this particular script. So start a new thread and we'll try to get it banged out :)

Iljhar
Reply with quote
benjunmun
Beginner


Joined: 23 Feb 2002
Posts: 23

PostPosted: Mon Mar 18, 2002 4:15 am   
 
sorry, this post really confused me. Could someone smarter please show me the whole script? I play on the same mud and this would be really useful
Reply with quote
Sinema
Beginner


Joined: 14 Nov 2001
Posts: 27
Location: USA

PostPosted: Mon Aug 01, 2005 12:15 am   ...
 
....


Last edited by Sinema on Mon Aug 01, 2005 9:34 pm; edited 1 time in total
Reply with quote
Sinema
Beginner


Joined: 14 Nov 2001
Posts: 27
Location: USA

PostPosted: Mon Aug 01, 2005 1:03 am   
 
this wasn'ta bump, was an actual question but i doubt Guru's are around anymore so I tossed it..
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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