(17/17)*100 should = 100, correct?

NklrcadeNklrcade Member, PRO Posts: 95
Ranking and score work great on my MacBook, but I continue to have mathematical issues on iPad.

At the end of my level I have a 'Change Attribute: self.Moves To:(17/game.Moves)*100'

I used Display Text to make sure and 'game.Moves' does equal 17, so (17/17)*100 should equal 100% but shows up as 89.47% on my iPad.

Can't find the bug, because sometimes 'self.Moves' will equal 100%.

Any ideas??








Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    At the end of my level I have a 'Change Attribute: self.Moves To:(17/game.Moves)*100'

    . . . shows up as 89.47% on my iPad.

    Can't find the bug, because sometimes 'self.Moves' will equal 100%.

    Any ideas??

    Somehow two extra self.Moves/game.Moves (either) are slipping in somewhere (or self.Move and game.Move are individually being incremented by +1 each).

    (17/19)*100 = 89.47 (...)

    It would be useful to see your rules, but without seeing them I suspect (a guess) the answer might be to place a timer (as a delay) somewhere in your rules to allow some calculation to happen (and display) before the 'moves' value creeps forward a little.*
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    Hi @Nklrcade Odd that it should be happening; good advice from @Socks...

    As far as I know, mathematical equations are the most watertight there is in GSC and there's not really anything that can go wrong...

    The result 89.47 is when self.Moves = 19, so the attribute must be picking up an extra 2 from somewhere, sometime....

    Another thing to try, which shouldn't make any difference at all, but perhaps worth a try, is to add another pair of brackets:

    Change Attribute self.Moves To ((17/game.Moves)*100)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • NklrcadeNklrcade Member, PRO Posts: 95
    Thanks for the advice..

    I added a timer (as a delay) and additional brackets but no luck.

    I do have a bit of animation running at the same time... do you think this could be the reason for the 'slip'?? Is there a way to find out when it adds the extra 2? It's hard to tell due to the fact that Display Text 'game.Moves' still reads 17.





  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited February 2013

    I do have a bit of animation running at the same time... do you think this could be the reason for the 'slip'?? Is there a way to find out when it adds the extra 2? It's hard to tell due to the fact that Display Text 'game.Moves' still reads 17.
    Bit of a head scratcher, this one....

    So perhaps a bit more info might help: what are you using game.Moves for? And does this attribute's value start out as 17? And what else is happening in the Rule when you use the equation?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited February 2013
    "Screenshots you will post and answers you will find." - Yoda

    @Nklrcade There are definitely ways to find out when this is happening. Besides DisplayText, which is helpful but is a constrained attribute, you can use Log Debugging Statements at various points in your rules to see exactly where (if you like, even add ..game.Time to see the time) things are changing value.

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

  • NklrcadeNklrcade Member, PRO Posts: 95
    game.Moves are the amount of clicks it takes you to solve the puzzle. 17 is the expected amount of moves you should need.

    Once you solve the puzzle then game.CheckWin = true.

    Once game.CheckWin = true, the results actor is activated - after .05 seconds Change Attribute self.Moves To ((17/game.Moves)*100)

    The rules i've set up work every time when played on my MacBook and the Log Debugger confirms the proper coding, but 'slip' once played on my iPad.

    Will the Log Debugger work from my iPad??
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    No, the log debugger will not work on a device. You can set up similar debugging other ways (e.g. concatenating values onto a text attribute and then displaying them on an actor) but it may just be easier to post your rules here (sorry, writing them out is just not the same especially when you summarize them instead of write them verbatim).

    If you'd like, you can send me a link to download the project file (first compress it as a .zip file) and I'll take a look.

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

  • NklrcadeNklrcade Member, PRO Posts: 95
    well, i decided to put text attributes to follow each actor as they fell into place. i also used tables to make sure it gave me all 720 possible combinations. For one of the combinations a game piece overlapped another by 3 pixels, so when pressed in just the right spot it added +2 to game.Moves instead of +1.

    thanks for pushing me into finding the problem. i appreciate your help.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Ah, makes sense. Glad you found the answer!

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

  • SocksSocks London, UK.Member Posts: 12,822
    well, i decided to put text attributes to follow each actor as they fell into place. i also used tables to make sure it gave me all 720 possible combinations. For one of the combinations a game piece overlapped another by 3 pixels, so when pressed in just the right spot it added +2 to game.Moves instead of +1.

    Ah! The classic sausage fingers issue !
Sign In or Register to comment.