itemDelimeter
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, asayd
itemDelimeter
I was looking and going through the 3-5-7 game code in the tutorials. This itemDelimiter was so easy to understand until I encountered it here. Since I am not writing any text anywhere I am at a loss to understand it inclusion, even setting 'space' makes no sense to me because the explanation given here is incomplete: ie what is this space? what is this space? why an item delimiter in a visual non text environment? These elaborations are so important for beginners.
set the itemDelimiter to space
The itemDelimiter is a property that can be set to specify a character that is used to separate expressions in a chunk of data. For example if you have a line of text, then you may want to use a space character to separate one word from an other.
Sorry! Had to have a moan, everyone is out...and my cat is sleeping.....
set the itemDelimiter to space
The itemDelimiter is a property that can be set to specify a character that is used to separate expressions in a chunk of data. For example if you have a line of text, then you may want to use a space character to separate one word from an other.
Sorry! Had to have a moan, everyone is out...and my cat is sleeping.....
-
- VIP Livecode Opensource Backer
- Posts: 858
- Joined: Wed Jun 24, 2009 1:17 pm
- Location: Plymouth, UK
- Contact:
Re: itemDelimeter
Hi Chris
But to be serious - I don't know the 3-5-7 game code you're referring to but "set the itemDelimiter to space" could be perfectly valid if there had been an earlier "set the itemDelimiter to comma"
...go and stroke your cat...
Kind regards
Dave
I'm tempted to answer "Space, the final frontier"chris25 wrote:what is this space?
But to be serious - I don't know the 3-5-7 game code you're referring to but "set the itemDelimiter to space" could be perfectly valid if there had been an earlier "set the itemDelimiter to comma"
...go and stroke your cat...
Kind regards
Dave
"...this is not the code you are looking for..."
Re: itemDelimeter
Hello, lost in space ?
I assume you refer to these lines
set the itemDelimiter to space
if item 1 of the name of target is "button" then...
In Livecode you manipulate strings of characters all the time, even if the result on the screen does not show any text.
So when you have a string of text there are simple ways to get chunks of it.
Usually you can take words in a string of text (as in a normal sentence, words are separated by "spaces")
By default Livecode as an "itemdelimiter" which is a comma, so item 2 of "one,three,five,two" is ... "three"
If you set the item delimiter to space, Livecode looks for spaces, so item 2 of the preceding string would be ... empty
But item 2 of "Twenty one,twenty three" would be ... ?
By default with a comma, it would be ... "twenty three"
With the itemdelimiter set to space, it is ... ""one,twenty"
Weird, no ?
So the answer is on the following lines in the script, because "the name of the target" can be different things depending on the target.
If you clicked on a button the name of the target starts with something like :
button "test" of card ...
So the first item is "button"
Ok, I go back to sleep...
I assume you refer to these lines
set the itemDelimiter to space
if item 1 of the name of target is "button" then...
In Livecode you manipulate strings of characters all the time, even if the result on the screen does not show any text.
So when you have a string of text there are simple ways to get chunks of it.
Usually you can take words in a string of text (as in a normal sentence, words are separated by "spaces")
By default Livecode as an "itemdelimiter" which is a comma, so item 2 of "one,three,five,two" is ... "three"
If you set the item delimiter to space, Livecode looks for spaces, so item 2 of the preceding string would be ... empty
But item 2 of "Twenty one,twenty three" would be ... ?
By default with a comma, it would be ... "twenty three"
With the itemdelimiter set to space, it is ... ""one,twenty"
Weird, no ?
So the answer is on the following lines in the script, because "the name of the target" can be different things depending on the target.
If you clicked on a button the name of the target starts with something like :
button "test" of card ...
So the first item is "button"
Ok, I go back to sleep...
Re: itemDelimeter
Thankyou both for your replies.
Re: itemDelimeter
Hi Chris,
setting the itemdel to SPACE does not make sense, except in some very rare cases.
Better use "WORD X of XYZ", because:
1. WORDS in Livecode are separated by SPACE, comma or a full stop by "nature"
2. No need to set the itemdel
3. all in all less typing (MOST important to me )
Best
Klaus
setting the itemdel to SPACE does not make sense, except in some very rare cases.
Better use "WORD X of XYZ", because:
1. WORDS in Livecode are separated by SPACE, comma or a full stop by "nature"
2. No need to set the itemdel
3. all in all less typing (MOST important to me )
Best
Klaus
Re: itemDelimeter
You are right, but it comes straight from a Runrev example
Re: itemDelimeter
So what?macnomad2 wrote:You are right, but it comes straight from a Runrev example
Re: itemDelimeter
Ah yes, "Do what I say, don't do what I do" in my code says Runrev
You are right Klaus.
You are right Klaus.