Can't compare string attributes?

Omegas7Omegas7 Member Posts: 37
edited November -1 in Tech Support
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...

Comments

  • Omegas7Omegas7 Member Posts: 37
    No that won't work.

    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.
  • Omegas7Omegas7 Member Posts: 37
    No no...

    First and Second ARE the attributes.

    "awesome" is the string value I gave to both of them so I could test comparing both...
  • Omegas7Omegas7 Member Posts: 37
    Eh...

    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...).
  • JGary321JGary321 Member Posts: 1,246
    TShirtbooth you are a very helpful person on the forums. I remember my days of doing what you do =)

    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.
  • JGary321JGary321 Member Posts: 1,246
    What would you need to compare them for??? This doesn't make sense. Explain what you're trying to do & we'll come up with a solution.

    Here is one option.

    If game.howcoolru = imsoubercool
    If game.howcoolru2 = imsoubercool

    then destroy actor

    Otherwise explain in more detail.
  • Omegas7Omegas7 Member Posts: 37
    Ok, let me explain what I need:

    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...
  • JGary321JGary321 Member Posts: 1,246
    Omegas, this still does not tell us WHAT you are trying to do. Why do you need to compare these things?? We may be able to come up with a alternative solution. I just can't think of any reason you would HAVE to compare 2 strings. Get detailed.
  • Omegas7Omegas7 Member Posts: 37
    For the same reason as comparing integers... Everything!
    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 ;).
  • nulonulo Member Posts: 315
    hey there omegas7
    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.
  • DrewBrookDrewBrook Member Posts: 1
    If you want Comparing Numbers games so you found the best source here:
    Free Online Comparing Numbers Games
    to the main site for more math subjects: Math Games For Kids
Sign In or Register to comment.