The Daily Click ::. Forums ::. Klik Coding Help ::. using string parser 2.
 

Post Reply  Post Oekaki 
 

Posted By Message

Diefox

Possibly Insane

Registered
  23/02/2003
Points
  3481

VIP MemberGOTM -SEPTEMBER 2009 - 2nd place!GOTW WINNER APRIL 2010!
4th August, 2008 at 21:10:49 -

hi guys, i'm trying to make a level editor by storing all the info in a simple txt file, but not using a ini. I'm trying to figure out how string parser 2 works but it's kinda hard.

for example, let's say I have this text in a file.

object115-id=barril,xpos=100,ypos=100

i want mmf to identify this "object115" as a group, then load the ID, XPosition and YPosition.

I'm quite sure that string parser can do that, i just have no idea how.

hope you can help me, thanks in advance.

 
__________
amandapps.com

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
4th August, 2008 at 21:33:25 -

replace it with something like
object115|barril|100|100

set the delimiter to |

then get each bit individually, you may have to use str$() and val(). not sure though.

 
My signature is never too big!!!

Diefox

Possibly Insane

Registered
  23/02/2003
Points
  3481

VIP MemberGOTM -SEPTEMBER 2009 - 2nd place!GOTW WINNER APRIL 2010!
4th August, 2008 at 21:47:21 -

okay okay, now I think I'm starting to undestand, so let's say that I have this on a TXT file:

object1|barrel|100|35 - object3|candle|40|40 - object8|candle|40|90

and I want MMf to identify everything that is separated by "-" as elements when I need to and then when I select one of those elements, separate them again with "|".

Image Edited by the Author.

 
__________
amandapps.com

Diefox

Possibly Insane

Registered
  23/02/2003
Points
  3481

VIP MemberGOTM -SEPTEMBER 2009 - 2nd place!GOTW WINNER APRIL 2010!
4th August, 2008 at 22:28:46 -

well, I found a way, don't know if its the better way but will do for now, until someone tell me if there's a easier way to do what I'm doing.

I have this:
object1|barrel|100|35-object3|candle|40|40-object8|candle|40|90

so I put this event:

by pressing "space" do the follow:

set stringparser delimiter to "-",
set "element loader string" to element 2,
set source string to "element loader string",
set stringparser delimiter to "|",
set "result string" to element 2.

this in one line of event, the result string would return me "Candle"

Doing this I wandered if there's a easy way to find elements. like: search element N with delimiters "x", instead to have to set the delimeter and then search for the element.

 
__________
amandapps.com

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
5th August, 2008 at 00:22:07 -

use a fastloop and the string parser together to run a search, and compare the current value in string parser to the search value. use str$() and val() accordingly.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click