Can't compare string attributes?
Omegas7
Member Posts: 37
How come I can't compare a string attribute with another attribute?
In my case, I need to compare 2 string attributes, but... Well, GameSalad has no option for such...
I want to compare my string attribute if it is the same as another string attribute...
That almost ruined my whole project btw T.T...
In my case, I need to compare 2 string attributes, but... Well, GameSalad has no option for such...
I want to compare my string attribute if it is the same as another string attribute...
That almost ruined my whole project btw T.T...
Comments
I made this example:
Game attributes:
First = awesome
Second = awesome
-----
And here is an actor:
if game.First is game.Second
destroy
-----
The actor won't destroy itself.
For some reason, game.Second has no effect at all...
There isn't even an equation sign when you try to compare a string.
First and Second ARE the attributes.
"awesome" is the string value I gave to both of them so I could test comparing both...
It can be letters, that's what the text type attribute is for (a string).
That's what I am asking.
I can compare numbers, but it seems like Gamesalad can't compare strings (texts...).
I am just so busy now.
That said, I did want to point out a flaw. You CAN compare text vs text. In fact my RPG is heavily based on this. I use it for all my spells & everything. For example:
If game.spellselected = Lightning
Change game.damage to 20
If game.spellselected = Fire
Change game.damage to 20
I use text attributes for many things. Instead of having 20 game.attributes that all do 1-2 things I can do ALOT of it just by comparing text.
Although I reread what both of you posted & I'm not sure if we are all talking about the same thing...
However, that being said I have no idea why yours is not working Omega.
Here is one option.
If game.howcoolru = imsoubercool
If game.howcoolru2 = imsoubercool
then destroy actor
Otherwise explain in more detail.
Compare 2 text type game attributes. That's all.
if game.textA is game.textB
do something
end
That's all. But Gamesalad won't let me. Test it out.
-----
@JGary321: That's what I am doing right now, but I will be having tons of text attributes in the game... Anyways, I am just asking for an update letting me compare text attributes...
Like you said, the magic spells, etc.
It's simple, let's say my game is about... Pets, and the player can name them
with custom names. And I don't want pets to have the same name, so I check
if the name of a pet is the same as the name of the other pets.
You can't name a pet Mark if another pet already has such name.
That's an example, and it makes sense, does it?
I just asked if it was possible to compare strings and how, that's all,
and you answered me, it isn't possible. So, thanks very much, topic solved.
But just for the sake of future projects, I don't think it is wrong to add a function
to compare strings. After all, all programming languages can do it.
Gamesalad not being able to such a simple task limits flexibility.
Thanks anyways .
i get what youre trying to do, and gamesalad really wont let you do it.
you can only compare the text with something you type in yourself on the "if rule".
it wont let you compare with another "text attribute"
i even tried typing "game.######" but it wont recognize as an game attribute, but as a text.
have to wait for them to implement this option.
Free Online Comparing Numbers Games
to the main site for more math subjects: Math Games For Kids