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 ➜ General ➜ Delayed responce

Delayed responce

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


Posted by Val   (27 posts)  Bio
Date Sat 12 Mar 2011 09:25 PM (UTC)
Message
Hi

No doubt this has been on before, but I can't seem to find it and I'm sure I must of ticked a box by accident but cant find it.

I made a variable for my spells, which will send the nane of the spell to the status line when I change it, this was working well, however now it sends the previous variable and not the variable I change it too.

So, if I change my spell to magic missile, the old veriable (say light) gets sent to the status line although if I look in the variable box magic missile is there

Let me know what I did wrong please, the code I use is below

SetVariable ("spellname1", "magic missile")
ColourNote ("white", "blue", "Spell is now: @spellname1")
ColourNote ("white", "blue", "Target is still: @target")
SetStatus ("Target: @target / Spell: @spellname1")

(which will come out as light or whatever the last variable was

Thanks
Val
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #1 on Sat 12 Mar 2011 09:46 PM (UTC)
Message
The @variable form isn't actually part of Lua. MUSHclient evaluates @variables before running the script, so your code first becomes this:
SetVariable ("spellname1", "magic missile")
ColourNote ("white", "blue", "Spell is now: light")
ColourNote ("white", "blue", "Target is still: Somebody")
SetStatus ("Target: Somebody / Spell: light")

And -then- it's run. What you should do to avoid this is:
SetVariable ("spellname1", "magic missile")

local spellname1 = GetVariable("spellname1")
ColourNote ("white", "blue", "Spell is now: " .. spellname1)
ColourNote ("white", "blue", "Target is still: @target")
SetStatus ("Target: @target / Spell: " .. spellname1)

Here, I'm using a Lua function to get the spellname1 variable, so there aren't any nasty surprises.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Val   (27 posts)  Bio
Date Reply #2 on Sun 13 Mar 2011 12:12 AM (UTC)
Message
Thanks, I managed to work out by adding a comma I could get a split line for my target, it was going to be my next question

SetStatus ("Target: " .. target, " / Spell: @spellname1")

your help is much appreciated

Val
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.


13,636 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.