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 ➜ Converting to/from lua and mushclient variables

Converting to/from lua and mushclient variables

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


Posted by Silencher   (55 posts)  Bio
Date Mon 15 Jul 2013 10:21 PM (UTC)
Message
It's mentioned in the wcript that you can load/save scripting variables ito mushclient variables at log in/log out. How is something like this done?

I was thinking about just aliasing 'quit' to do something like:

Quit

Setvariable (monsterskilled, monsterslain)
Where monsterslain is a script variable, but is that legal?

And visaversa:

Monsterslain = getvariable("monsterskilled") on login?
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 16 Jul 2013 12:07 PM (UTC)
Message
Many plugins do that automatically. See:

http://www.gammon.com.au/forum/?id=4960

- Nick Gammon

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

Posted by Silencher   (55 posts)  Bio
Date Reply #2 on Wed 17 Jul 2013 12:09 AM (UTC)
Message
Can you tell me which reply this is in?

As an aside, what does 'serialize' do?

It would be great if I could modify the plugin to load/save a table of variables I'd like to use.

Also: is there a way to check/compre current time to an old time, or current day/date with an old, variable saved date?

like oldDate would be 07/08/213

Trigger/timer/etc checks current date and compares to old date

If more than 1 week then
Statements
Else
Statements?
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 18 Jul 2013 08:27 AM (UTC)
Message
You should really read the lot, but replies 6 and 7 summarize it.

Quote:

As an aside, what does 'serialize' do?


Turns the internal "binary" representation of numbers, strings, etc. into a printable string which can be saved in your state file. It also handles tables (including nested tables).

Quote:

Also: is there a way to check/compre current time to an old time, or current day/date with an old, variable saved date?


The function os.time() returns a number which is the number of seconds since January 1, 1970.

If you saved that in a variable, and then got the current time, and subtracted one from the other, you could work out how many seconds had elapsed.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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,609 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.