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


Joined: 28 Nov 2006
Posts: 2

PostPosted: Tue Nov 28, 2006 9:07 am   

Gauges And Auto-Healing
 
Okay, I've been reading as much as I can, but I'm fairly new to ZMud scripting (and scripting in general) so I could really use some help.

General Information
I'm using ZMud 7.21, playing Aetolia and my current level of knowledge doesn't extend far beyond some simple triggers and variables. I've made a simple Rat-Counter on my own, but thats it.

Where I am at the moment.

Okay, so at the moment I'm focusing on making gauges that will update from my prompt, and will get the Max Variables from my score. My prompt looks like this-
H:927 M:966 E:1388 W:5000 B:100% [eb]

What I've figured out so far from reading the forums is my trigger to capture the prompt should look like this-

#TRIGGER {H:(%d) M:(%d) E:(%d) W:(%d) B:(%d) ~[(*)]~} {#VAR Health %1;#VAR Mana %2;#VAR Endurance %3;#VAR Willpower %4;#VAR Blood %5} {} {nocr|prompt}

From what I understand that should capture all the values I have specified (Health, Mana, Endurance, Willpower and Blood) and assign them into variables of the same names. The first problem is that it isn't doing that =D. Obviously I've messed up syntax somewhere and if anyone could show me the way I'd be really grateful.

Next up (also not working) is my trigger to capture the Max Variables from my score. Score looks like this-

Thrall Xavros, Servant of Bahir'an (male Human)
You have achieved level 23 (Notable) and are 32% of the way to the next level.
Health: 1220/1220 Mana: 966/1220
Endurance: 456/5250 Willpower: 4998/5000
You roam the land without citizenship.
You are an apprentice in the Bloodborn class.
You are an Abecedarian in the Bloodborn.
You are Atabeg in House Bahir'an.
You are a Vagabond in the Fellowship of Explorers.
You are 18 years old, having been born on the 7th of Slyphian, year 184 of the
Midnight Age.

My trigger for catching the variables is this-

#TRIGGER {^* Xavros,* ~(male Human)~$^You have achieved level (%d) ~((%w))~ and are (%d)~% of the way to the next level.$^Health: (%d)/(%d) Mana: (%d)/(%d)$^Endurance: (%d)/(%d) Willpower: (%d)/(%d)$} {#var Health %3;#var MHealth %4;#var Mana %5;#var MMana %6;#var Endurance %7;#var MEndurance %8;#var Willpower %9;#var MWillpower %10}

I know this is probably extremely mangled but don't laugh at me too hard, like I said, I'm new to scripting in general. Any help would be appreciated.[/i]
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Nov 28, 2006 10:05 am   
 
You need a percent sign after B:(%d) because there's one in the trigger pattern. It probably doesn't need commenting, but it might be best to, just in case. the other thing is that the ~ quote character always goes BEFORE the character you want to quote and not AROUND it - so ~[(*)]~ is wrong, ~[(*)~] is right. I'm not sure if makes much difference here because it's a close bracket that zMUD won't look for unless it's seen one open, but you'll see it's created an error in the second trigger. You might also consider adding ^ to the start of the pattern, just in case.

The problem with the second trigger is that you've accidentally commented the $, so it's looking for the literal string "Something Xavros, Something (male Human)$" which it's obviously not finding.
The other thing is that ^ should only ever be used at the start of a trigger pattern - $ matches the end of one line and the start of the next, so don't use ^ just after it.

If you want to use multiple lines for one trigger, though, I suggest you use a trigger state (see #cond) with the option {within|param=1) which means it'll only trigger if the pattern is within one line of the previous state. I don't use the command line for making multistate triggers so I'm not certain of the syntax, but I think it'll look something like this:

#trig {^* Xavros,* ~(male Human~)} {}
#cond {^You have achieved level %d ~(%w~) and are %d~% of the way to the next level.} {} {within|param=1} (because you're not interested in their value, don't put () around the wildcard.)
#cond {^Health: (%d)/(%d) Mana (%d)/(%d)} {#var Health %1;#var MHealth %2;#var Mana %3;#var MMana %4} {within|param=1}
#cond {^Endurance (%d)/(%d) Willpower (%d)/(%d)} {#var Endurance %1;and so on} {within|param=1}

Once the last state goes off, it'll cycle back to the start and be ready to go again :)
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tallus
Newbie


Joined: 28 Nov 2006
Posts: 2

PostPosted: Tue Nov 28, 2006 10:48 am   
 
=) Thanks so much for the quick reply. I knew I was doing some things wrong with syntax but ZMud is just so versatile it's hard to get through all the help files for the various topics. I'll take a look through and try and fix those things up.

EDIT- Well, thanks to Fang my prompt trigger is now working perfectly, but I can't seem to get the max variables to capture from the score.

#TRIGGER {^* Xavros,* ~(male Human~)} {}
#COND {^You have achieved level %d ~(%w~) and are %d~% of the way to the next level.$ } {} {within|param=1}
#COND {^Health: (%d)/(%d) Mana (%d)/(%d)} {#var Health %1;#var MHealth %2;#var Mana %3;#var MMana %4} {} {within|param=1}
#COND {^Endurance (%d)/(%d) Willpower (%d)/(%d)} {#var Endurance %1;#var MEndurance %2;#var Willpower %3;#var MWillpower %4} {} {within|param=1}

Thats what I'm using to try and capture the scores. Just so I know I understand it, the {within|param=1} means that the trigger will fire only if the #COND lines follow it right one after another?

If worst comes to worst I can always put in the Max amounts manually, but I'd prefer to try and get this working.
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