;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[@Scratch]
{
#ACT
LoadValue A7 [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [LastWinner]
LoadValue D7 [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [Cash]
LoadValue D8 [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [LastPrize]
LoadValue A6 [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [HighestWinner]
LoadValue D6 [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [HighestPrize]
#SAY
The Last Winner was  {FCOLOR/10}<$OUTPUT(A7)>{FCOLOR/12}\
With a prize of  {FCOLOR/10}<$OUTPUT(D8)>{FCOLOR/12}  Gold\\
The Current Prize fund is  {FCOLOR/10}<$OUTPUT(D7)>{FCOLOR/12}\
Do you want to have a go at the Mir Scratch Card?\\
  <[ Sure Do ]/@Scratch1>\
  <[ Gambler Main Menu ]/@Main>\
  <[ Exit ]/@exit>\\
Biggest Winner so far is {FCOLOR/10}<$OUTPUT(A6)>{FCOLOR/12} with {FCOLOR/10}<$OUTPUT(D6)>{FCOLOR/12}\\\
[@Scratch1]
#SAY
It is a very simple game to play\
Simply Guess the correct Number (from 5)\
4 Times on the trot to win the prize fund!\\
Scratch Cards costs 10000 Gold\
All gold gets added to the Prize fund\
Winner Takes All!!\\
  <[ Purchase Ticket ]/@Scratch2>\
  <[ Gambler Main Menu ]/@Main>\
  <[ Exit ]/@exit>\\\

[@Scratch2]
#IF
CHECKGOLD 10000
#ACT
TAKE GOLD 10000
LoadValue D7 [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [Cash]
INC   D7  10000
SaveValue [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [Cash] %D7
goto @Scratch3
#ELSESAY
  You do not have 10000 Gold! Do not try to cheat me!\
  <[ Gambler Main Menu ]/@Main>\
  <[ Exit ]/@exit>\\\

[@Scratch3]
#ACT
movr D0   5
inc  D0   1
#IF
ISADMIN
#SAY
<$OUTPUT(D0)>\
#IF
#SAY
Round 1\
<[ 1 ]/@Scratch4(1)> <[ 2 ]/@Scratch4(2)> <[ 3 ]/@Scratch4(3)> <[ 4 ]/@Scratch4(4)> <[ 5 ]/@Scratch4(5)>\

[@Scratch4()]
#ACT
MOV   D1   %ARG(1)
#IF
EQUAL  D0   %D1
#SAY
Excellent! You are through Round 1!\
<[ Proceed to Round 2 ]/@Scratch5>\\\
#ELSESAY
Sorry, you guessed incorrectly\
  <[ Play Again ]/@Scratch>\
  <[ Gambler Main Menu ]/@Main>\
  <[ Exit ]/@exit>\\\

[@Scratch5]
#ACT
movr D0   5
inc  D0   1
#IF
ISADMIN
#SAY
<$OUTPUT(D0)>\
#IF
#SAY
Round 2\
<[ 1 ]/@Scratch6(1)> <[ 2 ]/@Scratch6(2)> <[ 3 ]/@Scratch6(3)> <[ 4 ]/@Scratch6(4)> <[ 5 ]/@Scratch6(5)>\

[@Scratch6()]
#ACT
MOV   D1   %ARG(1)
#IF
EQUAL  D0   %D1
#SAY
Excellent! You are through Round 2!\
  <[ Proceed to Round 3 ]/@Scratch7>\\\
#ELSESAY
Sorry, you guessed incorrectly\
  <[ Play Again ]/@Scratch>\
  <[ Gambler Main Menu ]/@Main>\
  <[ Exit ]/@exit>\\\

[@Scratch7]
#ACT
movr D0   5
inc  D0   1
#IF
ISADMIN
#SAY
<$OUTPUT(D0)>\
#IF
#SAY
Round 3\
<[ 1 ]/@Scratch8(1)> <[ 2 ]/@Scratch8(2)> <[ 3 ]/@Scratch8(3)> <[ 4 ]/@Scratch8(4)> <[ 5 ]/@Scratch8(5)>\

[@Scratch8()]
#ACT
MOV   D1   %ARG(1)
#IF
EQUAL  D0   %D1
#SAY
Excellent! You are through Round 3!\
<Proceed to Round 4/@Scratch9>\\\
#ELSESAY
Sorry, you guessed incorrectly\
  <[ Play Again ]/@Scratch>\
  <[ Gambler Main Menu ]/@Main>\
  <[ Exit ]/@exit>\\\

[@Scratch9]
#ACT
movr D0   5
inc  D0   1
#IF
ISADMIN
#SAY
<$OUTPUT(D0)>\
#IF
#SAY
Round 4 - Final Round!\
<[ 1 ]/@Scratch10(1)> <[ 2 ]/@Scratch10(2)> <[ 3 ]/@Scratch10(3)> <[ 4 ]/@Scratch10(4)> <[ 5 ]/@Scratch10(5)>\

[@Scratch10()]
#ACT
MOV   D1   %ARG(1)
#IF
EQUAL  D0   %D1
#SAY
You did it!!!!\
You won have {FCOLOR/10}<$OUTPUT(D7)>{FCOLOR/12}\
  <[ Gambler Main Menu ]/@Main>\\
  <[ Exit ]/@exit>\\\
#ACT
mov  A8   ""
AddStr A8 %UserName
AddStr A8 " Has won the Scratch Card Jackpot of "
AddStr A8 %D7
Give Gold %D7
SaveValue [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [LastPrize] %D7
SaveValue [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [Cash] 50000
SaveValue [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [LastWinner] %USERNAME
EventMsg Grobal %A8
Goto @CheckHighScratch
#ELSESAY
Sorry, you guessed incorrectly\
  <[ Play Again ]/@Scratch>\
  <[ Gambler Main Menu ]/@Main>\\
  <[ Exit ]/@exit>\\\

[@CheckHighScratch]
#IF
Large  D7  %D6
#ACT
SaveValue [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [HighestPrize] %D7
SaveValue [QuestDiary/Gambler/ScratchCardVariables.txt] [Convert] [HighestWinner] %USERNAME

}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;