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
Enathe
Novice


Joined: 17 Nov 2001
Posts: 34
Location: USA

PostPosted: Mon Jul 08, 2002 2:24 am   

Novice Mudder
 
I am trying to learn how to make an advanced script. I have read most of the help files and I am still quite confused on how to make this script. What I am trying to do is make a script that would allow me to fight automatically, not fight if someone else is fighting, relocate and fight based on the mob and some other criteria. Does anyone know of a website or someone on another mud that would like to teach me a bit about this? I have basic knowledge of triggers, variables, and aliases but am quite confused on advanced scripts. Any help would be greatly appreciated. Thanks all.

Enathe
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Jul 08, 2002 4:42 am   
 
The key to this kind of script is "awareness".

An excellent script must be:

a) self aware - it must know how it is doing. How is the hp level, how is the mana or
heal ability doing. Is it getting its butt kick and needs to flee. Does it know where
it is and where it can retreat to for safety.

b) room aware - probably the hardest thing. It must know what it should expect when
it is moving on its path or in its quest. It must be able to recognize players from
mobs, mobs from objects. It must figure out when to "stop" or not mob steal.

c) people aware - can it spoof talking on a minor level, replying to people and terminating
that conversation quickly but nicely and going to into a suspend mode or rent out for
a bit.

d) spoof aware - if someone is spoofing or trying to muck it up, be able to go into
a panic state, cease and desist its script and rent out with a log to show you what
happenned.

These things take a lot of mud capture to do.


A good script:

Brainlessly follow a path, kill what is expected, know when a mob has been hit by another
or a mob is fighting another, be able to flee/heal up as necessary.

Links for ideas:
Conceptual

Example of a path and killing rats

Ton Diening
Providing untested answers that tend to be
more complicated than others.
Reply with quote
Enathe
Novice


Joined: 17 Nov 2001
Posts: 34
Location: USA

PostPosted: Mon Jul 08, 2002 6:27 am   
 
Thanks for the reply. I read the posts and unfortunately I did not understand them enough to be able to apply them to what I need. If we could, lets take the basic script you spoke of

(Brainlessly follow a path, kill what is expected, know when a mob has been hit by another or a mob is fighting another, be able to flee/heal up as necessary).

The first part is simple. You set a basic script to go in a direction and act when it sees a certain mob. How would I get that script to loop? For example I want to go 4e 8s 3n and back through it again looking for a mob. How would it stop when it sees a mob then continue once the mob is killed. The knowing when a mob has been killed part seems simple enough that could be done with a wait and an alarm (I don't know how to do that but remember seeing it in the help files) then the script would continue (don't know how to do that). Fleeing seems simple enough but I have an enormous amount of trouble trying to set a trigger to heal based on my prompt. I set a trigger such as this:

#TRIG {^~[&hp/&{maxhp}hp &mana/&{maxmana}ma $mv/&{maxmv}~]} {#IF (@hp < @maxhp/10) {cast 'heal'}}

which is right out of the help files, but since my prompt comes up once for every action and the heal spell takes two turns I get double and then double the heals and so on. These are the parts where I get confused I know what the client needs to know to function, but I don't know how to tell it that. Please let me know where to start. I will probably need small lessons that are VERY basic. I have no programming knowledge but am very willing to learn.

Thanks

Enathe
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Jul 08, 2002 6:54 am   
 
Go through that Example of a path and killing rats

Tarn offers great insight on logic.

Kjata has some great concepts on slow walking #STEP'ing through the path and
detecting creatures you wish to kill or move on.

Don't rely on your prompt necessarily to force actions is my feeling. The prompt
shows up often so I prefer the prompt to just update variables. Rely on mud output
to determine what happened or didn't happen.

[1] Concept of Prompt

However to expand on your concept to help you think through things:

To stop your prompt from flooding with action you want to use a flag variable.

Lets use the variable Casting_Heal to toggle when you cast heal.

#VAR Casting_Heal {0} {0}

Defaulted to off or 0.

Lets add that flag variable to your prompt trigger:

#TRIG {^~[&hp/&{maxhp}hp &mana/&{maxmana}ma $mv/&{maxmv}~]} {#IF ((@Casting_Heal == 0) AND (@hp < @maxhp/10)) {cast 'heal';#VAR Casting_Heal 1}}

So only cast heal when we haven't tried to cast heal and when we have a hit point problem.
As soon as you queue the cast 'heal' command we set the Casting_Heal to 1 to flag that
it is being done. This way the next prompt won't spam another request for cast 'heal'

When you see the mud out put that tells you that you have successfully healed yourself
(for example, fictional trigger), you can turn off the variable.

#TRIG {You chant 'heal'$You feel better.} {#VAR Casting_Heal 0}

Then you have to catch the other possibilities like:

#TRIG {You can't think of the words and fail to chant 'heal'} {#VAR Casting_Heal 0}



[2] Concept of path, plagiarized from Kjata's post on page 2 from here.

Define your path:

#PATH My_Run .4e8s3n

Start your run from the right room with:

#ALIAS Start_run {#SLOW My_Run}

Define your enemy:

#VAR victim "rat"

Define your kill strategy (good to hook a fighting flag into your prompt
to make wise decision on whether to heal or do a special attack), took
happy level of @hp > @maxhp/10 being ok to fight:

#ALIAS do_kill {#VAR target %1;#IF (@hp > @maxhp/10) {kill @target}}

Tell the slow walk that you moved a room

#TRIGGER {exits leading} {#ALARM +15 {#OK}}

Triggers to pause your slowwalking to engage the enemy:

#TRIGGER {A rat noses its way cautiously} {#PAUSE;do_kill rat}
#TRIGGER {A baby rat noses its way cautiously} {#PAUSE;do_kill rat}
#TRIGGER {A young rat noses its way cautiously} {#PAUSE;do_kill rat}

Somehow force it to re-examine the room and try to kill something, cheap way
to get the trigger after this one:

#TRIGGER {You get %d experience points} {do_kill @target}

Probably a better way for the next trigger but concept to force the slow walk to start
again:

#TRIGGER {I see no rat here.} {#STEP}

Something to tell you that you have arrived at the end of the path and to retrace your
steps. Might be a zMud something to figure this out internally:

#TRIGGER {Room or trigger to figure you are at the end of the path??} {#RETRACE My_Run}

Ton Diening
Providing untested answers that tend to be
more complicated than others.
Reply with quote
Enathe
Novice


Joined: 17 Nov 2001
Posts: 34
Location: USA

PostPosted: Mon Jul 08, 2002 10:42 pm   
 
Thank alot for your response. I have run into a couple of bugs, but I think you have given me a good foundation to start with. Thanks again for the help.

Enathe
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