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

Gammon Forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  if/then wont read variable
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

if/then wont read variable

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


Posted by Vessarr   (16 posts)  [Biography] bio
Date Sun 27 Jul 2014 09:06 PM (UTC)
Message
Let me start off saying this is the first thing iv tryed scripting in a long time.. What im trying to do is get a trigger to send a tell to myself that then triggers a midi file to play but only when the music is off so it dosent restart the file every time I walk though the room.
Im trying to do it this way so that i can use midi files instead of .wav files.

Iv got this script set on a trigger that goes off whenever I enter a main room.


if mainmusic == off then
Send "tell vessarr playingmainmusic"

end



It goes off every time even though the variable mainmusic is set to on the tell that gets sent to start the music also sets mainmusic to on. Its like its running the Send line sepretly from the if/then.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 27 Jul 2014 09:31 PM (UTC)
Message
How is "mainmusic" changed?

This looks wrong on a number of fronts. Perhaps:


 if mainmusic == "off" then


or:


 if GetVariable ("mainmusic") == "off" then


See this video about the difference between MUSHclient variables and script variables:

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

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Vessarr   (16 posts)  [Biography] bio
Date Reply #2 on Sun 27 Jul 2014 10:18 PM (UTC)
Message
i wish i could watch videos... my internet connection maxs out at 12kbs on a 56k modem.. hence why im playing muds lol

it switchs mainmusic from off to on which makes the if then untrue so that if i enter the room it wont send the tell again.

of corse thats all not an issue anymore as your getvariable suggestion got everything working smoothly and as it should be! so thank you very much
[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.


2,109 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]