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
  18/05/2002
Points
  552

VIP Member
27th March, 2012 at 27/03/2012 23:45:41 -

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

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
28th March, 2012 at 28/03/2012 01:56:08 -

can you be a little more specific

 
n/a

Duncan

Thelonious Dunc

Registered
  18/05/2002
Points
  552

VIP Member
28th March, 2012 at 28/03/2012 02:09:20 -

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
  18/05/2002
Points
  552

VIP Member
29th March, 2012 at 29/03/2012 22:03:08 -

Image

 
n/a

Alonso Martin



Registered
  29/12/2010
Points
  294
29th March, 2012 at 29/03/2012 22:15:29 -

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
  18/05/2002
Points
  552

VIP Member
29th March, 2012 at 29/03/2012 22:41:14 -

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
  20/07/2006
Points
  171
30th March, 2012 at 30/03/2012 01:43:09 -

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

 
458 MMF2 & CTF 2.5 examples and games

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

Alonso Martin



Registered
  29/12/2010
Points
  294
30th March, 2012 at 30/03/2012 03:31:00 -

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
  26/08/2002
Points
  2723
4th April, 2012 at 04/04/2012 19:26:41 -

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".


 
Image jenswa.neocities.org
   

Post Reply



 



Advertisement

Worth A Click