home *** CD-ROM | disk | FTP | other *** search
- /* */
- options results
- here = pragma('D','ram:')
- there = pragma('D',here)
- address command 'cd '|| here||'0a'x||'stack 20000'||'0a'x|| 'c:run >nil: tbuildscreen numbers.dat nil:'
-
- address command 'waitforport xxxport'||'0a'x|| 'waitforport xxxport'
- address command 'waitforport xxxport'||'0a'x|| 'waitforport xxxport'
- call problem
-
- got = 0
- do forever
- address 'xxxport' 'RWAIT' /* wait for user to do something */
- a = RESULT
- parse var a action p2 p3 p4 p5 p6 . /* parse response from buildscreen */
-
- /* say 'here is the result "'|| a ||'"' */
-
- if action = "" then do /* this is a menu null (rmb down no select ) */
- address 'xxxport' 'fillbox wname8 199 190 10 7 2 3'
- say 'menu null'
- end
- if action = "C" then do /* close box hit */
- say 'window closed'
- leave
- end
-
- if action = "K" then do /* raw keystroke */
-
- qual = p4
- code = p5
- xxx = "code = "||"c2d('"||p5||"'X)";interpret xxx /* convert hex to number */
- xxx = "qual = "||"c2d('"||p4||"'X)";interpret xxx /* convert hex to number */
- if code < 128 then do
- call liveone
- end
- end
- if action = "P" then do /* pointer button up or down */
- x = p2
- y = p3
- xxx = "code = "||"c2d('"||p5||"'X)";interpret xxx /* convert hex to number */
-
- if code < 128 then do
- say 'point down at ' x ' ' y
- end
- end
- end
- /*
- if action = "G" then do /* gadget hit */
-
- end
- if action = "M" then do /* menu op */
-
- say 'Menu checked=' p2 ' menu# ' p3 ' item ' p4 ' sub item ' p5
- end
-
- */
-
- exit
-
-
-
- problem:
- a1 = random(0,9,time(seconds))
- a2 = random(1,4)
- b1 = random(0,9)
- b2 = random(1,4)
- ans = a2*10 + a1 + b2*10 + b1
-
- tens = 0
- ones = 0
-
-
- address 'xxxport' 'drawimage wname p'||a2|| ' 110 50'
- address 'xxxport' 'drawimage wname p'||a1|| ' 160 50'
- address 'xxxport' 'drawimage wname p'||b2|| ' 110 120'
- address 'xxxport' 'drawimage wname p'||b1|| ' 160 120'
- address 'xxxport' 'drawimage wname plus 60 127'
- address 'xxxport' 'drawimage wname min 101 180'
- address 'xxxport' 'blit wname 114 200 wname 132 200 25 10 192'
- address 'xxxport' 'blit wname 114 200 wname 151 200 25 10 192'
- address 'xxxport' 'blit wname 114 200 wname 170 200 25 10 192'
-
- return
-
- liveone:
-
- /* say 'down keystroke = (' p4 p5 ') = (' qual code ')' */
- if code = 10 then do
- code = 0
- end
- if code = 65 then do /* backspace */
- call backspace
- end
- if (code >= 0) & (code <= 9) then do
- if got = 0 then do
- xx = 160 ; yy = 210 /* coords of first number */
- got = 1
- ones = code
- end
- else do
- xx = 110 ; yy = 210 /* second number */
- got = 2
- tens = code
- end
-
- address 'xxxport' 'drawimage wname p'||code xx yy
- end
- if code = 68 then do
- call cr
- end
- return
-
- backspace:
- if got = 1 then do
- got = 0 /* erase first number on right */
- address 'xxxport' 'blit wname 240 220 wname 152 214 50 70 192'
-
- end
- else if got = 2 then do
- got = 1 /* erase second number on right */
- address 'xxxport' 'blit wname 240 220 wname 110 214 50 70 192'
-
- end
-
- return
-
- cr:
- product = tens*10+ones
- if product = ans then do
- /* address 'xxxport' 'fillbox wname 0 0 100 100 0 0' */
- address 'xxxport' 'drawimage wname right 0 0'
-
- call delay(100)
- address 'xxxport' 'fillbox wname 0 0 250 280 0 0'
-
- call rollem
-
- address 'xxxport' 'fillbox wname 0 0 250 280 0 0'
-
- got = 0
- call problem
- end
- else do
- address 'xxxport' 'fillbox wname 0 0 100 100 0 0'
- address 'xxxport' 'drawimage wname try 0 0'
- end
-
- return
-
- rollem:
- k = -110
- do i = 9 to 0 by -1
- address 'xxxport' 'drawimage wname p'||i 110 210+k
- k = k + 11
- l = -100
- do j = 9 to 0 by -1
- address 'xxxport' 'drawimage wname p'||j 160 210+l
- l = l + 10
- end
- end
- address 'xxxport' 'drawimage wname min 160 210'
- address 'xxxport' 'drawimage wname min 110 210'
- address 'xxxport' 'fillbox wname 78 222 180 80 0 0'
-