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
TitanKiller
Newbie


Joined: 10 Jun 2005
Posts: 8

PostPosted: Thu Jun 16, 2005 12:14 am   

a backstab/flee script
 
Hi guys

I'm trying to write a script for my thief to backstab and flee a mob, then come back and backstab again until the mob is dead. I need to have a hit points, mana points and movement points monitoring, so I made this trigger to keep an eye on it:

Code:
#TRIGGER {^You report: &HpVar(&FullHpVar) hit, &ManaVar(&FullManaVar) mana and &MoveVar(&FullMoveVar) movement points.}


Here's the original output from the mud:

You report: 795(803) hit, 102(102) mana and 269(346) movement points.

My problem is, this is what get's put in the HpVar: 795(803

How do I get it to only put the numbers outside the () into the HpVar and store the FullHpVar correctly too? Another question, And I've been trying without succes, it looks "messy", how can I get my thief to run back into the room it came from? Like if I flee north, then I go back south and backstab again, and have it turn off once the target is dead..?

I hope someone can answer some of those questions!
_________________
Come join me!
AustinMUD - austin.prg.dtu.dk:4000
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Thu Jun 16, 2005 1:15 am   
 
Quote the special chars with ~

#TRIGGER {^You report: &HpVar~(&FullHpVar~) hit, &ManaVar~(&FullManaVar~) mana and &MoveVar~(&FullMoveVar~) movement points.}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
TitanKiller
Newbie


Joined: 10 Jun 2005
Posts: 8

PostPosted: Thu Jun 16, 2005 3:06 pm   
 
thanks that worked, now it only puts the numbers outside the the () into the @HpVar and same with the rest.

I still need help with the moving around, so when I flee north, I go back south and backstab again, and stop doing it when the mob is dead.

Here is what I've got so far, but it's not working (and not finished):

Code:
#ALIAS bs {~backstab %1;#VAR target %1}
#ALIAS setwimp {~setwimp %1;#VAR wimp %1}
#TRIGGER {^You report: &HpVar~(&FullHpVar~) hit, &ManaVar~(&FullManaVar~) mana and &MoveVar~(&FullMoveVar~) movement points.}
#TRIGGER {^@target} {#IF (@HpVar > @wimp) {backstab @target}}
#TRIGGER {^PANIC! You couldn't escape!} {flee}


How can I make the alias setwimp not send an input to the mud, so when I type setwimp 100, 100 get's stored in the @wimp variable, but it's only send to zmud, not the mud?

this trigger loops, I think? Confused

#TRIGGER {^@target} {#IF (@HpVar > @wimp) {backstab @target}}

How can I make that one better..?
_________________
Come join me!
AustinMUD - austin.prg.dtu.dk:4000
Reply with quote
xenapan
Wanderer


Joined: 26 May 2004
Posts: 68

PostPosted: Fri Jun 17, 2005 1:15 am   
 
dont use aliases which are the same as commands in your mud. that causes loops. call it wimpy or something else

so its #ALIAS wimpy {setwimp %1;wimp = %1}

anyhow... i think you want to set a target or else anyone and thing that happens to be IN the room will make you attempt to backstab em.. bad idea :p also.. if you MUD has kill stealing laws etc.. it would be unwise. i suggest setting up separate triggers for each mob you want to deal with. if your mud supports ANSI, turn on ansi trigger in the options, copy and paste the line for the mob. eg The Magistrate stops scribbling and peers at you with deep interest.
THEN you would have the trigger

#TRIGGER {The Magistrate stops scribbling and peers at you with deep interest.} {#IF (@HpVar > @wimp) {backstab magistrate;flee}}

but after that you need to find some way to record which way you fled, use an if statement to choose the right way to walk back in.

funny tho what mud is this? most decent muds wouldnt let you get away with this kinda thing :P
_________________
Player on Realms of Despair. realms.game.org port 4000. Join us today!
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Fri Jun 17, 2005 5:19 am   
 
to use a mud command like that you can do:

#ALIAS setwimp {~setwimp %1;wimp = %1}

saves having to remember new commands(aliases) and the tilde will send the command to the mud instead of parsing it as an alias.
Reply with quote
TitanKiller
Newbie


Joined: 10 Jun 2005
Posts: 8

PostPosted: Fri Jun 17, 2005 12:37 pm   
 
Here's an example from the mud:

Code:
At the docks
The breeze is cool and helps you think more straight. You have a feeling
that you should stay alert in these parts of town, cause this is where
all the scum of the earth must come in order to get a job in this
godforsaken town.
Either a pirate, or a thief, the only career options around here, but
then again, you might have an opportunity to earn a few gold crowns here.

Obvious exits are: North, south, west.
A hired guard is standing here, looking extremely alert
Jax Hp: 389 Mo: 145 >
The night has begun.
Jax Hp: 389 Mo: 145 > setwimp 100
Arglebargle, glop-glyf!?!
Jax Hp: 389 Mo: 146 > backstab guard
You need to wield a weapon, to make it a succes.
Jax Hp: 389 Mo: 146 > l
At the docks
The breeze is cool and helps you think more straight. You have a feeling
that you should stay alert in these parts of town, cause this is where
all the scum of the earth must come in order to get a job in this
godforsaken town.
Either a pirate, or a thief, the only career options around here, but
then again, you might have an opportunity to earn a few gold crowns here.

Obvious exits are: North, south, west.
A hired guard is standing here, looking extremely alert
Jax Hp: 389 Mo: 146 > l
At the docks
The breeze is cool and helps you think more straight. You have a feeling
that you should stay alert in these parts of town, cause this is where
all the scum of the earth must come in order to get a job in this
godforsaken town.
Either a pirate, or a thief, the only career options around here, but
then again, you might have an opportunity to earn a few gold crowns here.

Obvious exits are: North, south, west.
A hired guard is standing here, looking extremely alert
backstab guard
backstab guard
backstab guard
backstab guard
backstab guard
backstab guard
backstab guard
backstab guard
backstab guard
backstab guard
backstab guard
backstab guard


When I use this alias:

Code:
#ALIAS bs {~backstab %1;#VAR target %1}


It expands to backstab guard and sets the word guard as target, which is fine. But the problem is that his short description is:

A hired guard is standing here, looking extremely alert

And with this trigger:

Code:
#TRIGGER {^@target} {#IF (@HpVar > @wimp) {backstab @target}}


It wont backstab him, unless I remove the ^ but when I do it starts looping.. How can I avoid that? your suggestion was fine xenapan, but some mobs change names after you've attacked them, and copy-pasting each time you hit a new mob is too slow (Or I'm too lazy)

The final thing; when I type setwimp 100, it works fine as well, it puts 100 into the @wimp variable, but it also sends it to the mud, and I get the output from the mud: Arglebargle, glop-glyf!?! (Which I'd like not to get), how can I avoid that?
_________________
Come join me!
AustinMUD - austin.prg.dtu.dk:4000
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