String Editing
I understand when you're using a rule on a string, you can use a few different comparative measures that are unique to Text: Contains, Begins With, Ends With and Is
Say I have a string: ABCD
And I want to look at the string and see if it begins with A. No problem, this one does.
Say I want to look at the substring BCD (or alternatively, I want to create a substring based on the string ABCD), and see if it begins with B. Is that possible?
Say I have a string: ABCD
And I want to look at the string and see if it begins with A. No problem, this one does.
Say I want to look at the substring BCD (or alternatively, I want to create a substring based on the string ABCD), and see if it begins with B. Is that possible?
Comments
Rule set to All
When
game.string01 contains BCD
game.string01 Ends with D
That's the closest you can get, I think.
----------------------------------------------
http://www.davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Rule
When attribute game.MusicList = ABCD
---do your stuff---
Change attribute game.Musiclist to BCD
possibly a boolean switch, set to false, (let's call it ShortenGo), so can have control over the next Rule.
So when ready, change attribute game.ShortenGo to true
When ShortenGo is true
When game.MusicList = BCD
-- do your stuff---
Change attribute game.Musiclist to CD
Change attribute game.ShortenGo to false.
---etcetera----
Would that work out for what you're after?
----------------------------------------------
http://www.davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
ADDBGG ---> GGBDDA
144277 ---> 772441
Then you can easily check the "first" letter and truncate:
mod(772441,10) = 1 = A
floor(772441/10) = 77244
mod(77244,10) = 4 = D
floor(77244/10) = 7724
Does that make sense?
Also to help anyone out who might be coming along after this, if a string needs to be built similarly to this, one could pretty easily start the number at 0 and then add the next note to the sequence using a couple of variables:
Say A= 1, B = 2 and so on, and game.modifier = 0 and game.songString = 0 (songString is our song):
the sequence to be recorded will be ABCD, which we want as a result 4321, you'd get the general form:
game.songString = game.songString + (game.letter * 10^(game.modifier)) and game.modifier = game.modifier + 1.
So A would give game.songString = 0 + (1 * 10^0) = 0 + 1*1) = 1
AB would give: game.songString = 1 + (2 * 10^1) = 1 + 20 = 21
ABC would give: game.songString = 21 + (3 * 10^2) = 321
and ABCD would give: game.songString = 321 + (4 * 10^3) = 4321.
And so on. I like it very much. Thanks a lot, again.