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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Triggers and Variables

Triggers and Variables

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


Posted by Halig   Portugal  (123 posts)  Bio
Date Fri 20 Feb 2015 11:31 AM (UTC)

Amended on Fri 20 Feb 2015 02:44 PM (UTC) by Halig

Message
Hi to all again. I'm doing so much stuff at the same time, and the doubts start to show.

I have this on the MUD window:

1) (Char name) is in (Place) [1227]
2) (Char name) is in (Place) [1213]
3) (Char name) is in (Place) [1227]
4) (Char name) is in (Place) [1227]
5) (Char name) is in (Place) [1205]

I have a request, if anyone can help me:
If i want to save the chars name to a file, or variable how do i do that? For example, at this time there are 5 players online, but if someone logoff or login, the list changes. I already have a timmer to show that list every 5 minutes. How do i keep the list updated and saved? Then i want an alias to show that list, and another alias to clear that list.
Let's say i want to log everyone who shows during the day, and then at night go check everyone that logged and then clear the list for the next day.

One more thing, if the player already exists on the file (table or variable), it does nothing, everything remains the same. But if a new one logs in, it adds that new one. If one of the players connected, quit, then the file stays the same.

Thank you.



I've got this, and it works, except the cycle for, it shows me 20 times each of the players (LOL), how do i fix that, so when it finishes there will be a ------------------ separating the last one from the new one:

<triggers>
<trigger
enabled="y"
group="Notepad"
match="(.*) (.*) is in (.*)"
regexp="y"
send_to="12"
sequence="100"
>
<send>NotepadColour ("Lista", "springgreen", "black")
for i=0,30 do
AppendToNotepad ("Lista", "%2 ")
AppendToNotepad ("Lista", os.date(), "\\n")
end
AppendToNotepad ("Lista", "------------------------------")</send>
</trigger>
</triggers>

The os.date is cause i want the system date to be showned when that print is there... This was a try, but if i could do this without sending to notepad, cause there will be to much windows in there ;).
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 21 Feb 2015 01:32 AM (UTC)
Message
Do you mean 30 times?


for i=0,30 do
AppendToNotepad ("Lista", "%2 ")
AppendToNotepad ("Lista", os.date(), "\n")
end

- Nick Gammon

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

Posted by Halig   Portugal  (123 posts)  Bio
Date Reply #2 on Sat 21 Feb 2015 01:38 AM (UTC)
Message
Hi Nick. No, it was just an example. It must show the number of players online, like this:

1) (Char name) is in (Place) [1227]
2) (Char name) is in (Place) [1213]
3) (Char name) is in (Place) [1227]
4) (Char name) is in (Place) [1227]
5) (Char name) is in (Place) [1205]

In this case, there were only 5, but if there were 6? My problem is that. Need to separate things by adding --------------------- for example, what will bring:

(char name) time
(char name) time
(char name) time
(char name) time
(char name) time
----------------------------
(char name) time2
(char name) time2
(char name) time2
(char name) time2
(char name) time2
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 22 Feb 2015 03:50 AM (UTC)
Message
I really don't understand your question.

Quote:

In this case, there were only 5, but if there were 6?


What of it? Store the names in a Lua table. Then there can be 1000 of them.

- Nick Gammon

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

Posted by Halig   Portugal  (123 posts)  Bio
Date Reply #4 on Sun 22 Feb 2015 01:15 PM (UTC)
Message
Hi Nick. Fo example, if i create a table, if the players online are the same for 3 hours, then player x logs, it adds player x. If player Y leaves, what happens to the table?
And can i store in the table the os.date that it saves the player name on the table?
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.


14,305 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.