Iyonix Select Acorn RISCOS 4 Home About Toolbox Examples Maillist Downloads
AppBasic

Toolbar


General
Hello world 1
Hello world 2
Min app
Bin
Window
Slot machine
Drawing
Colour menu
Drawing
Clock

Slot machine

Simulates an arcade slot machine

You can download the application from here.
  1. Make a new ‘Window application’
  2. Add the client-side sprites
    Client-side sprites are stored in a sprite file named “Sprites” placed in the application's main directory. They will be automatically loaded by the Toolbox.
    sprites/gif
  3. Edit the window template
    1. Add an ‘action button’ gadget
    2. slot/gif

      Add three button gadgets. The gadgets should be client-side sprites.
      button/gif
      A button's edit dbox is opened by double-clicking its representation in the ResEd display
  4. Insert a ‘Window’ event handler
    • Amend the code to
      DEF PROCDealWith_Window(event,object,component)
      CASE event OF
      WHEN ActionButton_Selected : PROCRoll(object)
      ENDCASE
      ENDPROC

      DEF PROCRoll(object)
      LOCAL n%,a%,b%,c%
      a%=RND(2000) : b%=RND(2000) : c%=RND(2000)
      REPEAT
      IF n%<a% THEN PROCIncreaseDigit(object,0)
      IF n%<b% THEN PROCIncreaseDigit(object,1)
      IF n%<c% THEN PROCIncreaseDigit(object,2)
      n%+=1
      UNTIL n%>a% AND n%>b% AND n%>c%
      ENDPROC

      DEF PROCIncreaseDigit(object,component)
      LOCAL x$
      PROCButton_GetValue(object,component,x$)
      PROCButton_SetValue(object,component,STR$((1+VAL(x$))MOD10))
      ENDPROC