If you do "send to script" whatever is in the send box is compiled into a Lua "chunk" and then executed. Therefore it needs (to be useful) to be Lua code (not just declarations). That code might declare a function, but ultimately you need to execute it.
If you want the default to be zero (per session) then as suggested earlier, this idiom works quite well in Lua:
xp = (xp or 0) + 1
That makes sure that xp (which is nil when the engine is started up) is replaced by zero the first time around.
Hmm, so you don't need to make a function call? I figured scripts needed a function to be called to do everything. (I made a function, but it kept failing. I do Lua a lot, so I was doing it in that, but didn't see why it was failing. It might of been because I was giving a function name inside the "Script" field after having it "Send to script" as well)
On second thought, I need the default to always be 0, so having it saved with the World on exit wouldn't do me any good. I was hoping to make a quick one and not work with scripting, but if I can do the inline scripting like that then that'll accomplish the same task.
I'm not too sure what you mean by "inside the client". The script engine is inside the client, particularly Lua, which is imbedded into it.
There is no specific provision for adding 1 to a variable in the GUI interface (after all, someone would want to add 2, or multiply by 3 or something). Thus ad-hoc arithmetic is done by scripting.
It isn't hard, you make a trigger like:
Match: something happens
Send: xp = xp + 1
Send to: script
However that is adding to a script variable. If you want to add to a MUSHclient variable (which would be saved with the world file), you change it to:
Isn't that still all handled inside a script though?
I was hoping there was a way to do the arithmetic inside MUSHclient itself.
Similar to the example: 'xp = xp + 1' except when I've done this inside the client itself, it would look like 'xp = @xp + 1' and when I do that, it treats it like a string so that 'xp' actually equals "@xp + 1" (instead of adding it like I'm wanting it to do).
I've been looking over the website but for the life of me can't figure out how to use a variable.
All I've found is how to access one via "Expand Variables".
What I need to do is increment a variable (var + 1).
It keeps storing it as a string, and doing it via a script makes it fail like crazy (and seems like the long way around to me).
I think I'm just missing something that should be very simple.
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.