Triggers and Variables

Posted by Halig on Fri 20 Feb 2015 11:31 AM — 5 posts, 18,562 views.

Portugal #0
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 ;).
Amended on Fri 20 Feb 2015 02:44 PM by Halig
Australia Forum Administrator #1
Do you mean 30 times?


for i=0,30 do
AppendToNotepad ("Lista", "%2 ")
AppendToNotepad ("Lista", os.date(), "\n")
end
Portugal #2
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
Australia Forum Administrator #3
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.
Portugal #4
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?