[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Delayed responce

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Delayed responce

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Val   (27 posts)  [Biography] bio
Date Sat 12 Mar 2011 09:25 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Twisol   USA  (2,229 posts)  [Biography] bio
Date Reply #1 on Sat 12 Mar 2011 09:46 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Val   (27 posts)  [Biography] bio
Date Reply #2 on Sun 13 Mar 2011 12:12 AM (UTC)  quote  ]
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
[Go to top] 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.


1,119 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]