Jump to content
Sign in to follow this  
blackbeard06

Generating Values instead of typing them?

Recommended Posts

I hope this is in the right topic...

I have a good, Time Saving question, if answered..

I've placed 889 blocks onto a map each individual block is named

"h", "h_1", "h_2"......."h_889".

This is only half the problem, I must now type each block's

name into a .sqf call function which is:

null = [["h","h_1",......."h_899"],[4,2,100],[5,2,100],[1,1,100],[1],[2],[1,2],[0,0,400,EAST,TRUE,FALSE]] call EOS_Spawn;

Yes this is EOS we are dealing with.

My question is: Instead of typing all those names, is there a way to generate them so I can save time?

Share this post


Link to post
Share on other sites

Not having much knowledge but can't you just create the blocks via script? and put the instance created into an array?

Alternate simple way - open Calc, Excel or what ever, make an h_ cell, copy paste 899 rows. Then next column do the 1, 2, 3 and fill the rest with the mouse. Then, save as csv.

Other simple way, small C prog.

Other simple way - cmd: for /L %i IN (1,1,899) DO @echo h_%%i and pipe it into a file

I guess I didn't get your question right, sorry if I wrote nonsense

Share this post


Link to post
Share on other sites

1 - Rename "h" to "h_0". (Don't blame me for this quirky workaround - it's your nomenclature) :D

2 - Run some code that adds all of those strings* to an array

* they are strings as they have "" around them. Ex: "this is a string" or "h_66" or "h_1"

_awesomeArray = [];
for "_i" from 0 to 889 do {
_string = "h_" + format ["%1", _i];
_awesomeArray set [count _awesomeArray, _string];
};

Then plop _awesomeArray into the last bit of the code you put up.

null = [_awesomeArray,[4,2,100],[5,2,100],[1,1,100],[1],[2],[1,2],[0,0,400,EAST,TRUE,FALSE]] call EOS_Spawn; 

So the whole thing looks like this:

_awesomeArray = [];
for "_i" from 0 to 889 do {
_string = "h_" + format ["%1", _i];
_awesomeArray set [count _awesomeArray, _string];
};

null = [_awesomeArray,[4,2,100],[5,2,100],[1,1,100],[1],[2],[1,2],[0,0,400,EAST,TRUE,FALSE]] call EOS_Spawn;

Untested as I don't have EOS. But if you want to use an array of the stringnames for your blocks as an argument in a script, then that's how I would do it . BTW, for future reference, in the future post your scripting queries in the Mission Editing Forums. You'll probably get better replies there.

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  

×