Advertisement
AFRLme

Button Mash [VS] (works)

Dec 19th, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. -- this script uses an integer value variable; in which we add +1 to the count each time we press "x" key ...
  2. -- this will only work when we set a certain condition to true so that we can control when we can add to the count ...
  3. -- besides after we have checked the total count to decide which action to perform we want to be able to reset it back to "0" so we can use it again!
  4.  
  5. local count = 0 -- integer variable we will be incrementing by +1 each keypress of "x"!
  6. local move_bar = getObject('Characters[Protagonist].CharacterActions[increment_bar]')
  7. local reset_bar = getObject('Characters[Protagonist].CharacterActions[reset_bar]')
  8. local playSound_success = getObject('Characters[Protagonist].CharacterActions[play_success]')
  9. local playSound_failed = getObject('Characters[Protagonist].CharacterActions[play_failed]')
  10.  
  11. -- * adds +1 to the total count value * --
  12. function rapid_add()
  13.  if count < 100 then
  14.   count = count +1
  15.   startAction(move_bar) -- calls the action added to character "Protagonist" which increments the bar image position up by +4 each time we click the "x" key!
  16.  else
  17.  count = count +1
  18.  end
  19. end
  20.  
  21. -- * checks the total value of count to see whether we achieved the value we were after or not + then performs an action based on  < / > than total value! * --
  22. function rapid_check()
  23.  if count < 75 then
  24.   startAction(playSound_failed)
  25.   print('-- * --')
  26.   print('epic fail!')
  27.   print('you only managed to mash the button ' .. count .. ' times in the alloted time limit!')
  28.  else
  29.   startAction(playSound_success)
  30.   print('-- * --')
  31.   print('grand success!')
  32.   print('you managed to mash the button ' .. count .. ' times in the alloted time limit!')
  33.  end
  34. end
  35.  
  36. -- * resets the count variable back to zero * --
  37. function rapid_reset()
  38.   count = 0
  39.   startAction(reset_bar) -- as mentioned above; resets bar image back to default position!
  40.   print('count has been reset!')
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement