OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: CopyrightPhilly on 18 Jun 2005, 12:42:05
-
hey chaps,
OK i'm wundering if we have a split command in OFP,
what i mean by split is say i had
1-2-3-4
would add the value upto - into an array then go to the next...
so the array would end up
[1,2,3,4]
cheers, Phil
-
Can you explain it a different way, I haven't quite grasped this yet.
Planck
-
ok lets use the 1-2-3-4 example again...
it would start by looking for the first - then take the value before it, which in this case is 1
then it would add that value into an array, so the array is now [1]
now we are left 2-3-4
it would do the same again and this time add the 2 to the array, is the array would be [1,2]
and so on
-
i confess i'm with planck - i don't really get what you mean.
if you mean taking values from one array and putting them in another, that's perfectly doable.
array1 = []
array1 = array1 + some_variable
array1 select 0 would thus return some_variable...
if you have array2 which is ["var1","var2","var3"], you can use the 'select' command to access any of them. you can use the 'count' command to find out how many elements there are in the array. and then take away any of the parts, adding them to array1....
-
no i dont mean get a value from the array, i mean spit up a value so it can go into an array
if you know php then its the explode command
or in vb its the split command...
basic search's a value.
give me an idea while i was posting it...
php description of the explode command:
Returns an array of strings, each of which is a substring of string formed by splitting it on boundaries formed by the string separator.
so: 1-2-5-8
separator being -
sorry i found it hard to explane..
-
I don't think OFP scripting has anything that can manipulate strings to any great extent.
You can join strings together, but I don't think you can split them up and convert to a numerical value for inserting into an array.
Planck
-
i dont think there is an actuall command but i suppose using multiple commands it could be possible there are
+, -, / and * commands they might help but about getting the value of the next array is beyond me
-
ok...
well i should of explaned why i wanted to do this...
i didnt think that there was a command (even tho it would have been nice)
but may be there is another way i can do this...
basicly i want to see if the players name contains a certain word, for example
my_playername
cheak to see if the players name contains my_
cheers,
Phil
-
Unfortuantely, the lack of operators for strings make this pretty impossible. There are unfortunately no commands for selecting individual characters in a string, nor determining the length of a string. With these, it would be possible, and I could have it done for you in a few minutes. Without them, I'm afraid not. You could try starting with the characters forming an array of 1-letter strings, and that would also work, but it's not possible to convert a string into this form either.
How do we get bohemia interactive to release a patch introducing the commands we want; I can think of so many I would like to see. Examples: a command to retrieve *all* the objects in the game at an instant, a command to retrieve all the objects in a certain area of the game, string manipulation commands like we need here, a command to reference weapons as objects instead of just by tag, commands to access fundamental properties of objects, like armour values/physical dimensions/rate of fire/etc. Is this worth a thread on the official forums? I can't see why it take long for a couple of programmers to create some commands in OPFscript to do this.
-
I think BIS are done with OFP patches. New games coming soon don't forget.