34 lines
899 B
Plaintext
34 lines
899 B
Plaintext
alias 24 {
|
|
dialog -m 24-Game 24-Game
|
|
}
|
|
|
|
dialog 24-Game {
|
|
title "24-Game"
|
|
size -1 -1 100 70
|
|
option dbu
|
|
text "", 1, 29 7 42 8
|
|
text "Equation", 2, 20 21 21 8
|
|
edit "", 3, 45 20 40 10
|
|
text "Status", 4, 10 34 80 8, center
|
|
button "Calculate", 5, 5 45 40 20
|
|
button "New", 6, 57 47 35 15
|
|
}
|
|
|
|
on *:DIALOG:24-Game:init:*: {
|
|
did -o 24-Game 1 1 Numbers: $rand(1,9) $rand(1,9) $rand(1,9) $rand(1,9)
|
|
}
|
|
|
|
on *:DIALOG:24-Game:sclick:*: {
|
|
if ($did == 5) {
|
|
if ($regex($did(3),/^[ (]*\d *[-+*/][ (]*\d[ ()]*[-+*/][ ()]*\d[ )]*[-+*/] *\d[ )]*$/)) && ($sorttok($regsubex($did(3),/[^\d]+/g,$chr(32)),32) == $sorttok($remove($did(1),Numbers:),32)) {
|
|
did -o 24-Game 4 1 $iif($calc($did(3)) == 24,Correct,Wrong)
|
|
}
|
|
else {
|
|
did -o 24-Game 4 1 Wrong Numbers or Syntax
|
|
}
|
|
}
|
|
elseif ($did == 6) {
|
|
did -o 24-Game 1 1 Numbers: $rand(1,9) $rand(1,9) $rand(1,9) $rand(1,9)
|
|
}
|
|
}
|