mIRC Home    About    Download    Register    News    Help

Print Thread
#163919 05/11/06 09:53 PM
Joined: Nov 2006
Posts: 1
W
Mostly harmless
OP Offline
Mostly harmless
W
Joined: Nov 2006
Posts: 1
I am brand new to this whole scripting thing, and i've gotten some stuff down..not realy, but i need to know basically what variables do, and how i can use them. so please help me out here.

#163920 05/11/06 09:56 PM
Joined: Oct 2006
Posts: 166
B
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
/var command is explained 100% percentage in the helpfile. you might wanna read it before asking.


Kind Regards, blink
#163921 05/11/06 10:05 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The help file (most of the time) is helpful, and I don't think there's a single helper on this or any other mIRC help board that can honestly say they never need to reference it any longer.

If you have more questions after reading the help file, we'll be glad to assist you.

#163922 05/11/06 10:53 PM
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
Variables are a way of storing information that might or might not change during the running/setting up of the script.

for example
Code:
alias vartest {
  set %variable1 one
  echo 01 -a %variable1
  set %variable2 two
  echo 01 -a %variable2
  set %variable3 $input(type something,e)
  echo 01 -a %variable3 <-- you typed that part, the script didn't know what you would type so it couldn't be 'hard' coded.
  unset %variable*
}

/vartest

there are local and global variables, depending on whether the script needs to remember them once it's done processing. local variables can be discarded and are "set" using /var %varname = value.

Global variables are used to store information that may be needed again(a filepath for example that once set doesn't need to be changed or a value called from more than one script) and are set using /set %varname value. It should be noted that global variables can be changed by other scripts(hence the name global) and local variables can only be accessed by the script that created them.

Try to use local variables wherever possible and look at either non-conflicting names for your globals (for example I could use %btk-var-name with little fear of someone elses script using that variable name, rather than %b etc.) or other ways of storing permanent information ( .ini or .txt files perhaps)

Hopefully that gives you the groundwork. As everyone else has said, the helpfile is your friend ;o)

btk


billythekid

Link Copied to Clipboard