MushClient.

by Alef

Back to Mechanic's Corner.

Alef2005-06-08 22:08:20
Ok, how do I string together Variables in an If statement.

For example

CODE

If GetVariable ("Variable1") = "1" Then
blah blah


How would I place to Variables in the If statement so that it will only fire if the 2 Variables are equal to 1, or even contain different values.

Also how would I make a Statement fire if the Variable is not equal to a certain value?
Daganev2005-06-08 22:11:34
use the OR command, normally coded as ||

or if you need both conditions to be true use AND, normally coded as &&
Alef2005-06-08 22:19:23
Ah right, thanks.
Unknown2005-06-08 22:40:43
Also, keep in mind that a single = is used to set a variable while a double == is used to compare.

CODE
if ((statement1 and statement2) or statement3) then
Unknown2005-06-09 01:34:10
It actually depends on which scripting language you're using. We can usually assume that you're using VBScript, if you don't say otherwise, as that's the default selection in MUSHclient. However, doing these things in other languages, like Python or Lua, can be quite a bit different. At any rate, I would recommend finding a good tutorial on the language you use and going through the first few steps to get some of the basics and post any questions you have on here or the MUSHclient forums (where there are more coders, including the author of the program making use of the languages).