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


Joined: 05 Dec 2002
Posts: 6
Location: Poland

PostPosted: Thu Dec 05, 2002 4:06 pm   

Problem with a healing trigger
 
Hello.

I am not sure whom to write to so maybe you can help me.
I'm am using a Zmud ver. 3.62a 16-bit. I'm not really fluent in programing so I wanted to ask you one question. When I type: "group" it lists me all my group members with their health points, move points and so on. like this:

Your group consists of:
( Head) 98/98 hit, 53/112 move Xantor
(Front) 342/342 hit, 66/116 move Norath
(Front) 378/755 hit, 73/115 move Xeron
(Back) 268/490 hit, 56/105 move Tarex
(Back) 124/235 hit, 53/120 move Linch


Is there a possibility to get current hp of a player divide it by his max hp and display for example in percentage like:

Your group consists of:
( Head) 98/98 hit, 53/112 move Xantor
(Front) 342/342 hit, 66/116 move Norath
(Front) 378/755 hit, 73/115 move Xeron <========= HEAL XERON !!!!
(Back) 268/490 hit, 56/105 move Tarex
(Back) 124/235 hit, 53/120 move Linch

Is it possible to make something like this:

example for Xeron:

(Front) x/y hit, 73/115 move Xeron

if x/y is less then 25% display <========= HEAL XERON !!!

or anything similar. I'm a cleric and it would help me alot.
I've tried to read help and tried to do it myself but my english is not too good and I have problems in understanding it. I'm just to lame to do it so please help me. :)

Thanks in advance,
Albert.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Dec 05, 2002 11:45 pm   
 
Since I don't have 3.62 and I'm not sure what commands are in it, I'm going to stick to some very basic commands. Instead of adding the "Heal person" message, I'm going to make it so the trigger colors the line of the person with low hp:
#TRIGGER {~(%w~) (%d)/(%d) hit, %d/%d move %w} {#IF (%eval((%1 * 100)/%2) < 25) {#COLOR red}}

To create the trigger, just copy and past the code above into the zMUD command line and hit Enter.

Kjata
Reply with quote
Abi
Newbie


Joined: 05 Dec 2002
Posts: 6
Location: Poland

PostPosted: Fri Dec 06, 2002 9:52 am   
 
Thx VERY much for help. I did like you told me and after hittin enter I get a message (from zmud): "right parenthesis expected". There appeared a new line in my trigers so I see that it's almost workin :) I am not sure but i'll try to resolve it myself. Big thanx again Kjata :)
Reply with quote
Abi
Newbie


Joined: 05 Dec 2002
Posts: 6
Location: Poland

PostPosted: Fri Dec 06, 2002 10:31 am   
 
...after that msg about the parenthesis is displayed, 1 trigger apeared in my triggers menu:
pattern:
~(%w~) (%d)/(%d) hit, %d/%d move %w
and command:
#IF ( < 25) {#COLOR red}

I understand (a little) what's written here, but just cant make it workin...
Reply with quote
knuffel
Wanderer


Joined: 12 Jul 2002
Posts: 73

PostPosted: Fri Dec 06, 2002 11:34 am   
 
Hi,

It seems the (%eval((%1 * 100)/%2) is missing as it should be part of the pattern and thus it will not work.

Let me try to explain what it should do

#TRIGGER {~(%w~) (%d)/(%d) hit, %d/%d move %w} {#IF (%eval((%1 * 100)/%2) < 25) {#COLOR red}}

by pasting it in your command line, zMUD created the trigger but since your version is very low it dropped the most important part.

#TRIGGER >> tells zMUD it is a trigger and not e.g. an alias ( #ALIAS )

so it will create for you a trigger with following pattern.

{~(%w~) (%d)/(%d) hit, %d/%d move %w}

the pattern is always the first {} the second {} is the action it should fires.

so ..

{ >> opens pattern
~ >> a new line so if it would be like You say: ( Head) 98/98 hit, 53/112 move Xantor
it will not trigger.
(%w~) >> the first variable witch can be (Head) (Front) ...
(%d)/(%d) >> the variables that will be used
hit, >> comes from the pattern
%d/%d >> again variables
move >> comes from the pattern
%w >> again a variable.
} >> ends pattern.

your initial sentence
( Head) 98/98 hit, 53/112 move Xantor
is split up into variables and fixed values so zMUD has something to work with.

next it will execute it's action with the second set of {}

so this is.

{#IF (%eval((%1 * 100)/%2) < 25) {#COLOR red}}

the first { and last } is to show that all that is contained within the brackets is the action that will be executed when the pattern matches.

#IF >> an if condition, this means something needs to fullfill the condition to execute an action.
Like IF it's Chiara's Birthday, she will get a present. We check the day and indeed today it is her birthday so she get's a present.

In your case it is the following that is checked and if it's true will trigger the next action.

(%eval((%1 * 100)/%2) < 25)

%eval is a way of saying is the same as.
than some basic math
the first variable %d wich is x from your example times 100 divided by the second variable %d wich is y and if this value is smaller as 25 it will execute the pattern {#COLOR red}.

{#COLOR red} means in zMUD that it will color the line RED that fits the condition.

Now in your case the mathematical expression is not there and this is most probably due to the release you are in.

It seems it does not take the %eval cause.
What you could try to make sure this is the case is try to add the (%eval((%1 * 100)/%2) in front of <25 but if zMUD complains it is because it does not understand what you want to do. And then it would mean a more basic way of creating this trigger would be required or upgrade to a newer release and enjoy the fun of all the coding.

Since you are a cleric, you will most probably enjoy the other new features of a later release too and the Gurus will be able of helping you more easily.

I just try to explain what all the little pieces ment to make it more logical for you (so if it was already all very clear, excuse me as I must have misunderstood your last post).

Greetz
Knuff
Reply with quote
Abi
Newbie


Joined: 05 Dec 2002
Posts: 6
Location: Poland

PostPosted: Fri Dec 06, 2002 1:29 pm   
 
WoW! Thanx VERY much for AWESOME explanation :) Now it looks more clear to me. I'm really shocked, cause I never registered on any forum and didnt even know that there is such a way to get good answers or help people resolve them.
Concerning the update of my Zmud I think it's not possible. That's why I'm using so old version cause it could be downloaded for free. I dont have the money to buy a new Zmud and didn't want to do those hacking-cracking things which I personaly dont like. I've tried some clients but Zmud suits my needs in the best way, so I'll have to manage with this old version :)
Is there any other command that can be used instead of this %eval?
Anyway you all helped me very much.
BIG THANX TO YOU ALL!!!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Dec 06, 2002 6:59 pm   
 
Try it without the %eval.
#TRIGGER {~(%w~) (%d)/(%d) hit, %d/%d move %w} {#IF (((%1 * 100)/%2) < 25) {#COLOR red}}

LightBulb
Senior Member
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