(New message)
Subject review (reverse sequence)
Posted by
Nick Gammon
Australia (18,772 posts) bio
Forum Administrator
Date
Sun 16 Aug 2009 01:35 AM (UTC) [ quote
]
Message
Yes that should work.
- Nick Gammon
www.gammon.com.au, www.mushclient.com top
Posted by
LadyIsis
(6 posts) bio
Date
Sun 16 Aug 2009 12:10 AM (UTC) [ quote
] Amended on Sun 16 Aug 2009 12:31 AM (UTC) by LadyIsis
Message
That appears to have worked perfectly! For my own reference, can I can also switch the code up to denied if lower than stats, as in:
if max_st < 90 and
max_co < 90 then
Send ("N")
else
Send ("Y")
end -- if top
Posted by
Nick Gammon
Australia (18,772 posts) bio
Forum Administrator
Date
Sat 15 Aug 2009 11:46 PM (UTC) [ quote
]
Message
Ah I see you did a multi-line trigger. Very good, that saves a bit of effort.
A couple of problems ... The word "in" is a Lua keyword, so I changed that to "int". Also wildcards above 9 need to be put into <brackets> otherwise it would think, for example, %10 is wildcard 1 with a zero after it.
Since you have a multi-line trigger, we may as well do the test in this trigger and not use a second one. Below shows what I had in mind:
<triggers>
<trigger
enabled="y"
group="Multi Line"
ignore_case="y"
lines_to_match="5"
keep_evaluating="y"
match="Strength \(St\)\:\s*(\d+)\(\s*(\d+)\) Constitution \(Co\)\:\s*(\d+)\(\s*(\d+)\)\nQuickness\(Qu\)\:\s*(\d+)\(\s*(\d+)\) Agility \(Ag\)\:\s*(\d+)\(\s*(\d+)\)\nPresence \(Pr\)\:\s*(\d+)\(\s*(\d+)\) Self\-Discipline\(Sd\)\:\s*(\d+)\(\s*(\d+)\)\nEmpathy \(Em\)\:\s*(\d+)\(\s*(\d+)\) Memory \(Me\)\:\s*(\d+)\(\s*(\d+)\)\nIntuition\(In\)\:\s*(\d+)\(\s*(\d+)\) Reasoning \(Re\)\:\s*(\d+)\(\s*(\d+)\)\Z"
multi_line="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>
st = tonumber (%1)
max_st = tonumber (%2)
co = tonumber (%3)
max_co = tonumber (%4)
qu = tonumber (%5)
max_qu = tonumber (%6)
ag = tonumber (%7)
max_ag = tonumber (%8)
pr = tonumber (%9)
max_pr = tonumber (%<10>)
sd = tonumber (%<11>)
max_sd = tonumber (%<12>)
em = tonumber (%<13>)
max_em = tonumber (%<14>)
me = tonumber (%<15>)
max_me = tonumber (%<16>)
int = tonumber (%<17>)
max_int = tonumber (%<18>)
re = tonumber (%<19>)
max_re = tonumber (%<20>)
if st > 70 and
co > 80 and
qu > 50 and
ag > 14 and
pr > 17 and
sd > 10 and
me > 11 and
int > 5 and
re > 15 then
Send ("Y")
else
Send ("N")
end -- if
</send>
</trigger>
</triggers>
- Nick Gammon
www.gammon.com.au, www.mushclient.com top
Posted by
LadyIsis
(6 posts) bio
Date
Sat 15 Aug 2009 11:25 PM (UTC) [ quote
] Amended on Sat 15 Aug 2009 11:26 PM (UTC) by LadyIsis
Message
My initial trigger (so far) is:
<triggers>
<trigger
enabled="y"
group="Multi Line"
ignore_case="y"
lines_to_match="5"
keep_evaluating="y"
match="Strength \(St\)\:\s*(\d+)\(\s*(\d+)\) Constitution \(Co\)\:\s*(\d+)\(\s*(\d+)\)\nQuickness\(Qu\)\:\s*(\d+)\(\s*(\d+)\) Agility \(Ag\)\:\s*(\d+)\(\s*(\d+)\)\nPresence \(Pr\)\:\s*(\d+)\(\s*(\d+)\) Self\-Discipline\(Sd\)\:\s*(\d+)\(\s*(\d+)\)\nEmpathy \(Em\)\:\s*(\d+)\(\s*(\d+)\) Memory \(Me\)\:\s*(\d+)\(\s*(\d+)\)\nIntuition\(In\)\:\s*(\d+)\(\s*(\d+)\) Reasoning \(Re\)\:\s*(\d+)\(\s*(\d+)\)\Z"
multi_line="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>st = tonumber (%1)
max_st = tonumber (%2)
co = tonumber (%3)
max_co = tonumber (%4)
qu = tonumber (%5)
max_qu = tonumber (%6)
ag = tonumber (%7)
max_ag = tonumber (%8)
pr = tonumber (%9)
max_pr = tonumber (%10)
sd = tonumber (%11)
max_sd = tonumber (%12)
em = tonumber (%13)
max_em = tonumber (%14)
me = tonumber (%15)
max_me = tonumber (%16)
in = tonumber (%17)
max_in = tonumber (%18)
re = tonumber (%19)
max_re = tonumber (%20)</send>
</trigger>
</triggers>
Right now, I've got nothing under the "Accept these stats" trigger:
<triggers>
<trigger
enabled="y"
match="Accept these stats? (Y/N)"
sequence="100"
>
</trigger>
</triggers>
I deleted the script, so what's above is all I have. top
Posted by
Nick Gammon
Australia (18,772 posts) bio
Forum Administrator
Date
Sat 15 Aug 2009 11:08 PM (UTC) [ quote
]
Message
Please copy and paste here what you have actually done. See http://mushclient.com/copying .
What I showed above (with the "if") is what you put in that trigger.
- Nick Gammon
www.gammon.com.au, www.mushclient.com top
Posted by
LadyIsis
(6 posts) bio
Date
Sat 15 Aug 2009 10:57 PM (UTC) [ quote
]
Message
Ok, so the script has the "if st > 80", right? I made a lua script with my version of all that... What goes under the trigger for "Accept these stats? Y/N"? top
Posted by
Nick Gammon
Australia (18,772 posts) bio
Forum Administrator
Date
Sat 15 Aug 2009 10:35 PM (UTC) [ quote
]
Message
Lua.
- Nick Gammon
www.gammon.com.au, www.mushclient.com top
Posted by
LadyIsis
(6 posts) bio
Date
Sat 15 Aug 2009 10:29 PM (UTC) [ quote
]
Message
Which scripting language is your example in? top
Posted by
Nick Gammon
Australia (18,772 posts) bio
Forum Administrator
Date
Sat 15 Aug 2009 09:31 PM (UTC) [ quote
]
Message
Say you have a trigger that matches on:
Strength (St): *(*) Constitution (Co): *(*)
That would be a start, as I replaced the numbers that change by an asterisk. And if it fires you have 4 wildcards. So I would do something like:
st = tonumber (%1)
max_st = tonumber (%2)
co = tonumber (%3)
max_co = tonumber (%4)
You need to change the "send" box to "send to script".
Now that has remembered those 4 stats.
Then do something similar for the other stats.
Finally make a trigger for "Accept these stats? (Y/N)".
Now you just compare and see what you want.
eg.
if st > 80 and
co > 90 and
--- etc. etc.
qu > 40 then
Send ("Y")
else
Send ("N")
end -- if
If you have problems please copy and paste here what you have actually done. See http://mushclient.com/copying .
- Nick Gammon
www.gammon.com.au, www.mushclient.com top
Posted by
LadyIsis
(6 posts) bio
Date
Sat 15 Aug 2009 09:07 PM (UTC) [ quote
]
Message
I think I've got a working trigger; I set it up to output look when it goes off, and it's doing so. I used a bit from an older thread to set the numbers as wildcards using (\d+). At least I think that's what it does.
What should I do next? top
Posted by
Blainer
(191 posts) bio
Date
Sat 15 Aug 2009 03:30 AM (UTC) [ quote
]
Message
That would require triggers to capture the numbers when the MUD sends them. Then a script in the trigger to process the
numbers. Say if Strength is 100 then accept this roll.
I would start with reading http://mushclient.com/scripts/doc.php?general=triggers .
This explains triggers. Get a trigger to capture numbers (probably have to be multi line trigger).
If you have trouble with getting the trigger to work use the instructions at the link below to paste what you have so far.
http://www.gammon.com.au/forum/?id=4777
Let me know how you go. top
Posted by
LadyIsis
(6 posts) bio
Date
Fri 14 Aug 2009 07:14 PM (UTC) [ quote
] Amended on Fri 14 Aug 2009 07:15 PM (UTC) by LadyIsis
Message
I realize stat rollers are requested/asked for quite often, and I've searched through the various other posts and read them. However, I'm not a coder and it really just doesn't make sense to me... Would anyone mind explaining how to go about making an automated stat roller? Please be very, very basic, since I don't even really understand how to set up scripts.
The setup of the stats I'm looking for is:
Strength (St): 77( 93) Constitution (Co): 85( 98)
Quickness(Qu): 51( 73) Agility (Ag): 68( 94)
Presence (Pr): 32( 80) Self-Discipline(Sd): 65( 93)
Empathy (Em): 90( 95) Memory (Me): 43( 99)
Intuition(In): 71( 86) Reasoning (Re): 31( 85)
Accept these stats? (Y/N)
Any help would be appreciated! top
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
2,217 views.
Reply to this subject
Start a new subject
  Refresh page
Go to topic:
(Choose topic)
Area Editor: Bug reports
Area Editor: General
Area Editor: News and updates
Area Editor: Suggestions
Area Editor: Tips and tricks
Dawn of Time: Administration
Dawn of Time: Configuration
Dawn of Time: Installing/compiling the server
Dawn of Time: New Dawn Muds Announcements
Dawn of Time: Playing
Dawn of Time: What is Dawn of Time (Dawn)?
Electronics: Microprocessors
Electronics: Operational Amplifiers
Forum: About
Forum: Announcements
Forum: Mailing other users
Forum: Problems
Forum: Registering
Forum: Searching
Forum: Subscribing
Forum: Suggestions
Forum: Test
Forum: Time zones / time display
Forum software: Administration
Forum software: Installation
MUDs: Announcements
MUDs: General
MUDs: MUD Design Concepts
MUSHclient: Announcements
MUSHclient: Beta testing
MUSHclient: Bug reports
MUSHclient: Development
MUSHclient: General
MUSHclient: Getting Started
MUSHclient: International
MUSHclient: Jscript
MUSHclient: Lua
MUSHclient: Miniwindows
MUSHclient: MXP and Pueblo
MUSHclient: Perlscript
MUSHclient: Plugins
MUSHclient: Python
MUSHclient: Suggestions
MUSHclient: Tips and tricks
MUSHclient: VBscript
MUSHclient: Wine
PennMUSH: Compiling the server
PennMUSH: Running the server
Programming: General
Programming: STL
Quilting: General
ROM: Compiling the server
ROM: Running the server
SMAUG: Commands
SMAUG: Compiling the server
SMAUG: Lua
SMAUG: Running the server
SMAUG: SMAUG coding
Search the forum
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )