|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Wed Mar 22, 2006 3:38 am
pretty new to zmud script |
my prompt is
{HP=4265(91%)/MA=4108(100%)/MV=1628(100%)}-{1,182,812}
all i want to do for now is .. take the health % and mana % and have reactions based on whether or not these are under or over a certain %
can anybody help me? |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Wed Mar 22, 2006 12:34 pm |
Code: |
#TRIGGER {^~{HP=%n~((%n)~%~)~/MA=%n~((%n)~%~)/MV=%n~(%n~%~)~}~-~{%n~}$} {#IF (%1 < 15) {#ECHO Health Low!!};#IF (%2 < 15) {#ECHO Mana Low!!}} |
import that and extend as required.
|
|
_________________ Taz :)
Last edited by Taz on Thu Mar 23, 2006 1:53 am; edited 1 time in total |
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Wed Mar 22, 2006 2:19 pm |
thanks ill try that when i get home .. can you explain what the ~ does in this trigger .. does it negate the ( and ) so it doesnt take it into account when looking for trigger patterns?
|
|
|
|
Alyssandra Newbie
Joined: 13 Dec 2005 Posts: 8 Location: Botley, Oxford, United Kingdom
|
Posted: Wed Mar 22, 2006 4:10 pm |
~ makes the next character a literal. its used because %,( and ) have special meanings in zMUD Scripting, so to make it match them literally in the trigger you need to add the ~
|
|
_________________ All is fair in love and war...
...as long as I'm not losing |
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Thu Mar 23, 2006 3:41 pm |
i put in this trigger and it works thank you .. but i really need it to fire when the prompt is initially displayed .. as it is it seems to fire only when there is another line after the prompt shows.. or am i just out of luck and have to deal with it like that ? thanks very much
|
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Thu Mar 23, 2006 5:24 pm |
#TRIGGER {^~{HP=%n~((%n)~%~)~/MA=%n~((%n)~%~)/MV=%n~(%n~%~)~}~-~{%n~}$} {#IF (%1 < 15) {#ECHO Health Low!!};#IF (%2 < 15) {#ECHO Mana Low!!}} "" {prompt}
The {prompt} bit at the end is the same as going into the trigger, clicking the options tab and checking "trigger on prompt"
If you don't tick that box it'll wait for a newline |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Thu Mar 23, 2006 9:01 pm |
you guys are most helpful thank you .. and now i get greedy .. is there a way to do this using variables instead of the %1 and %2? like have the %n's capture the numbers as variables so i can use other triggers to check them? if that makes sense
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri Mar 24, 2006 1:14 am |
#TRIGGER {^~{HP=%n~((%n)~%~)~/MA=%n~((%n)~%~)/MV=%n~(%n~%~)~}~-~{%n~}$} {#VARIABLE hp {%1};#VA mana {%2};#IF (%1 < 15) {#ECHO Health Low!!};#IF (%2 < 15) {#ECHO Mana Low!!}} "" {prompt}
Click on the blue links to read up more about each command. |
|
_________________ Taz :) |
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Wed Mar 29, 2006 9:19 pm |
all that worked beautifully now i need more again :) this is the output when i scan
- Thorondor
- the bandit
1 north from here you see:
- Wombat
1 east from here you see:
- a shiriff
2 east from here you see:
- a chicken
- a pig
3 east from here you see:
- a shiriff
1 south from here you see:
- a shiriff
2 south from here you see:
- a chicken
3 south from here you see:
- a halfling youth
2 west from here you see:
- the Thain
- a pig
- a pig
if i wanted to make a trigger that would goto the Thain how would i go about this .. thanks again for all the help! |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Thu Mar 30, 2006 12:52 am |
Code: |
#TRIGGER {^(%n) (%w) from here you see~:} {#va scannum %1;#va scandir %2}
#COND {^~- {a |the |}(%w)} {#if (@target = "%1") {#loop @scannum {@scandir}}} {looppat} |
Give that a shot. You'll need to set the target variable before you do the scan. |
|
_________________ Taz :) |
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Thu Mar 30, 2006 3:12 am |
hrm tried that didnt work .. :( not too sure why .. havent dealt with conditions before
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Thu Mar 30, 2006 1:46 pm |
It worked for me given that output. It is possible there are extra spaces or something. Try putting the scan output into [code] brackets so that it can be seen exactly as it comes from the mud.
|
|
_________________ Taz :) |
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Fri Mar 31, 2006 12:44 am |
[Right here you see:]
[ - Thorondor]
[1 north from here you see:]
[ - the blacksmith]
[1 east from here you see:]
[ - the Thain]
[ - a pig]
[2 east from here you see:]
[ - the Miller]
[ - a shiriff]
[1 south from here you see:]
[ - a chicken]
[ - a toddler]
[ - a toddler]
[ - a toddler]
[ - a toddler]
[ - a toddler]
[ - a toddler]
[ - a nursemaid]
[ - a nursemaid]
[3 west from here you see:]
[ - a chicken]
yeah i tried everything i can think of .. cant get it to work |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Fri Mar 31, 2006 1:01 am |
Well that output is entirely different to the last output. How about you give me the mud address and I can have a look for myself?
|
|
_________________ Taz :) |
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Fri Mar 31, 2006 1:49 am |
dragonswords.net 1234
|
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Fri Mar 31, 2006 2:33 pm |
Taz, I think his different output the 2nd time is cause he wanted to show spaces and your suggestion to put brackets was taken literally ;-)
Thorondor, rather than press submit press Preview. That will lead you to a screen with a few other text choices, like BOLD italics underline and Taz'
the code tags are better for spaces.
Code: |
test
test
test
test |
|
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Sat Apr 01, 2006 2:07 am |
yeah i must be missing something either way .. delete the periods and thats the way it looks when scanning .. still cant figure it out .. dragonswords.net 1234 if anybody feels like looking at it for themselves thanks much
.Right here you see:
. - Thorondor
. - a pig
.1 north from here you see:
. - Wombat
.1 east from here you see:
. - a cow
.3 east from here you see:
. - a halfling youth
. - a pig
.1 south from here you see:
. - a shiriff
.3 west from here you see:
. - the Thain[/code] |
|
|
|
Thorondor Beginner
Joined: 22 Mar 2006 Posts: 12
|
Posted: Sat Apr 01, 2006 3:36 pm |
ive got it narrowed down to the variables not working correctly .. the triggers you gave me work great but it wont read from target/scannum/or scandir variables .. ive read the meager help file for variables .. perhaps theres a setting im missing ..
|
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Sat Apr 01, 2006 3:45 pm |
Nope you're not missing a setting. I just had a bit of a brain fart and ignored the line that said "a halfling youth" which will cause a problem because you may have set your target to "youth" rather than "halfling". Having logged on I see that many of the targets have multi word names. The condition trigger needs changing to something like
Code: |
#COND {^ ~- (*)$} {#IF ("%1" =~ @target) {#LOOP @scannum {@scandir}}} {looppat} |
but I'll log on and double check to make sure it works right.
|
|
_________________ Taz :) |
|
|
|
|
|