Jump to content
Sign in to follow this  
androkiller

Basic parameter help

Recommended Posts

i just need help with a simple parameter for something to be on or off and then if on execute a sqf

description.ext

class Params
{


	  class debugmode
       {
	//paramsArray[2]
               title = "Debug Mode";
               values[] = { 0,1 };
               texts[] = {"Off","On"};
               default = 0;
       };



}

init.sqf

debugmode = (paramsArray select 2);
if (debugmode > 0) then { 
call compileFinal preprocessFileLineNumbers "main\debug.sqf";
};

it looks right but i just dont get why it no work

Share this post


Link to post
Share on other sites
i just need help with a simple parameter for something to be on or off and then if on execute a sqf

description.ext

class Params
{


	  class debugmode
       {
	//paramsArray[2]
               title = "Debug Mode";
               values[] = { 0,1 };
               texts[] = {"Off","On"};
               default = 0;
       };



}

init.sqf

debugmode = (paramsArray select 2);
if (debugmode > 0) then { 
call compileFinal preprocessFileLineNumbers "main\debug.sqf";
};

it looks right but i just dont get why it no work

try :

debugmode = (paramsArray select 0);

paramsArray is an array beginning with 0

or you could name your variables like this in init.sqf

for [ {_i = 0}, {_i < count(paramsArray)}, {_i = _i + 1} ] do

{

call compile format

[

"AnK_PARAMS_%1 = %2",

(configName ((missionConfigFile >> "Params") select _i)),

(paramsArray select _i)

];

};

and all params variable would have an equivalent beginning with AnK_PARAMS_

for example here, AnK_PARAMS_debugmode

regards,

Holo.

Share this post


Link to post
Share on other sites

hang on how does this execute my file that i want to use or do i have to make a function called AnK_PARAMS_debugmode. i am abit lost on how it works plus i thought this would be alot more simplez for what i want to do

---------- Post added at 08:22 PM ---------- Previous post was at 07:34 PM ----------

so i changed 'select 2' to 'select 0' but now when i have the parameter as off the debug.sqf is still executed but when in the mission briefing screen its off but in mission its on. and when i have the the parameter on then in both the mission and briefing i can see the makers so now i am truly lost.

---------- Post added at 08:28 PM ---------- Previous post was at 08:22 PM ----------

i was wrong its always on now

Edited by Androkiller

Share this post


Link to post
Share on other sites
hang on how does this execute my file that i want to use or do i have to make a function called AnK_PARAMS_debugmode. i am abit lost on how it works plus i thought this would be alot more simplez for what i want to do

---------- Post added at 08:22 PM ---------- Previous post was at 07:34 PM ----------

so i changed 'select 2' to 'select 0' but now when i have the parameter as off the debug.sqf is still executed but when in the mission briefing screen its off but in mission its on. and when i have the the parameter on then in both the mission and briefing i can see the makers so now i am truly lost.

---------- Post added at 08:28 PM ---------- Previous post was at 08:22 PM ----------

i was wrong its always on now

Ok, you did right, the select 0 is less complicated to use for now since you only have one parameter.

Now I'm pretty sure when you change this parameter to on, your variable debugmode should be 1 and by default it is 0 (off)

How are you testing back and forth your mission parameters?

This new thread http://forums.bistudio.com/showthread.php?176541-Faster-turnaround-iteration-time-for-scripting could help you on that testing process.

Make sure you are not testing with a saved game (which should not give you the lobby "parameters" button to change it), always restart them when you change something on your mission.

Keep us informed of your progress.

Regards,

Holo.

Share this post


Link to post
Share on other sites

class Params
{
       class debugmode
       {
	//paramsArray[0]
               title = "Debug Mode";
               values[] = { 0,1 };
               texts[] = {"Off","On"};
               default = 0;
       };
};

if ((paramsArray select 0) == 1) then { 
call compileFinal preprocessFileLineNumbers "main\debug.sqf";
};

Why overcomplicate things. ;)

Edited by Pergor

Share this post


Link to post
Share on other sites

right i also have class for time of day parameters so how does it know which paramsarray to check

or does it look something like the paramsArray[class debugmode, class timeofday]

so if i want the value in debug i would so select 0 but if i wanted the value for timeofday i do select 1. am i right

---------- Post added at 01:06 PM ---------- Previous post was at 12:41 PM ----------

ok i think i understand now but what i just dont get why cant you call for the value of the class which you names for you parameter.

but to summarise for other people who where as confused as me then this is how it works

in your descrpition.ext you will have

class Params
{

	  class random1 //this is your parameter name
       {
	    //paramsArray[0]
           title = "something1";
           values[] = {0,1};
           texts[] = {"Off","On"};
           default = 0;
       };

	  class random2 //this is your parameter name
       {
	    //paramsArray[1]
           title = "something2";
           values[] = {0,1};
           texts[] = {"Off","On"};
           default = 0;
       };

};

so here we can see we have 2 parameters. now to get the value for the each parameter we have to see where it is, so random2 is in the 2nd position so to get the value for that we simply put (paramsArray select 1) and if we want the value for random1 then we put in (paramsArray select 0). Now say we have a 3rd parameter after random2 then we would put (paramsArray select 2) to get the value of it.

So to summarize on the lay out of your parameters they look like this

paramsArray[random1,random2,.....]

so the first one is always select 0 an the second one is select 1 and so on

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×