How to make a rule the says...

ofekezofekez Member, PRO Posts: 95
edited March 2015 in Working with GS (PC)

Hey,
I would like to know how to make a rule the says "If (x) is greater and lower the (y) so..."?

BR,
Ofek.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    What does "greater and lower the" mean? If you meant to write "greater and lower than," how can an attribute be both greater and lower than a number?

    Can you give an example of the range of x and y values you're wanting? You can choose =, ≠, ≤, <, >, or ≥ as part of the rule condition for integer or real attributes.

    Are x and y self.Position.X and Y or something else? Are either of those attributes that you created?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited March 2015

    You just did it! LOL

    In the rule use the drop down menu to choose "not equal to". It looks like an equal sign with a slash through it ( ≠ ).

    If X is not equal to Y then it is either greater than or less than Y. :)

  • ofekezofekez Member, PRO Posts: 95

    This is an image that shows what i want to do but from some reason this rule doesn't work...

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    If those are two conditions in the same rule, make sure the rule is set to ALL conditions rather than ANY. How do you know it's not working? Are you using a Display Text behavior to watch the value of game.jump top? If so, what are the values you're seeing? Is game.jump top an Integer or Real attribute?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ofekezofekez Member, PRO Posts: 95
    edited March 2015

    game.jump is an integer.
    The rule is set to "ALL".
    From some reason even when game.jump is set to -1 the rule is still working.
    There is the project file, i'll be thankful if you will see what you can do about it,
    This rule is in the actor called "ScoreTOPtext".
    http://www.mediafire.com/download/k9e8m3o69bvtque/jump_chump_clone.rar

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I don't see an actor with that name. Can you double-check the name and also tell me which scene that actor is on?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ofekezofekez Member, PRO Posts: 95

    Hey, The actor's name is: "ScoreTOPtext" and he is in the Initial Scene

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    I put a Log Debugging Statement in that rule and it does in fact trigger. Something to keep in mind is that a rule only triggers when its condition changes from false to true. I noticed that game.jump top toggles between 0 and 1 most of the time. In that case, the rule will trigger when the value is between 0 and 2 but it won't trigger again unless the value first becomes NOT between 0 and 2.

    To give a simple example, the rule If game.Time>0 will trigger when game.Time is 0.1 but won't keep triggering as game.Time increases. It will only trigger once.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ofekezofekez Member, PRO Posts: 95
    edited March 2015

    But the game.jump top is set to -1 so why the timer is still working even though it supposed to work only when game.jump top is 0 or 1?

    Edit: and another thing, if you can see on the actor called: spawner top (in the Initial Scene) so it says that only if game.jump top is lower then 2 so it should work but i checked it and even when the game.jump top is 2 the rule is still working. I don't get it.

  • ofekezofekez Member, PRO Posts: 95

    Hey,
    I would like to know how to make an attribute the says " if (x) equals (y) or (z) then..."?

    BR,
    Ofek.

  • LovejoyLovejoy Member Posts: 2,078

    @ofekez said:
    Hey,
    I would like to know how to make an attribute the says " if (x) equals (y) or (z) then..."?

    BR,
    Ofek.

    Create a rule,

    If any
    attribute.x = attribute.y
    attribute.x = attribute.z

    then
    whatever here

    Fortuna Infortuna Forti Una

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    [merged]

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    But the game.jump top is set to -1 so why the timer is still working even though it supposed to work only when game.jump top is 0 or 1?

    Something else is changing game.jump top to 0 or 1. Rules don't mysteriously trigger so you'll have to find the actor that is changing that attribute's value. One not very efficient way to find it is to delete actors one by one from the scene until it's fixed. The last actor you deleted is either entirely responsible or partly responsible.

    Edit: and another thing, if you can see on the actor called: spawner top (in the Initial Scene) so it says that only if game.jump top is lower then 2 so it should work but i checked it and even when the game.jump top is 2 the rule is still working. I don't get it.

    Well, that rule will trigger immediately since game.jump top starts out at -1.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ofekezofekez Member, PRO Posts: 95

    @Lovejoy said:
    whatever here

    I did it and it is still doesn't work.
    game.jump top top is set to -1 in his default and in the rule it says:
    When Any
    if game.jump top = 1
    if game.jumo top = 0

    The problem is that when i hit play the rule is working even though game.jump top is -1

  • LovejoyLovejoy Member Posts: 2,078
    edited March 2015

    @ofekez said:
    I did it and it is still doesn't work.

    As stated before, there has to be something else triggering it, rules just don't mysteriously fire.

    Fortuna Infortuna Forti Una

  • ofekezofekez Member, PRO Posts: 95
    edited March 2015

    @Lovejoy said:
    As stated before, there has to be something else triggering it, rules just don't mysteriously fire.

    Ok thank you, i'll try to see what is it...
    I'm sorry for all of those questions but i have another question and i hope this one will be the last. I made a rule that says: "if touch is pressed change scene to (scene's name)" but when i click this specific actor, nothing is happening.

  • LovejoyLovejoy Member Posts: 2,078

    @ofekez said:
    I'm sorry for all of those questions but i have another question and i hope this one will be the last. I made a rule that says: "if touch is pressed change scene to (scene's name)" but when i click this specific actor, nothing is happening.

    Hmm that is pretty straight forward. Are you unlocking your actor at the instance by any chance?

    Fortuna Infortuna Forti Una

  • ofekezofekez Member, PRO Posts: 95

    @Lovejoy said:
    Hmm that is pretty straight forward. Are you unlocking your actor at the instance by any chance?

    Yes, that's because i'm using at the same actors for few scenes and i want each one to have another type of actions to do.

  • LovejoyLovejoy Member Posts: 2,078

    @ofekez said:
    Yes, that's because i'm using at the same actors for few scenes and i want each one to have another type of actions to do.

    It can make the whole project very confusing when actors are unlocked, just make sure the actual actor in the instance has the rules that you need.

    Fortuna Infortuna Forti Una

  • ofekezofekez Member, PRO Posts: 95

    @Lovejoy said:
    It can make the whole project very confusing when actors are unlocked, just make sure the actual actor in the instance has the rules that you need.

    I checked on the normal version of Gamesalad and it is just fine, for some reason in the Nightly version there's a problem. Anything i can do about that?

  • LovejoyLovejoy Member Posts: 2,078

    @ofekez said:
    I checked on the normal version of Gamesalad and it is just fine, for some reason in the Nightly version there's a problem. Anything i can do about that?

    Just have to wait it out until a new stable comes out for windows. Probably by the end of the month or early next month.

    Fortuna Infortuna Forti Una

Sign In or Register to comment.