Great. I need to make one thing different from your tutorial - instead of when touch is clicked, when game.attribute%2=0. However, I do not know how to type game.attribute%2 in the first blank space (left one) in the expression editor or any other way.
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
On the left side of the rule, instead of selecting attribute, select numeric expression.
You can then use the expression editor on the left side of the rule. Note that the "%" symbol is being phased out and it's recommended that you use mod(game.attribute,2)=0 instead.
Thank you for your response. However, is that available in Gamesalad Windows Creator since I am using Windows-based laptop right now, my lovely MacBook broke
@The_Gamesalad_Guru said:
I'd like to know where he found out the not could be used in an expression? Is this a LUA command?
I've seen @tatiang mention it before, but I think it's just one of those things that people discover by experimentation. I know I tried a whole bunch of other potential functions without any success.
I'd say you're right about it being because of the LUA roots though. It would also explain why you can do things like have a rule that says 10==10 = 1.
Another thing I've not seen mentioned before that works is ^. Try 10^5 and see what result gets outputted.
Would love to see access added for character classes (e.g. %a) to beef up the string functions. Just adding access to the classes built in to LUA would ramp up the power of GameSalad's string manipulation significantly. @dgackey@CodeWizard
It's also worth noting that the expression editor doesn't give you "real" access to the LUA underpinnings, so you can't do things like string.lower("AAAA") or string.reverse("ABCD"), sadly. It also seems the expression editor doesn't hook directly into the C numerical library, as we don't have things like cbrt(x) or isinf(x). It seems the GS team pick what gets allowed but don't always tell us
@The_Gamesalad_Guru: I just typed it in to see if it works. And it did. Later i found out that this is a LUA function. That's the little story of "not".
Lol @Rthurman i just did a video on that. No i was talking about using "NOT" as part of an expression. Yeah @Armelline I tried a bunch of stuff from the lua libary to no avail.
Thank you for your response. However, is that available in Gamesalad Windows Creator since I am using Windows-based laptop right now, my lovely MacBook broke
@BonepileGames I'm not terribly versed in Windows Creator (hoping to get VMWare running really soon though) and I assumed since this was in the Mac subforum that you were using Mac Creator. One thing you can do if there isn't a numerical expression choice is to create a constant by making a custom attribute game.ZERO equal to 0. Then make the rule If attribute game.ZERO = mod(game.attribute,2) then ... [behaviors]
It's just flipping the equation around so it still works the same.
@The_Gamesalad_Guru said:
Lol Rthurman i just did a video on that. No i was talking about using "NOT" as part of an expression.
I believe it was @Orbz who introduced the idea of negating booleans (and the idea of using Boolean logic in the expression editor). That was back in the "Timers Are For Chumps" thread.
Comments
Great. I need to make one thing different from your tutorial - instead of when touch is clicked, when game.attribute%2=0. However, I do not know how to type game.attribute%2 in the first blank space (left one) in the expression editor or any other way.
@BonepileGames
On the left side of the rule, instead of selecting attribute, select numeric expression.
You can then use the expression editor on the left side of the rule. Note that the "%" symbol is being phased out and it's recommended that you use mod(game.attribute,2)=0 instead.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Another useful toggle switch is to have an integer attribute (set at its default 0) - let's call it 'switch' - and to use it like this:
When touch is pressed: change switch to 1-switch
@tatiang
Thank you for your response. However, is that available in Gamesalad Windows Creator since I am using Windows-based laptop right now, my lovely MacBook broke
I'd like to know where he found out the not could be used in an expression? Is this a LUA command?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I've seen @tatiang mention it before, but I think it's just one of those things that people discover by experimentation. I know I tried a whole bunch of other potential functions without any success.
I'd say you're right about it being because of the LUA roots though. It would also explain why you can do things like have a rule that says 10==10 = 1.
Another thing I've not seen mentioned before that works is ^. Try 10^5 and see what result gets outputted.
Would love to see access added for character classes (e.g. %a) to beef up the string functions. Just adding access to the classes built in to LUA would ramp up the power of GameSalad's string manipulation significantly. @dgackey @CodeWizard
It's also worth noting that the expression editor doesn't give you "real" access to the LUA underpinnings, so you can't do things like string.lower("AAAA") or string.reverse("ABCD"), sadly. It also seems the expression editor doesn't hook directly into the C numerical library, as we don't have things like cbrt(x) or isinf(x). It seems the GS team pick what gets allowed but don't always tell us
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
If you are referring to the % operator, CodeMonkey mentioned it here:
http://forums.gamesalad.com/discussion/comment/412742/#Comment_412742
@The_Gamesalad_Guru: I just typed it in to see if it works. And it did. Later i found out that this is a LUA function. That's the little story of "not".
http://www.arcaderz.com
Lol @Rthurman i just did a video on that. No i was talking about using "NOT" as part of an expression. Yeah @Armelline I tried a bunch of stuff from the lua libary to no avail.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@BonepileGames I'm not terribly versed in Windows Creator (hoping to get VMWare running really soon though) and I assumed since this was in the Mac subforum that you were using Mac Creator. One thing you can do if there isn't a numerical expression choice is to create a constant by making a custom attribute game.ZERO equal to 0. Then make the rule If attribute game.ZERO = mod(game.attribute,2) then ... [behaviors]
It's just flipping the equation around so it still works the same.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I believe it was @Orbz who introduced the idea of negating booleans (and the idea of using Boolean logic in the expression editor). That was back in the "Timers Are For Chumps" thread.