|
Sagitarius Newbie
Joined: 02 May 2007 Posts: 4
|
Posted: Mon May 14, 2007 1:23 am
Autoroller help (Tried some ZMud Scripts) |
Trying to make an auto roller. Here's what I recieve from the mud, I've tried useing ZMud scripts.
Code: |
Your stats are:
Current Race Stat Abil
Stat Mod Total Mod
Agility : 0 + 0 = ( 0) [-5]
Stamina : 0 + 0 = ( 0) [-5]
Strength : 0 + 0 = ( 0) [-5]
Quickness : 0 + 0 = ( 0) [-5]
Perception : 0 + 0 = ( 0) [-5]
Intelligence: 0 + 0 = ( 0) [-5]
Your roll: 15, 18, 10, 13, 8, 15
Type <attribute> <number> to assign a number to an attribute.
Choices are: reroll, clear, and done. |
Here is what I am trying to use. Could someone point out what I'm doing wrong?
Pattern: Your roll: (%d), (%d), (%d), (%d), (%d), (%d)
Code:
#var str {%1}
#var int {%2}
#var wis {%3}
#var dex {%4}
#var con {%5}
#var agi {%6}
#IF (@str > 17 & @int > 17 & @wis >17 & @con > 17 & @dex > 17 & @agi > 17) {"agility 18"} {"reroll"} |
|
|
|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Mon May 14, 2007 1:32 am |
maybe putting a ~ before the : and , will help, also you don't need the {} around the variables for this script. Also you need to change the & to '&&' or 'and'
edit: is the pattern not matching or the script not compiling right? |
|
|
|
Sagitarius Newbie
Joined: 02 May 2007 Posts: 4
|
Posted: Mon May 14, 2007 1:38 am |
Tested to see if the patern recognition was working by changeing the code to simply #echo Hello. I don't think the pattern is checking, because the #echo isn't fireing. I also added the ~ to the : and ,'s. Also got rid of the {'s, and didn't forget the &&'s.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon May 14, 2007 1:39 am |
Couple of things...
I'd start by switching the '&' to '&&' I think this was change but it to me it's better coding form. (But I think that's because it was common mistake with C++)
Second, you unless you need the variables afterward I would use local variables instead of regular variables. They are much faster.
But the most like culprit would be spacing since for single digit numbers the spacing could be off, I would try this. It's a little hard to read but should work.
Pattern: Your roll:%s(%d),%s(%d),%s(%d),%s(%d),%s(%d),%s(%d)
I hope that helps. |
|
_________________ Asati di tempari! |
|
|
|
Sagitarius Newbie
Joined: 02 May 2007 Posts: 4
|
Posted: Mon May 14, 2007 1:50 am |
Currently have:
Code: |
#LOCAL $str $int $wis $dex $con $agi
$str %1
$int %2
$wis %3
$dex %4
$con %5
$agi %6
#IF ($str > 17 && $int > 17 && $wis >17 && $con > 17 && $dex > 17 && $agi > 17) {"agility 18"} {"reroll"} |
Checking the compiled code and script there are no error messages... :-/ |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon May 14, 2007 3:53 am |
You need the equal sign to assign values to the local variable. So this "$str=%1" instead of "$str %1".
|
|
_________________ Asati di tempari! |
|
|
|
|
|