|
yull26m Beginner
Joined: 05 Jan 2010 Posts: 26
|
Posted: Tue Jan 05, 2010 7:29 am
help with #if trigger please |
ok this is the output of my mud that I am working with:
< 424h/264H 124v/124V Pos: standing >
the triggers I have set up for what I want to do are as follows:
#trigger {<(*)h/(*)H (*)v/(*)V} @current_hitpoints = %1;@full_hitpoints = %2}
#alias weapon_check {#math vamp {@full_hitpoints*@times};#if @current_hitpoints=>447 {wield @weapon} {rem @weapon}}
@var time {1.6931818181818181818181818181818}
and I have a timer set up to go off every 20 ticks with the action of weapon_check. what I am trying to get it to do is if my @current_hitpoints, which would be the 424 number, are equal to or above 447 I want it to wield @weapon but if it is below 447 I want it to rem @weapon. I can type #sa @vamp @current_hitpoints/@full_hitpoints and it will display 447 424/264 but when the timer activates the alias it always comes up with wield @weapon, even when I have 290h/264H it still comes up with wield @weapon. can anyone tell me what I am doing wrong that it will not remove @weapon when it is suspose to?
P.S. thank you in advance for any help that anyone maybe able to give me. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Jan 05, 2010 9:41 am |
=> is backwards, it should be >=. Also, should have () around the condition.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
yull26m Beginner
Joined: 05 Jan 2010 Posts: 26
|
Posted: Tue Jan 05, 2010 4:36 pm |
did not work. part of a log:
< T: Mevy TP: sta TC: excellent E: drunk EP: sta EC: few wounds>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [1 hits]
< 415h/264H 124v/124V Pos: standing >
< T: Mevy TP: sta TC: excellent E: drunk EP: sta EC: few wounds> TICK IN 20 SECONDS.
rem sword
You are not using it.
< 414h/264H 124v/124V Pos: standing >
< T: Mevy TP: sta TC: excellent E: drunk EP: sta EC: few wounds>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [1 hits]
___________________________________________________________________________________________
that part works as it should but this next part should wield sword and yet it returns the same result as above:
____________________________________________________________________________________________
< E: drunk EP: ass EC: bleeding, close to death>
An adult orc enters from the west.
< 461h/264H 124v/124V Pos: standing >
< E: drunk EP: ass EC: bleeding, close to death> TICK IN 20 SECONDS.
rem sword
You are not using it.
< 460h/264H 124v/124V Pos: standing >
< E: drunk EP: ass EC: bleeding, close to death>
You hit a very drunk orc in the throat, he chokes, gasps and dies.
_____________________________________
this is exactly how it is written in my scripts:
_____________________________________
#ALIAS weapon_check {#math vamp {@full_hitpoints*@times};#if @current_hitpoints=<447 {wield @weapon} {rem @weapon}} "anti-paladin"
#TRIGGER {(*)h/(*)H} {@current_hitpoints = %1;@full_hitpoints = %2} "anti-paladin"
#VAR times {1.6931818181818181818181818181818}
_____________________________________________________________________________________________________________________
as far as I can tell, this should act just as I am wanting it to but for some reason I can get it to either "rem @weapon" or "wield @weapon" depending on how I place the "<=" marks. I just had a brain fart, wander if I changed the weapon_check alias to contain another alias if it would give it time to do the math. I am going to try that real quick. will post the results. |
|
|
|
yull26m Beginner
Joined: 05 Jan 2010 Posts: 26
|
Posted: Tue Jan 05, 2010 5:08 pm |
sorry this will be a long post but I am posting a log to show how this trigger is not working and to give you an idea of how it should:
<> START OF TEST LOG
TICK IN 5 SECONDS.
kill drunk
You feel unholy power coursing through your limbs!
< 416h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: few scratches>
A deadly nightmare growls at a very drunk orc.
A deadly nightmare suddenly attacks a very drunk orc!
< 416h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: few wounds>
A deadly nightmare attacks a very drunk orc. [1 hits]
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [1 hits]
< 418h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: pretty hurt> order followers FLEE
Ok.
A deadly nightmare attempts to flee.
A deadly nightmare leaves down.
< 417h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: pretty hurt>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [1 hits]
< 421h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: pretty hurt>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [1 hits]
< 421h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: pretty hurt>
Autosaving...
< 421h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: pretty hurt>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [2 hits]
< 424h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: awful> TICK IN 5 SECONDS.
rem sword <----------------- THIS IS CORRECT HERE IT IS DOING AS IT SHOULD AND REMOVING SWORD BECAUSE IT IS BELOW 447h
-=[a very drunk orc attacks you.]=- [0 hits]
A very drunk orc is stunned!
-=[You attack a very drunk orc.]=- [2 hits]
You are not using it.
< 428h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: bleeding, close to death>
-=[a very drunk orc attacks you.]=- [0 hits]
A very drunk orc is stunned!
A very drunk orc is incapacitated and will slowly die, if not aided.
-=[You attack a very drunk orc.]=- [2 hits]
< 432h/264H 124v/124V Pos: standing >
< E: drunk EP: sta EC: bleeding, close to death>
A very drunk orc is incapacitated and will slowly die, if not aided.
A very drunk orc is mortally wounded, and will die soon, if not aided.
-=[You attack a very drunk orc.]=- [2 hits]
< 441h/264H 124v/124V Pos: standing >
< E: drunk EP: ass EC: bleeding, close to death>
A very drunk orc is mortally wounded, and will die soon, if not aided.
-=[You attack a very drunk orc.]=- [1 hits]
< 445h/264H 124v/124V Pos: standing >
< E: drunk EP: ass EC: bleeding, close to death>
You hit a very drunk orc in the throat, he chokes, gasps and dies.
A very drunk orc is dead! R.I.P.
You receive your share of experience.
g all corpse
drop all.piece
drop all.meat
put all.coins bp
put all bp
g sword bp
put all.coins bp
look
save
exp
@ACTION = KILL @TARGET
#TS 20
Timer now at 20 secs.
The last gasps of a very drunk orc cause a sickening chill to run up your spine.
< 446h/264H 124v/124V Pos: standing >
<>
You get 4 coins from the corpse of a very drunk orc.
There were: 2 silver coins, 2 copper coins.
< 446h/264H 124v/124V Pos: standing >
<>
You don't have any of those to drop.
< 446h/264H 124v/124V Pos: standing >
<>
You don't have any of those to drop.
< 446h/264H 124v/124V Pos: standing >
<>
Ok.
You put 0 platinum, 0 gold, 2 silver, and 2 copper coins into a large leather backpack.
< 446h/264H 124v/124V Pos: standing >
<>
You put 1 items into a large leather backpack.
< 445h/264H 124v/124V Pos: standing >
<>
You get a dull black two-handed sword from a large leather backpack.
< 445h/264H 124v/124V Pos: standing >
<>
You don't have anything to put in it.
< 445h/264H 124v/124V Pos: standing >
<>
West End of the Barreling Brew Tavern and Inn
I am going e
Obvious exits: -East -West# -Down
Fresh blood covers everything in the area.
[2] The corpse of a very drunk orc is lying here.
a piece of softwood lies here.
a piece of hardwood lies here.
a piece of glass lies here.
a small slab of meat is left here.
[22] a slab of orc meat is left here.
A drunkard drinks away his life.(Red Aura)
A deadly nightmare stands here, red eyes glowing hotly.(Red Aura)
< 445h/264H 124v/124V Pos: standing >
<>
Saving (**).
< 445h/264H 124v/124V Pos: standing >
<>
Experience till level: 244792
< 445h/264H 124v/124V Pos: standing >
<> TICK IN 20 SECONDS.
kill drunk
You feel unholy power coursing through your limbs!
< 444h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: few scratches>
@ACTION = WEAPON_CHECK
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [2 hits]
< 447h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: small wounds>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [1 hits]
< 447h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: small wounds>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [2 hits]
< 454h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: few wounds>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [2 hits]
< 456h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: few wounds> TICK IN 5 SECONDS.
rem sword <--------------- RIGHT HERE IT SHOULD BE WIELDING SWORD AND YET IT IS STILL TRYING TO REMOVE SWORD
------------------------------------------------------------------------------------------------------------------------------------------------------------------
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [2 hits]
You are not using it.
< 460h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: drunk EP: sta EC: nasty wounds>
-=[a very drunk orc attacks you.]=- [0 hits]
-=[You attack a very drunk orc.]=- [1 hits]
< 463h/264H 124v/124V Pos: standing >
I changed my alias a little bit in an attempt to check a thought out but it did not work. My new alias is as follows:
#ALIAS weapon_check {#math vamp {@full_hitpoints*@times};weapon_check_continued} "anti-paladin"
#ALIAS weapon_check_continued {#if @current_hitpoints=<447 {wield @weapon} {rem @weapon}} "anti-paladin" |
|
|
|
Mixsel Wanderer
Joined: 02 Feb 2003 Posts: 99 Location: Seattle, Wa
|
Posted: Wed Jan 06, 2010 2:27 am |
I'm Not Sure what exactly is causing what but a small problem i think is
#trigger {<(*)h/(*)H (*)v/(*)V} @current_hitpoints = %1;@full_hitpoints = %2}
are the @ symbols necessary?
current_hitpoints=%1
full_hitpoints=%2
no spaces and no @, those 2 Variables should be defined just fine without the @. |
|
_________________ Spin |
|
|
|
yull26m Beginner
Joined: 05 Jan 2010 Posts: 26
|
Posted: Fri Jan 08, 2010 4:25 am |
Mixsel wrote: |
I'm Not Sure what exactly is causing what but a small problem i think is
#trigger {<(*)h/(*)H (*)v/(*)V} @current_hitpoints = %1;@full_hitpoints = %2}
are the @ symbols necessary?
current_hitpoints=%1
full_hitpoints=%2
no spaces and no @, those 2 Variables should be defined just fine without the @. |
thanx tons bud...will try that right now and post the results....I have used zmud since 1998 and I always thought that the @symbols were required to show that I was assigning a variable. HEH This is news to me that you do not except in #math situations. |
|
|
|
yull26m Beginner
Joined: 05 Jan 2010 Posts: 26
|
Posted: Fri Jan 08, 2010 4:46 am |
< 444h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: teen EP: sta EC: nasty wounds> TICK IN 5 SECONDS.
rem dull
_________________________THIS IS RIGHT AS IT SHOULD BE__________________________________
You are not using it.
< 443h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: teen EP: sta EC: nasty wounds>
-=[a teen-age orc attacks you.]=- [0 hits]
-=[You attack a teen-age orc.]=- [1 hits]
< 446h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: teen EP: sta EC: nasty wounds>
-=[a teen-age orc attacks you.]=- [0 hits]
-=[You attack a teen-age orc.]=- [2 hits]
< 447h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: teen EP: sta EC: pretty hurt>
-=[a teen-age orc attacks you.]=- [0 hits]
-=[You attack a teen-age orc.]=- [1 hits]
< 446h/264H 124v/124V Pos: standing >
< T:(**) TP: sta TC: excellent E: teen EP: sta EC: pretty hurt>
-=[a teen-age orc attacks you.]=- [0 hits]
-=[You attack a teen-age orc.]=- [2 hits]
< 448h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: teen EP: sta EC: pretty hurt>
-=[a teen-age orc attacks you.]=- [0 hits]
-=[You attack a teen-age orc.]=- [2 hits]
< 455h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: teen EP: sta EC: pretty hurt> TICK IN 5 SECONDS.
rem dull
____________________________________THIS IS STILL NOT RIGHT______________________________
You are not using it.
< 455h/264H 124v/124V Pos: standing >
< T: (**) TP: sta TC: excellent E: teen EP: sta EC: pretty hurt>
I now have the triggers set up as such:
#alias weapon_check {#math vamp {@full_hitpoints*@times};weapon_check_continued}}
#alias weapon_check_continued {#if @current_hitpoints=<447 {wield @weapon} {rem @weapon}}
#trigger {(*)h/(*)H} {current_hitpoints=%1;full_hitpoints=%2}
#trigger {T: @char TP} {@action = weapon_check}
#trigger {You receive your share of experience} {@action = kill @target}
I have just started attempting to use #if and #math triggers within the last couple of weeks. This is actually the first attempt and as you can tell, it is not going so well heh. Thus I thought I would come to the experts on the forums of zuggsoft. I have always been able to get help when I needed it here and it has been a life saver for me. I also have another question, does anyone know how to make a trigger to set the timeout margin on the tick timer? I know how to set the tick timer itself, #ts 5, but I need to be able to change the timeout margin as well if there is a way to do it, which I figure surely there is a way to do it but could not find it in the zmud documents. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Jan 08, 2010 7:06 am |
Quote: |
@current_hitpoints=<447
|
This is wrong. This was explained earlier. =< (wrong) is not the same as <= (right). Also, while perhaps you don't strictly need it here, this comparison should be surrounded by a pair of parentheses.
Quote: |
{@action = kill @target}
|
This is also wrong, and was also explained earlier. Drop the @ from the left side of the equal sign. Also, use %concat() to put together the string of "kill @target". You might not get "kill @target" doing it the way you are doing.
Quote: |
#trigger {(*)h/(*)H} {current_hitpoints=%1;full_hitpoints=%2}
#trigger {T: @char TP} {@action = weapon_check}
|
Aside from the earlier problem regarding @action, you will want to set these triggers to Trigger on Prompt instead of Trigger on Newline. The on Prompt option lets your trigger fire as soon as the pattern is matched, whereas the on Newline option makes it wait until the line ends with a carriage return. Syntactically it's not wrong, but the waiting might throw your script out of whack.
Second, in the first trigger, the (*) will also match the "< " prior to the number. Either change * to %d (%n if there are commas involved), or add "< " to the beginning of the pattern.
Quote: |
I also have another question, does anyone know how to make a trigger to set the timeout margin on the tick timer?
|
Check out the #TIMER command. The third argument determines whether to show a message or not, and the fourth argument lets you set the time that the message would be shown. Of course, I just took a quick peek at the CMud help file so it might not be the same as in ZMud (#TIMER, however, is a pretty old command). |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
yull26m Beginner
Joined: 05 Jan 2010 Posts: 26
|
Posted: Fri Jan 08, 2010 7:39 am |
MattLofton, could you show me exaples of what you mean on each of those advices? Like I said, I am very new to #if triggers.
{@action = kill @target} works quite well. I have had no problems with it but if there is an easier way to do it, then I would like to know it and maybe even try it. I am all for effective ways.
I can see what you are saying about this, {(*)h/(*)H}, and I actually had it set up with the < in it, not sure what happened to it.
in this, @current_hitpoints=<447 , does the "<" or ">" always go before the "="? I am mostly asking so as to learn more about it.
I understand what you are saying for the most part, but my brain just does not totally comprehend it all and therefore I would like to see your advice shown as an example if you could please, just so I can have a clearer view of what you mean.
also, I have not found anything bout a third or fourth, or even second arguement for a tick timer line. All I know of doing the tick timer is #ts 5 to set the tick to 5 seconds. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Fri Jan 08, 2010 9:45 am |
Quote: |
@action = kill @target
|
1)@action. Simple string variables like you are doing only have one field of data, so while @varname=value is syntactically wrong it also happens to be functionally identical to varname=value. The problem arises when you want to assign values to multiple fields in a datarecord variable:
varname.firstname = Ted
varname.lastname = Nugent
varname.occupation = "Rock Star"
varname.age = 23
Now, I dunno if you know who Ted Nugent is but he's definitely not 23 years old now. If I wanted to update the age field, if I did @varname.age = 65 then the contents of @varname would be like so:
varname.age = 65
The firstname, lastname, and occupation fields no longer exist.
2)kill @target. ZMud uses whitespace to parse objects in the code. When it encounters brackets of some kind (double quotes, square brackets, curly brackets, parentheses), it treats everything within the brackets as one object. Sometimes it doesn't matter if you don't use brackets, but sometimes it does (in CMud, it always matters).
Quote: |
does the "<" or ">" always go before the "="? I am mostly asking so as to learn more about it.
|
Always before:
<= less than or equal to
>= greater than or equal to
!= not equal to
~= pattern matching (the newer %match() replaces this)
Quote: |
also, I have not found anything bout a third or fourth, or even second arguement for a tick timer line. All I know of doing the tick timer is #ts 5 to set the tick to 5 seconds.
|
This is why I directed to you to the #TIMER command. Open up the helpfile and read through it a little before it welds itself to your computer. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
yull26m Beginner
Joined: 05 Jan 2010 Posts: 26
|
Posted: Fri Jan 08, 2010 6:56 pm |
I have the targeting all set up to where it works perfectly. These triggers are the ones I use:
#TRIGGER {An old male orc is moving very slowly} {@target = male}
#TRIGGER {An orc playing cards quickly lowers his hand, and reaches for a dagger} {@target = card}
#TRIGGER {A large dog walks slowly down the road} {@target = dog}
#TRIGGER {An adult orc wanders around} {@target = adult}
#TRIGGER {A mother orc is looking for her cubs} {@target = mother}
#TRIGGER {A father orc is on his way home} {@target = father}
#TRIGGER {A common female orc walks around here} {@target = female}
#TRIGGER {A drunkard drinks away his life} {@target = drunk}
#TRIGGER {A small dog is here chasing (*) tail} {@target = dog}
#TRIGGER {An old female orc is moving very slowly} {@target = female}
#TRIGGER {A common male orc shuffles down the path} {@target = male}
#TRIGGER {A young adolescent orc scans the crowd looking for a mark} {@target = teen-age}
#TRIGGER {A very large warg is wandering about here, snarling viciously at you} {@target = warg}
I just need help on the #if and #math and timeout margin triggers. I am reading the documents for the timer again atm. |
|
|
|
|
|
|
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
|
|