Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Lua
➜ Problems with lua
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Dphyre
(2 posts) Bio
|
Date
| Fri 13 Oct 2017 02:06 AM (UTC) |
Message
| I've got a small problem, and I fixed some of it, but would like expand it a little if you guys could help me.
I've got a MUD game I play and I have a custom monitor that fires off every 3-6 seconds and it looks like this:
HP: * ( * ) GP: * ( * ) XP: ( * ) Align: ( * )
when I see that, I have a trigger that does this.
if %3 > 200 then
DoAfter(math.random(1)+1, "XXX")
end -- if
So, if that third *, my GP, is above 200 I send a MM command. That works perfect but would like to expand it.
In that * next to align, there can be several things appear there. "extremely good", "very good", "quite good", "good", "barely good", "neutral", "barely evil", "evil", "quite evil", "very evil", and last but not least, "extremely evil"
I play an evil god, and can only cast the MM command if my alignment is Barely evil - extremely evil. What I wanted to do is follows, but I dont know the syntax.
if %3 > 200 and %6 == "barely evil|evil|quite evil|very evil|extremely evil" then
DoAfter(math.random(1)+1, "XXX")
end -- if
Basically, I need both of those conditions to be true, before it fires "XXX"
I also thought about triggering HP: * ( * ) GP: * ( * ) XP: ( * ) Align: ( * ) and using that to consistently update two variables too. But im unsure how to call variables inside the send box.
if GP > 200 and (AS == "barely evil" or AS == "evil" or AS == "quite evil" or AS == "very evil" or AS == "extremely evil" then
DoAfter(math.random(1)+1, "XXX")
end -- if
but both of those solutions gives me error, I would appricaite the help, if anyone could help me. One other thing is when I see this "HP: * ( * ) GP: * ( * ) XP: ( * ) Align: ( * )" in my mud - can it update the variables and fire off XXX if both conditions inside those variables are met? | Top |
|
Posted by
| Fiendish
USA (2,534 posts) Bio
Global Moderator |
Date
| Reply #1 on Fri 13 Oct 2017 07:23 AM (UTC) Amended on Fri 13 Oct 2017 07:27 AM (UTC) by Fiendish
|
Message
|
Quote: %6 == "barely evil|evil|quite evil|very evil|extremely evil"
I would do something like...
my_alignments = {
["barely evil"] = true,
["evil"] = true,
["quite evil"] = true,
["very evil"] = true,
["extremely evil"] = true
}
if (%3 > 200) and my_alignments["%6"] then
The reason it would work is because when you look for a key that exists in the my_alignments table you will get back true, but if the key doesn't exist you will get back nil which is a false-ish value.
Quote: But im unsure how to call variables inside the send box.
See the GetVariable and SetVariable functions. |
https://github.com/fiendish/aardwolfclientpackage | 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.
9,850 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top