Setting a Variable in .mis file
by Ryan Ackley · in Torque Game Engine · 02/04/2002 (12:02 pm) · 9 replies
Ok, what i am trying to accomplish is, i have a map gui on the Hud that displays a map for that mission. right now, i only have one mission, but i plan on adding more. Now, how can i set a variable (such as $missionbitmap or something of that nature) in a .mis file so that my clientCmdMissionStart in common/client/missions.cs can do something like
missionmap.bitmap = $missionbitmap;
I tried doing it the way you can set background music for each map, but theres no MissionMapProfile :) am i gonna have to write that myself, or is there a simpler way to do it?
ryan
missionmap.bitmap = $missionbitmap;
I tried doing it the way you can set background music for each map, but theres no MissionMapProfile :) am i gonna have to write that myself, or is there a simpler way to do it?
ryan
About the author
#2
any mission specific variables we put in there.
So you could just get like, MissionInfo.blah or whatever
02/04/2002 (5:03 pm)
Well, how we do it is we make a simgroup, called MissionInfoany mission specific variables we put in there.
So you could just get like, MissionInfo.blah or whatever
#3
and then later
or something to that effect.
The .mis files are read into a variable and eval'ed as script, so it shouldn't be a problem.
02/04/2002 (5:07 pm)
but I honestly don't see why you wouldn't be able to do it exactly the way you just described:..... in missionfile.mis .... $somevar = "somevalue"; ......rest of file ....
and then later
$blah = $somevar;
or something to that effect.
The .mis files are read into a variable and eval'ed as script, so it shouldn't be a problem.
#4
ryan
02/04/2002 (6:54 pm)
it hangs on loading mission if i try to set any $global variable... i figured it would be easy, it ends up being not so... :(ryan
#5
You can even compile them into .dso files (if you edit the engine to allow it).
Just add your global variable at the end. Right after "//--- OBJECT WRITE END ---"
It probably isn't working for you because you have a syntax error.
Dark
02/06/2002 (2:13 am)
There's no reason it shouldn't work. .mis files are exactly the same as .cs files. They're executed using the exact same command. You can put mission specific code in them if you want. Add trigger code (like a teleporter), whatever you want.You can even compile them into .dso files (if you edit the engine to allow it).
Just add your global variable at the end. Right after "//--- OBJECT WRITE END ---"
It probably isn't working for you because you have a syntax error.
Dark
#6
MissionInfo.name
Open waterworld and try this in the console:
echo(MissionInfo.desc1);
So to add a new one simple add this in the ScriptObject(MissionInfo):
dude = "Blah man, blah";
then you can simply access it like
echo(MissionInfo.dude);
-Tim aka Spock
02/06/2002 (2:37 am)
you dont need to do that. Once the mission is loaded, you can access it like this:MissionInfo.name
Open waterworld and try this in the console:
echo(MissionInfo.desc1);
So to add a new one simple add this in the ScriptObject(MissionInfo):
dude = "Blah man, blah";
then you can simply access it like
echo(MissionInfo.dude);
-Tim aka Spock
#7
ryan
02/06/2002 (7:07 am)
well, i got it to work by putting it at the end (after the object write end)... for some reason it wouldnt work anyplace else... quite odd... but at least it works! thanks guysryan
#8
doing an echo on the console works, but setting a var to a value of this simgroup server side doesnt :\
02/06/2002 (8:56 am)
tim, this can only be read client side right?doing an echo on the console works, but setting a var to a value of this simgroup server side doesnt :\
#9
02/06/2002 (7:08 pm)
It's probably because MissionInfo seems to be something of a hack. Check out /common/server/missionInfo.cs and you'll see what I mean.
Torque 3D Owner Xavier "eXoDuS" Amado
Default Studio Name