Home   Help Search Login Register  

Author Topic: split command?  (Read 1210 times)

0 Members and 1 Guest are viewing this topic.

CopyrightPhilly

  • Guest
split command?
« 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

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:split command?
« Reply #1 on: 18 Jun 2005, 12:54:24 »
Can you explain it a different way, I haven't quite grasped this yet.


Planck
I know a little about a lot, and a lot about a little.

CopyrightPhilly

  • Guest
Re:split command?
« Reply #2 on: 18 Jun 2005, 13:09:04 »
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
« Last Edit: 18 Jun 2005, 13:09:22 by CopyrightPhilly »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:split command?
« Reply #3 on: 18 Jun 2005, 13:56:25 »
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.

Code: [Select]
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....

CopyrightPhilly

  • Guest
Re:split command?
« Reply #4 on: 18 Jun 2005, 14:02:41 »
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..

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:split command?
« Reply #5 on: 18 Jun 2005, 14:06:09 »
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 know a little about a lot, and a lot about a little.

Offline 456820

  • Contributing Member
  • **
Re:split command?
« Reply #6 on: 18 Jun 2005, 17:26:37 »
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

CopyrightPhilly

  • Guest
Re:split command?
« Reply #7 on: 18 Jun 2005, 20:21:36 »
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
« Last Edit: 18 Jun 2005, 20:21:52 by CopyrightPhilly »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:split command?
« Reply #8 on: 19 Jun 2005, 12:17:22 »
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.

qqqqqq

  • Guest
Re:split command?
« Reply #9 on: 19 Jun 2005, 15:27:32 »
I think BIS are done with OFP patches.   New games coming soon don't forget.