Shoutbox

External Variable - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: External Variable (/showthread.php?tid=64299)

External Variable by Uberstalker on 07-31-2006 at 11:16 PM

I am working on script that I need to be able to declare multiple variables and change their values from the chat box...Is this even possible? If so can someone help me?


RE: External Variable by matty on 07-31-2006 at 11:59 PM

Dont declare them in a function declare them at the top of the file.

code:
var myVariable;

function OnEvent_Initialize(bMessengerStart){   

}

RE: External Variable by Uberstalker on 08-01-2006 at 12:04 AM

I need to be able to assign a / command such as /new <name> and create a new varible that I can change the value of with something like /change <name> <value>...if that makes any sense


RE: External Variable by bigbob85 on 08-01-2006 at 01:25 AM

Go look through some other scripts, and what people use to see if the message is /something. Also, look for some scritps that submit paramaters.


RE: External Variable by RaceProUK on 08-01-2006 at 08:58 AM

quote:
Originally posted by Uberstalker
I need to be able to assign a / command such as /new <name> and create a new varible that I can change the value of with something like /change <name> <value>...if that makes any sense
This sounds like you want a map data structure. JScript should have enough support to use one, even if you have to write it yourself.

Edit: The post below is what you want, f'sure ;) Since a map can be implemented as an associative array.
RE: External Variable by AberNStein on 08-01-2006 at 02:35 PM

you can't create new variables on the fly with jscript afaik but you could do this with an associative array.

code:
var my_vars= new Array()

function setValue(name,data){
my_vars[name]=data;
}


note that you can assign a value to an item in the array without declaring that item.