Hi all,
Any help with the script will be appreciated. I have recently started with mudding again, and want to roll a decent character. I'm not very good at setting "code script".
Diku mud, and the screen result with stats will look something like this, as an example:
Str: 16/0 Int:15 Wis:14 Dex:12 Con:17 Cha: 5
Keep this character (y/n)?
So how do I set a trigger that make each of Str, Int, Wis, Dex etc variable? Perhaps using *?? Not sure.
Then to set an "if" condition, with a minimum number for each. In other words something like:
If Str>17 and Int>16 and Wis>16 and Dex>15 and Con>19 and Cha<8
Then
Send("y")
How do I actually word this? The script?
Any help will be greatly appreciated. Thank you.
Diku Mud Stat roller
Re: Diku Mud Stat roller
So you would make a trigger, type of perl regex, with a pattern of
^Str: (\d+)/(\d+) Int:(\d+) Wis:(\d+) Dex:(\d+) Con:(\d+) Cha: (\d+)
Then put the code in the box like so:
^Str: (\d+)/(\d+) Int:(\d+) Wis:(\d+) Dex:(\d+) Con:(\d+) Cha: (\d+)
Then put the code in the box like so:
Then make another trigger, exact match, and copy paste the "Keep this character (y/n)?" from the mud itself into it. Make the script be:
And that should do it for you. The above would accept any stats where Str was 17 or higher, Int was 16 or higher, etc. Otherwise it'll send n to roll up some more stats.
Re: Diku Mud Stat roller
Wow! Thanks so much, exactly what i was after. Will give it a go. Thank you.
Re: Diku Mud Stat roller
Sorry, working on an iPad in response. On the PC, it doesn't work for line 10:
acceptableStats = true
It reads: Lua Sytax error:[string "Trigger: Regex"]:10: 'then' expected near '='
Sorry, i am not sure what is actually wrong or how to fix it. Can someone perhaps advise please? Thank you.
acceptableStats = true
It reads: Lua Sytax error:[string "Trigger: Regex"]:10: 'then' expected near '='
Sorry, i am not sure what is actually wrong or how to fix it. Can someone perhaps advise please? Thank you.
- SlySven
- Posts: 1023
- Joined: Mon Mar 04, 2013 3:40 pm
- Location: Deepest Wiltshire, UK
- Discord: SlySven#2703
Re: Diku Mud Stat roller
I'm not entirely sure that a couple of those conditions are put right:
... and myDex => 15 and myCon => 19 and ...
I suspect you might need to change "=>" to ">=" See section 2.1 of the Lua 5.1 manual !
... and myDex => 15 and myCon => 19 and ...
I suspect you might need to change "=>" to ">=" See section 2.1 of the Lua 5.1 manual !
Re: Diku Mud Stat roller
All, thanks for all the help. However as a total newbie here I am struggling and can't get this to work. I suspect I am missing some critical very basic concepts. I can simplify and get a "test" to work? Let's say something basic, such as:
Ab 5 and Bc 7 -- so if we take a scenario that the numbers become variable, how do I set a very simple trigger in a Mud to say something if the number of Ab is greater than Bc? I will test with 'You say hello.'
My thoughts were on trigger line to enter: Ab (\d+) and Cd (\d+) -- and to select perl regex setting
Then in the block below:
Ab = tonumber(matches[2])
Cd = tonumber(matches[3])
If tonumber(matches[2]) > tonumber(matches[3])
then
send(say hello)
end
Except I can't even get this basic trigger on a variable to work. Any help will be greatly appreciated. I have the character say Ab 7 Cd 5 in expectation that I will see the character also then say "hello". Doesn't work
Ab 5 and Bc 7 -- so if we take a scenario that the numbers become variable, how do I set a very simple trigger in a Mud to say something if the number of Ab is greater than Bc? I will test with 'You say hello.'
My thoughts were on trigger line to enter: Ab (\d+) and Cd (\d+) -- and to select perl regex setting
Then in the block below:
Ab = tonumber(matches[2])
Cd = tonumber(matches[3])
If tonumber(matches[2]) > tonumber(matches[3])
then
send(say hello)
end
Except I can't even get this basic trigger on a variable to work. Any help will be greatly appreciated. I have the character say Ab 7 Cd 5 in expectation that I will see the character also then say "hello". Doesn't work
Re: Diku Mud Stat roller
Just one thing - actual text you'd like to use needs to go into quotes, so send("say hello"). Checkout this introduction http://www.youtube.com/view_play_list?p ... xt_from=PL. Did it work then? Just note that you need to go "Ab 7 and Cd 5" according to your pattern, not "Ab 7 Cd 5".
Re: Diku Mud Stat roller
Yes, thanks. Sorry, typo in my example. I did do send("say hello")
Did try Ab 7 and Cd 5.
Doesn't work. I will have a look at the link, thanks.
Did try Ab 7 and Cd 5.
Doesn't work. I will have a look at the link, thanks.
Re: Diku Mud Stat roller
For anyone still trying to work this out...this seems to be working for me:
MUD outputs:
Rolling...
Strength: 13 Intelligence: 14 Wisdom: 18 Dexterity: 13 Constitution: 13
Do these reflect your training (Y/N)?
trigger1:
^Strength: (\d+) Intelligence:(\d+) Wisdom:(\d+) Dexterity:(\d+) Constitution:(\d+)
Type: perl regex
trigger2:
Do these reflect your training (Y/N)?
Type: exact match
Those worked for me. The answer the user gave above had some syntax issues.
MUD outputs:
Rolling...
Strength: 13 Intelligence: 14 Wisdom: 18 Dexterity: 13 Constitution: 13
Do these reflect your training (Y/N)?
trigger1:
^Strength: (\d+) Intelligence:(\d+) Wisdom:(\d+) Dexterity:(\d+) Constitution:(\d+)
Type: perl regex
Code: Select all
myStr = tonumber(matches[2])
myInt = tonumber(matches[3])
myWis = tonumber(matches[4])
myDex = tonumber(matches[5])
myCon = tonumber(matches[6])
if myStr >= 20 and myInt >= 17 and myWis >= 19 and myDex >= 18 and myCon >= 21 then
acceptableStats = true
end
Do these reflect your training (Y/N)?
Type: exact match
Code: Select all
if acceptableStats then
send("y")
else
send("n")
end