|
dawnsend Newbie
Joined: 15 Apr 2004 Posts: 2 Location: USA
|
Posted: Thu Apr 15, 2004 11:01 pm
scripting question |
Hi,
I'm trying to create this script for an autoroller, but I'm having some problems. There aren't any visible numbers on the screen, so your stats are given values such as "good", "below average", etc...
Well, as I know what exact stats I want for my character, I'm trying to create a list of 8 variables (one for each stat). If that stat reaches the desired value, then I make the variable a 1. However, this leaves me with a lengthy #IF statement at the end of the script - and I don't quite know the proper syntax for AND in zMud.
My program, very roughly (and dealing with only 2 stats to save space), looks something like this:
#trigger {Strength: Good} {#var strcheck 1}
#trigger {Dexterity: Average} {#var dexcheck 1}
#if ((@strcheck=1)&(@dexcheck=1)) {finished} {reroll}
So, I guess in retrospect, I have 2 real questions - first off, what is the exact syntax for making compound #IF statements that rely on more than one variable?
Secondly, would it be possible to turn those #trigger statements into #if statements? I'm not sure how broad the #if statements are in this scripting language, so if they can detect text strings, then I'd rather use them than having to make extra patterns for #trigger statements.
I don't know if I'm making any sense with all this, but any help would really be appreciated.
Thanks in advance. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Apr 16, 2004 12:12 am |
Hmmmm I believe & should work but you need to call your if statement from a trigger and possibly it might need a space between expresions
#TR {Is this acceptable?} {#IF (@strcheck & @dexcheck) {yes} {no;dexcheck=0;strcheck=0}} {prompt|nocr} |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Apr 16, 2004 2:56 am |
The correct structure for a compound condition, using AND, is (Condition1 AND Condition2). Your IF has the correct structure. I usually use the word AND rather than the symbol &, and leave spaces before and after operators, but that's a matter of individual preference. Using parentheses to group individual conditions (as you did) is also a good idea.
You can make a pattern which matches multiple possibiliteis using a stringlist.
#TR {Dexterity: {Average|Good}} {#VAR dexcheck 1} |
|
|
|
dawnsend Newbie
Joined: 15 Apr 2004 Posts: 2 Location: USA
|
Posted: Fri Apr 16, 2004 2:11 pm |
nexela and lightbulb,
Just wanted to say thanks - with your help I was able to get the autoroller script up and running. Until yesterday I never knew zMud had such a powerful scripting feature - I've been using GMud for the past couple of years. Now I just gotta sit back and write an essay or somethin while I wait for zMud to hand me up the perfect roll.
Thanks again. ;) |
|
|
|
|
|
|
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
|
|