The Daily Click ::. Forums ::. Klik Coding Help ::. String parser/string tokeniser and empty elements
 

Post Reply  Post Oekaki 
 

Posted By Message

Duncan

Thelonious Dunc

Registered
  5/18/2002
Points
  577

VIP Member
27th March, 2012 at 3/27/2012 11:45:41 PM -

I'm using MMF2 for the first time, and I haven't used these extensions before. I'm trying to make a level editor, but both of them ignore empty elements which will obviously play havoc with necessarily sequential values. What am I missing?

Edited by Duncan

 
n/a

The Cecilizer

You Done Got Cecilized

Registered
  3/19/2005
Points
  1602

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!Computer
28th March, 2012 at 3/28/2012 1:56:08 AM -

can you be a little more specific

 
Image

>> http://www.cecilectomy.com <<

Duncan

Thelonious Dunc

Registered
  5/18/2002
Points
  577

VIP Member
28th March, 2012 at 3/28/2012 2:09:20 AM -

Yes.

Say I'm using the delimiter "|",

item0|item1|item2||item4

Elements 0, 1, 2 and 3 become item0, item1, item2 and item4 respectively, ignoring the empty space between the 3rd and 4th |s.

I could pad it with another character but that seems so ungainly!

Hope this helps, cheers Cecil

 
n/a

Duncan

Thelonious Dunc

Registered
  5/18/2002
Points
  577

VIP Member
29th March, 2012 at 3/29/2012 10:03:08 PM -

Image

 
n/a

Alonso Martin



Registered
  12/29/2010
Points
  282
29th March, 2012 at 3/29/2012 10:15:29 PM -

Hmm. Can't you add a space between the delimiters? Obviously it depends on what you're attempting to do, but you can always set up events to consider " " (space) to be nothing.

Edit: Ah, I didn't read the part where you said you'd hate to use another character. There's nothing to be done about this with the string parser, I think. My game's delimiters all have a space between them, but I made an editor to never have to see the mess.

Edited by Alonso Martin

 
www.hfalicia.com
www.alonsomartin.mx

Duncan

Thelonious Dunc

Registered
  5/18/2002
Points
  577

VIP Member
29th March, 2012 at 3/29/2012 10:41:14 PM -

Yeah, I was hoping there'd be a more watertight method but it's not too big a deal really.

While we're here, anyone know if one of these extensions is preferred over the other? The string tokeniser seems to be newer but does less stuff. They're both apparently Flash compatible.

 
n/a

nivram



Registered
  7/20/2006
Points
  111
30th March, 2012 at 3/30/2012 1:43:09 AM -

Well, I actually like String Parser better, but I have read on the CT forum that Tokenizer is better. String Parser still works very well. IMHO.

Marv

 
355 open source examples and games

http://www.castles-of-britain.com/mmf2examples.htm

Alonso Martin



Registered
  12/29/2010
Points
  282
30th March, 2012 at 3/30/2012 3:31:00 AM -

I haven't really used the String Tokeniser to judge, but if you really want to avoid using a null character, perhaps it might allow for it. Whatever is more useful, I think.

 
www.hfalicia.com
www.alonsomartin.mx

Jenswa

Possibly Insane

Registered
  8/26/2002
Points
  2217
4th April, 2012 at 4/4/2012 7:26:41 PM -

I am storing most of my level data 'tile style', that is: a set of number going from zero till the number of objects needed. The 0 character means I've stored nothing in that place. You could use the empty spot from the spacebar character, but I am unsure if that's a wise thing to do. I would suggest another character to use for empty stuff.

The 'tile style' is a set of lines with characters with a delimiter just like your string is. I am using a string like: "0, 0, 0, 1, 1, 2, 2, 2, " and continue on the next line with the net row.

I am not sure what you want to do with your string, but if there is an empty spot you also need to know that (mumble something about the zero character in our decimal system, before we had the character the spot of 0 was left empty which could give a value of 1, 10, 100, 1000, etc... to the number 1 since one could know how many zero's were used, well one could count the empty places but this was often very confusing).

If your item list just is for placing items at some spots, you could calculate the spot from the item number.

But it probably better to save your item as an object and give it the properties it needs (picture, coordinates, etc...) This way you only need to store the objects you need, so you can skip "item3".


 
Check out DTV Boxes http://ow.ly/k13fh (work in progress)
Download hh_beer.zip from http://ge.tt/4d07kPc/v/0 and hhxl.zip from http://ge.tt/3kbXlPc/v/0
   

Post Reply



 



Advertisement

Worth A Click