Register forum user name Search FAQ

Gammon Forum

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.
 Entire forum ➜ MUSHclient ➜ General ➜ Counting Multiple Triggers, Displaying Counts

Counting Multiple Triggers, Displaying Counts

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Caspain   (6 posts)  Bio
Date Fri 27 Sep 2024 06:47 PM (UTC)

Amended on Fri 27 Sep 2024 06:48 PM (UTC) by Caspain

Message
Hello, first time caller long time listener.

I'm trying to track a new mechanic in a MUD that happens 1% of the time. It's technically 4 different things that each can happen 1% of the time, and I'm interested in seeing just how often they do happen.

Ideally, I'd track these variables between sessions as well.

After that, I'd like to make an alias or recommended command to call up all four of the variables with some light framing.


Quote:
You feel a sudden sense of foreboding

Your ancestral fury ignites


These are the two for when it procs for myself.


Quote:
fueled by an ancient, relentless power!

As if sensing danger


These two are for when it procs for a mob, with the first of the two coming at the end of the sentence.

I tried to cobble something together after reading some other counting related threads, but I wasn't sure how to get it to cease some errors related to a comma or something.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 29 Sep 2024 07:01 AM (UTC)
Message
Can you show us what you have? Perhaps we can fix the comma issue.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Caspain   (6 posts)  Bio
Date Reply #2 on Sun 29 Sep 2024 02:37 PM (UTC)

Amended on Sun 29 Sep 2024 07:09 PM (UTC) by Caspain

Message
I made 4 separate triggers, one for each line.

Inside each line of those that start their lines with the text, I have adapted this entry from another post

Quote:
parrycount = GetVariable("parrycount")

-- check variable exists
if parrycount == nil then
parrycount = '0'
end -- if

SetVariable ("parrycount", tonumber(parrycount) + 1)
Note (GetVariable("parrycount"))


Changed sento to script. And their triggers end with *.

IE I changed all instances of parrycount to 4 new variables based on the mechanics I'm tracking. foresight and relentlessness. fscount, fsmecount, lentcount, melentcount.

For the trigger that ends the line, I used.
Quote:
^* fueled by an ancient, relentless power!


When a trigger occurs I get an error that says the "error occured around ," (I don't have the exact error phrasing with me atm)

I tried adapting the parry stuff a few different ways after that but wasn't sure if I had a true error or if I tried to use the wrong thing. Ideally I'd just combine all for line tracking into a single script that either reports total counts as they happen, or with a second one just to call those 4 fields with labels. They're 1% chances to attack again or dodge, for myself and mobiles.

Edit: Grabbed the error
Quote:
[string "Trigger: "]:1: unexpected symbol near ','
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 29 Sep 2024 08:38 PM (UTC)
Message
I don't see a comma in what you posted so please show the whole thing.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Caspain   (6 posts)  Bio
Date Reply #4 on Sun 29 Sep 2024 08:44 PM (UTC)
Message
It's on the
Quote:
SetVariable ("parrycount",
part as far as I know. They all look exactly as posted except instead of 'parrycount' they say 'fscount' 'fsmecount' 'lentcount' 'melentcount' I left everything else as is, intending to just create and track the 4 variables.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #5 on Mon 30 Sep 2024 06:16 AM (UTC)
Message
Please do as I asked above, and post the whole thing.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


I can try to reproduce the problem, but I can't do that if I just get snippets of what you are trying to do.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Caspain   (6 posts)  Bio
Date Reply #6 on Mon 30 Sep 2024 12:25 PM (UTC)

Amended on Mon 30 Sep 2024 12:26 PM (UTC) by Caspain

Message
Quote:
fscount = GetVariable("fscount")

-- check variable exists
if fscount == nil then
fscount = '0'
end -- if

SetVariable ("fscount", tonumber(fscount) + 1)
Note (GetVariable("fscount"))


Quote:
fsmecount = GetVariable("fsmecount")

-- check variable exists
if fsmecount == nil then
fsmecount = '0'
end -- if

SetVariable ("fsmecount", tonumber(fsmecount) + 1)
Note (GetVariable("fsmecount"))


Quote:
lentcount = GetVariable("lentcount")

-- check variable exists
if lentcount == nil then
lentcount = '0'
end -- if

SetVariable ("lentcount", tonumber(lentcount) + 1)
Note (GetVariable("lentcount"))


Quote:
melentcount = GetVariable("melentcount")

-- check variable exists
if melentcount == nil then
parrycount = '0'
end -- if

SetVariable ("melentcount", tonumber(melentcount) + 1)
Note (GetVariable("melentcount"))


I already posted everything completely as far as I know. My first post has the phrases they trigger from. They're all sendto Script. No other options are toggled away from the default of a fresh install/new trigger. When one happens, it mentions the comma and I believe it's a compiling error if I recall the log correct.

The only one I wasn't sure on was triggering off the end of a sentence. I put ^* at the front of it in the trigger field, under the impression that means starts with anything followed by that sentence end.
Top

Posted by Caspain   (6 posts)  Bio
Date Reply #7 on Mon 30 Sep 2024 04:57 PM (UTC)
Message
I took a closer look and a look at some other threads and I think I realize how you were asking me to post it.

Quote:

<triggers>
<trigger
enabled="y"
match="You feel a sudden sense of foreboding *"
send_to="12"
sequence="100"
>
<send>setvariable "fsmecount", CInt(getvariable("fsmecount"))+1
</send>
</trigger>
</triggers>


I thought about just taking the comma out but I didn't understand what that might do.
Top

Posted by Nick Gammon   Australia  (23,120 posts)  Bio   Forum Administrator
Date Reply #8 on Mon 30 Sep 2024 07:46 PM (UTC)
Message
Lua is case-sensitive, so it is SetVariable, not setvariable.

Function arguments go inside parentheses so it is:


SetVariable ("fsmecount",tonumber(GetVariable("fsmecount"))+1)


I note that what you posted in reply #7 is quite different to the snippets in reply #6.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Caspain   (6 posts)  Bio
Date Reply #9 on Tue 01 Oct 2024 04:59 PM (UTC)
Message
I was replying from a different station than the one that had the actual information on it. So, I gave the base I was working from, as it came from another similar thread. I tried to take the 'most complete' version from said thread. After I directly copy pasted and then only word replaced 'parry' I ran into issues, which you're showing me is related to capitalization. I had already tried changing each of my triggers in various ways, so the last reply is just one of the various ways I tried to resolve the issue myself while not knowing what I was doing at all. Had I selected any of the other remaining, they'd each have looked different than the rest because I was trying various solutions and already had the base available.

So, my post approached it where I was, without something I was really working from other than the base post I shared. I gave the other format because I didn't know if it contained other relevant information outside the 'Trigger' field, the 'Send' field, and the Send to: drop down I had used.

Thank you for helping me resolve this issue. I do not code, only play MUDs.
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.


1,153 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.