I'm trying to figure out how to create an autoroller for a mud called brokenseals. I've been messing with some code from previous posts, but I haven't figured out how to do it yet! Argh! Thanks for any help anyone can give.
PS: [I've been working with triggers, but would a script be better? I'm a noob though so please don't flame me =)
Nowadays you can make a single multi-line trigger. They are a bit fiddly to look at, but pretty straightforward. You basically match on what you are expecting to see, replacing line breaks with \n and the variable numbers with (\d+) - things in brackets are saved as wildcards.
\d+ means "one or more digits"
The ?P<blah> syntax gives the wildcards a name, which you can then test in the send box.
Something like this, although I haven't tested it:
Match:
Strength : (?P<str>\d+)\n
Intelligence : (?P<int>\d+)\n
Wisdom : (?P<wis>\d+)\n
Dexterity : (?P<dex>\d+)\n
Constitution : (?P<con>\d+)\n\z
Regular expression: checked
Multi-line: checked
Lines to match: 6
Send: (something like)
total = %<str> + %<int> + %<wis> + %<dex> + %<con>
if total < 40 then
send "no"
else
send "yes"
end if
if %<str>; 20 or _
%<int>; 20 or _
%<wis>; 20 or _
%<dex>; 20 or _
%<con>; 20 then
ColourNote "white", "blue", "stats too low"
Send "N"
else
ColourNote "white", "blue", "accepted stats"
Send "Y"
end if
if %<str>; 20 or _
%<int>; 20 or _
%<wis>; 20 or _
%<dex>; 20 or _
%<con>; 20 then
ColourNote "white", "blue", "stats too low"
Send "N"
else
ColourNote "white", "blue", "accepted stats"
Send "Y"
end if
I think you mean:
if %<str> < 20 or _
%<int> < 20 or _
%<wis> < 20 or _
%<dex> < 20 or _
%<con> < 20 then
ColourNote "white", "blue", "stats too low"
Send "N"
else
ColourNote "white", "blue", "accepted stats"
Send "Y"
end if
if %<str> < 20 or _
%<int> < 20 or _
%<wis> < 20 or _
%<dex> < 20 or _
%<con> < 20 then
ColourNote "white", "blue", "stats too low"
Send "N"
else
ColourNote "white", "blue", "accepted stats"
Send "Y"
end if
</send>
</trigger>
</triggers>
PS: I noticed someone stated that I should add a small pause before each reroll so as not to become a bandwith eating monster =)... How would I do this?
[EDIT]MUSHclient -> File -> Import -> Clipboard is how I'm trying to add it.[/EDIT]
Ok, I'm getting the same error (same line also), but here is the updated code. Also, how would I add a wait to the reroll so it does not attack the server?
I was thinking it would need to go
ColourNote "white", "blue", "stats too low"
Send "N"
HERE
but I'm not sure how to add a wait. Anyway, here is the full code.
(Thanks for all the help. Especially since it's 2:40am CST)
if %<str> < 20 or _
%<int> < 20 or _
%<wis> < 20 or _
%<dex> < 20 or _
%<con> < 20 then
ColourNote "white", "blue", "stats too low"
Send "N"
else
ColourNote "white", "blue", "accepted stats"
Send "Y"
end if
Ok thanks for all the help guys. It works like a charm. Here is the following code. (note: I had to enabel scripts on the scripts to run it)
"Note for other Newbies: the match=" is all one line. Use the symbols to make it look like they syntax you need, then make it all one line. Also, I think you would need to change the lines_to_match="#" if you want to change it to suit your needs."
if %<str> < 20 or _
%<int> < 20 or _
%<wis> < 20 or _
%<dex> < 20 or _
%<con> < 20 then
ColourNote "white", "blue", "stats too low"
world.doafter 1, "N"
else
ColourNote "white", "blue", "accepted stats"
world.doafter 1, "Y"
end if
alrighty, I play on a mud called Dark-Legacy, im working on one very similar, and ive just developed mine from yours.
Firstly an example of what im matching to:
You may now roll for your character's stats.
You may roll as often as you like.
Strength: 10 (Average)
Dexterity: 22 (Extremely nimble)
Constitution: 11 (Average)
Intelligence: 16 (Very smart)
Wisdom: 11 (Average)
Charisma: 21 (Exquisite)
Luck: 11 (Average)
Keep? (Y/N)
Strength: 10 (Average)
Dexterity: 18 (Very nimble)
Constitution: 12 (Average)
Intelligence: 11 (Average)
Wisdom: 16 (Wise)
Charisma: 19 (Attractive)
Luck: 15 (Lucky)
Keep? (Y/N)
Strength: 13 (Hardy)
Dexterity: 19 (Very nimble)
Constitution: 10 (Average)
Intelligence: 12 (Average)
Wisdom: 12 (Average)
Charisma: 19 (Attractive)
Luck: 17 (Very lucky)
Keep? (Y/N)
And, this is what I've got as a trigger as a development
from his, I have scripting enabled, it sends to script,
matches the correct number of lines, I dont know what kind
of script this is... Also, I wanted it to calculate the
total of what it gets for stats, and post it on the screen.
My Reasoning for having a total AND the stats is so that I can setup a baseline for what I want, and then set up a target stat setting.
<triggers>
<trigger
enabled="y"
lines_to_match="7"
match="^\s*Strength:\s*(?P<str>\d+)\s*(?P<avstr>\d+)\n\s*Dexterity:\s*(?P<dex>\d+)\s*(?P<avdex>\d+)\nConstitution:\s*(?P<con>\d+)\s*(?P<avcon>\d+)\nIntelligence\:\s*(?P<int>\d+)\s*(?P<avint>\d+)\n\s*Wisdom\:\s*(?P<wis>\d+)\s*(?P<avwis>\d+)\n\s*Charisma\:\s*(?P<cha>\d+)\s*(?P<avcha>\d+)\n\s*Luck\:\s*(?P<lck>\d+)\s*(?P<avlck>\d+)"
multi_line="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>
if %<str> < 13 or _
%<int> < 15 or _
%<wis> < 15 or _
%<dex> < 15 or _
%<con> < 15 or _
%<cha> < 5 or _
%<lck> < 10 then
ColourNote "white", "blue", "stats too low"
world.doafter 1, "N"
else
ColourNote "white", "red", "accepted stats"
world.doafter 1, "Y"
end if
</send>
</trigger>
</triggers>
Now, to get it to add the total (i also want the total
to be part of the deciding factor, then would it be this(?)) And curious to find out how to get it to post the total:
<send>
total = %<str> + %<int> + %<dex> + %<con> + %<cha> + %<lck>
if %<str> < 13 or _
%<int> < 15 or _
%<wis> < 15 or _
%<dex> < 15 or _
%<con> < 15 or _
%<cha> < 5 or _
%<lck> < 10 also
total < 107
ColourNote "white", "blue", "stats too low"
world.doafter 1, "N"
else
ColourNote "white", "red", "accepted stats"
world.doafter 1, "Y"
end if
</send>
if %<str> < 13 or _
%<int> < 15 or _
%<wis> < 15 or _
%<dex> < 15 or _
%<con> < 15 or _
%<cha> < 5 or _
%<lck> < 10 and
total < 107 then
ColourNote "white", "blue", "stats too low"
world.doafter 1, "N"
else
ColourNote "white", "red", "accepted stats"
world.doafter 1, "Y"
end if