Rem * Title : GuardPro
Rem * Author : Nicholas Aldwin
sync on : sync rate 0
rem Main loop
mainl:
do
rem User prompt buttons
ink rgb(255,255,0),0 : set text size 50
center text 320,80,"GuardPro 1.1"
if lock=0 then lc$="Lock Computer"
if lock=1 then lc$="Unlock Computer"
rem Status prompt
ink 0,0 : box 0,140,639,479
ink rgb(0,255,0),0 : set text size 12
select stat
case 0 : center text 320,140,"Welcome" : endcase
case 1 : center text 320,140,"Computer Locked" : endcase
case 2 : center text 320,140,"Computer Not Locked" : endcase
case 3 : center text 320,140,"Bye" : endcase
case default : center text 320,140,"NOUT" : endcase
endselect
rem Show and operate buttons
buttonselected=0
if makebutton(110,240,lc$)>0 then buttonselected=1
if makebutton(320,240,"See Credits")>0 then buttonselected=2
if lock=0
if makebutton(530,240,"Exit")>0 then buttonselected=3
endif
rem Detect button selection
if buttonselected=1
goto lock
endif
if buttonselected=2
goto credits
endif
if buttonselected=3
goto exit
endif
rem Update screen
sync
rem End loop
loop
lock:
ink rgb(0,255,0),0 : set text size 12
if cp=0
cls
print "Create a password:"
input createpass$
print "Password stored."
sleep 1000
print "Computer Locked."
cp=1
lock=1
stat=1
disable escapekey
disable systemkeys
sleep 1000
cls
goto mainl
else
if lock=0
cls
print "Computer Locked."
lock=1
stat=1
disable escapekey
disable systemkeys
sleep 1000
cls
goto mainl
endif
if lock=1
cls
print "Enter password:"
input pass$
if pass$=createpass$
print "Computer unlocked."
enable escapekey
enable systemkeys
lock=0
stat=2
sleep 1000
cls
goto mainl
else
print "Incorrect password-try again."
sleep 1000
cls
goto lock
endif
endif
endif
credits:
cls
ink rgb(0,255,0),0 : set text size 12
print "---------------------------------CREDITS---------------------------------"
print ""
print "Program by Nick Aldwin"
print "Some part of the code was taken from other sources"
print "Press any key to exit"
suspend for key
cls
goto mainl
exit:
stat=3
sleep 1000
exit prompt "GuardPro", "Thanks for using GuardPro!"
end
function makebutton(x,y,desc$)
buttonpressed=0
ink rgb(0,255,0),0 : box x-102,y-34,x+102,y+34
ink rgb(0,128,0),0 : box x-100,y-32,x+100,y+32
ink rgb(55,55,0),0
myx=mousex() : myy=mousey()
if myx>x-100 and myx<x+100
if myy>y-32 and myy<y+32
buttonpressed=1
endif
endif
if buttonpressed=1 then ink rgb(255,255,0),0
set text size 18 : center text x,y-8,desc$
if mouseclick()=0 then buttonpressed=0
endfunction buttonpressed
There you go.
END TRANSMISSION