So, I have this script that when the player is within a certain distance it displays a message saying "Enter Passcode-" and then adds the numbers as you push them and restarts if you press the wrong button. But, it doesn't work so I was wondering if someone could please take a look at it. Thanks!
;Artificial Intelligence Script
;Header
desc = Passcode
;Triggers
:state=0:state=1
:state=1,plrdistwithin=50:fpgcrawtextsize=20,fpgcrawtextfont=arial,fpgcrawtextr=200,fpgcrawtextg=200,fpgcrawtextb=200,fpgcrawtextx=50,fpgcrawtexty=80,fpgcrawtext=Enter Passcode-,state=5
:state=1,plrdistfurther=50:fpgcrawtextoff
:state=5,plrdistwithin=50,scancodekeypressed=71:state=0
:state=5,plrdistwithin=50,scancodekeypressed=72:state=0
:state=5,plrdistwithin=50,scancodekeypressed=73:state=0
:state=5,plrdistwithin=50,scancodekeypressed=74:state=0
:state=5,plrdistwithin=50,scancodekeypressed=75:state=0
:state=5,plrdistwithin=50,scancodekeypressed=76:state=0
:state=5,plrdistwithin=50,scancodekeypressed=77:state=0
:state=5,plrdistwithin=50,scancodekeypressed=78:state=0
:state=5,plrdistwithin=50,scancodekeypressed=79:state=6,sound=audiobank\switches\press.wav,fpgcrawtext=Enter Passcode-1
:state=5,plrdistwithin=50,scancodekeypressed=80:state=0
:state=5,plrdistwithin=50,scancodekeypressed=81:state=0
:state=5,plrdistwithin=50,scancodekeypressed=82:state=0
:state=6,plrdistwithin=50,scancodekeypressed=71:state=0
:state=6,plrdistwithin=50,scancodekeypressed=72:state=0
:state=6,plrdistwithin=50,scancodekeypressed=73:state=0
:state=6,plrdistwithin=50,scancodekeypressed=74:state=0
:state=6,plrdistwithin=50,scancodekeypressed=75:state=0
:state=6,plrdistwithin=50,scancodekeypressed=76:state=7,sound=audiobank\switches\press.wav,fpgcrawtext=Enter Passcode-15
:state=6,plrdistwithin=50,scancodekeypressed=77:state=0
:state=6,plrdistwithin=50,scancodekeypressed=78:state=0
:state=6,plrdistwithin=50,scancodekeypressed=79:state=0
:state=6,plrdistwithin=50,scancodekeypressed=80:state=0
:state=6,plrdistwithin=50,scancodekeypressed=81:state=0
:state=6,plrdistwithin=50,scancodekeypressed=82:state=0
:state=7,plrdistwithin=50,scancodekeypressed=71:state=0
:state=7,plrdistwithin=50,scancodekeypressed=72:state=0
:state=7,plrdistwithin=50,scancodekeypressed=73:state=0
:state=7,plrdistwithin=50,scancodekeypressed=74:state=0
:state=7,plrdistwithin=50,scancodekeypressed=75:state=0
:state=7,plrdistwithin=50,scancodekeypressed=76:state=0
:state=7,plrdistwithin=50,scancodekeypressed=77:state=8,sound=audiobank\switches\press.wav,fpgcrawtext=Enter Passcode-156
:state=7,plrdistwithin=50,scancodekeypressed=78:state=0
:state=7,plrdistwithin=50,scancodekeypressed=79:state=0
:state=7,plrdistwithin=50,scancodekeypressed=80:state=0
:state=7,plrdistwithin=50,scancodekeypressed=81:state=0
:state=7,plrdistwithin=50,scancodekeypressed=82:state=0
:state=8,plrdistwithin=50,scancodekeypressed=71:state=0
:state=8,plrdistwithin=50,scancodekeypressed=72:state=0
:state=8,plrdistwithin=50,scancodekeypressed=73:state=0
:state=8,plrdistwithin=50,scancodekeypressed=74:state=0
:state=8,plrdistwithin=50,scancodekeypressed=75:state=0
:state=8,plrdistwithin=50,scancodekeypressed=76:state=0
:state=8,plrdistwithin=50,scancodekeypressed=77:state=0
:state=8,plrdistwithin=50,scancodekeypressed=78:state=0
:state=8,plrdistwithin=50,scancodekeypressed=79:state=0
:state=8,plrdistwithin=50,scancodekeypressed=80:state=0
:state=8,plrdistwithin=50,scancodekeypressed=81:state=9,sound=audiobank\switches\press.wav,fpgcrawtext=Enter Passcode-1563
:state=8,plrdistwithin=50,scancodekeypressed=82:state=0
:state=9,plrusingaction=1:state=10
:state=10:activateifused=1,alttexture=1,state=11
:state=11:sound=$1,state=0
;End of Script