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


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 6:31 pm   

questions
 
I want to make an auto healer using:

#variable hp 807
#TR <%1hp %2ma %3mv> {#IF {@hp<600}}{c heal}

That anywhere near correct?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Sat Feb 23, 2008 7:20 pm   
 
You need to use real wildcards in your pattern and not %1-%99. You need to start with this:

#trig {pattern} {script}

and then add your items in. Your pattern will be something like <(%d)hp (%d)ma (%d)mv>. And your script will be #if (@hp<600) {c heal} - so substitute them in:

#trig {<(%d)hp (%d)ma (%d)mv} {#if (@hp<600) {c heal}}

However, since your trigger pattern already has the value of your current HP in, you don't need to use a variable at all:

#trig {<(%d)hp (%d)ma (%d)mv} {#if (%1<600) {c heal}}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 7:25 pm   
 
only problem is it tries to double cast even if %1 is over 600
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 7:25 pm   
 
fixed it I think, brb new post
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 7:27 pm   
 
K, I got it to only heal if I'm below 600 but it seems to be casting an extra heal
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 7:57 pm   
 
Ok, onto the next question. How to I disable this trigger from healing if my mana is under 50? I've got the obvious part..

#trig {<(%d)hp (%d)ma (%d)mv>} {#if (%2<50) {?????}
#trig {<(%d)hp (%d)ma (%d)mv>} {#if (%1<600) {c heal}}


I also had to input two other triggers to disable this trigger when I go berserk. But I'm uncertain that's correct also.

For disabling:
#trig - {<(%d)hp (%d)ma (%d)mv>} {#if (%1<600) {c heal}}

And enabling:
#trig +{<(%d)hp (%d)ma (%d)mv>} {#if (%1<600) {c heal}}

I'm sure there are tons of things I'm doing wrong.
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Feb 23, 2008 8:46 pm   
 
You can name your trigger and use #T- trigger_name instead
You can also disable triggers and alias by placing the trigger or alias in a class and using #T- class_name
If the healing alias is inside the class you disable, the alias's name will be sent as text to the mud - bad thing

So you need to further make 'conditional' variables that you can use in if statements when the conditions are right. These can get complicated

edit: That could look like this:

#if (%1<600 and %null(@IMBerserk)) {alias}

well you don't need to, I am speaking hypothetically (and watching tv)

or you can put the condition in the alias, database functions are cool for these kinds of collections


Last edited by Leitia on Sat Feb 23, 2008 9:05 pm; edited 1 time in total
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 9:03 pm   
 
K, I feel stupid...but name my trigger? Everytime I try to rename it it changes the pattern as well.
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Feb 23, 2008 9:06 pm   
 
the triggers have tabs, but you need to find it in Settings not the wizard I suspect. This is not easy at first, but gets way easy, well if you have no deadline but treat the complications like a puzzle


Last edited by Leitia on Sat Feb 23, 2008 9:10 pm; edited 1 time in total
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 9:09 pm   
 
I generally figure everything out on my own. It's when I have my daughters with me things become jumbled. But I'll check on those tabs right now. Thank you
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Feb 23, 2008 9:23 pm   
 
The interactions can be particular. I learned a lot using #show @new_variable or function in scripts. Sometime the debugger is quicker then writing #show. Mostly with #IF you need to learn what functions make numbers out of everything. I still need HELP open constantly.

edit: that numbers thing, like you can match strings to strings but sometimes you find yourself with a number and a string and an if statement too and then say, ok I need (1 AND 'RAINING'). That was the hardest thing for me as it was not obvious in help

sorry, I would have read that as meaningless, I was trying to save you time though
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 10:17 pm   
 
Ok, I'm coding this completely off the top of my head, so it's probably wrong.

#CLASS {manamonitor} {enable}
#TRIGGER {<(%d)hp (%d)ma (%d)mv> <%d>} {#trig {<(%d)hp (%d)ma (%d)mv>} {#if (%2<50) {#CLASS {autoheal} 1}}
#TRIGGER {<(%d)hp (%d)ma (%d)mv> <%d>} {#trig {<(%d)hp (%d)ma (%d)mv>} {#if (%2>50) {#CLASS {autoheal} 0}}
#CLASS 0

#CLASS {autoheal} {enable}
#TRIGGER{<(%d)hp (%d)ma (%d)mv>} {#if (%1<600) {c heal}}
#CLASS 0

#CLASS {zerkmonitor}
#TRIGGER {The fever passes and you regain your senses - to find your target no longer before you.} {#CLASS {autoheal} 0}}
#TRIGGER {You let out a mighty roar as the blood fever takes hold of you!} {#CLASS {autoheal} 1}}
#CLASS 0

Would that work?
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Feb 23, 2008 10:37 pm   
 
(this wasn't really relevant)


Last edited by Leitia on Sat Feb 23, 2008 11:18 pm; edited 2 times in total
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sat Feb 23, 2008 10:41 pm   
 
Code:


#CLASS {Heals}
#TRIGGER {~<(%d)hp (%d)ma (%d)mv~> ~<%d~>} {#if (%2<50) {#t- autoheal};#if (%2>50) {#t+ autoheal}}
#TRIGGER "autoheal" {~<(%d)hp (%d)ma (%d)mv~>} {#if (%1<600) {c heal}}
#CLASS 0




Prog
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Sat Feb 23, 2008 10:49 pm   
 
Why do I need the tilde's? The other stuff I understand.
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Sat Feb 23, 2008 11:05 pm   
 
Use tilde's to make ZMud use special symbols literally, you can also delay execution of things with them. To use a tilde in a trigger you would have to put a tilde before it, as it's special too. It is called an escape character
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Feb 25, 2008 7:48 am   
 
You don't actually need to escape <>s though, they're not special. Why go to all the trouble of using two triggers?

#TRIGGER "autoheal" {~<(%d)hp (%d)ma (%d)mv~> ~<%d~>} {#if (%1<600 AND %2>50) {c heal}}

Your previous example was wrong because the triggers contain the #trig command. Once you understand that #trigger and #trig are the same thing, you'll see how it repeats itself.

You'll notice that the trigger command I have above has the string "autoheal" at the start - this is its ID. You can use #t- and #t+ with that name to enable and disable the trigger if you want to (like when you're berserking).
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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