constrain an attrib to a number from a range?

pjnolenpjnolen Member Posts: 152
edited November -1 in Working with GS (Mac)
Should be easy. I want to constrain or change, whichever is proper, a number to an attribute from a range of numbers.

for example the game generates a number from 100 -500. Let's say it generates 385.76

Well i want to record that in an attribute as any number from 350-400 will be recorded as just the number 7.

I tried just typing in rule "if attribute game.mynumber = 350-400

but it doesn't like that. Probably thinking I'm wanting to subract. Is there a way to show a range inside that box? without having to make another attribute and changing one into the other then back into my rule?

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    try:

    new rule:
    if attribute game.mynumber > 350
    if attribute game.mynumber < 400

    Then

    Change attribute game.othernumber = 7

    (So essentially its saying, if the generated number is bigger than 350, and smaller than 400 then make the othernumber attribute = 7.
  • pjnolenpjnolen Member Posts: 152
    ahha! dammit why didn't i think of that. I keep forgetting you can do multiple items inside a rule. Thanks Storm!
  • anithmukanithmuk Member Posts: 235
    Hey, I was wondering something similar, but kind of the opposite. For example when the game recognises the number 7 it will record it as any number from 350-400. Any help?
  • pjnolenpjnolen Member Posts: 152
    i guess from that point have an attribute modified to 7, and when it is, record that with a 'change attribute' to and use the rand option and i think you can put the 2 numbers 350-400 inside the brackets listed for rand
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Try change attribute to Random(100,500)

    Make sure the attribute you are working with if you want it to include decimals
Sign In or Register to comment.