Controlled input by Brux16th Jan 2015 12:57
|
---|
Summary Controlled input Easy.Simple. Description Controlled input Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com Rem ****************************************** Rem * * Rem * Cointrolled input * Rem * * Rem * By Ermanno (Italy) * Rem ****************************************** load sound "type.wav",1 load image "gameover.bmp",5 paste image 5,50,200 flagger=1 _IMPUT: stringa$="" lu=0 pox=0 if flagger=1 a$="abcdefghilmnopqrstuvz1234567890! "+chr$(8)+chr$(13) maxchar=30 char=0 le=len(a$) endif if flagger=2 a$="0123456789 "+chr$(8)+chr$(13) maxchar=9 char=0 le=len(a$) endif if flagger=3 a$="ABCDEFGHILMNOPQRSTUVWXYZ ."+chr$(8)+chr$(13) maxchar=15 char=0 le=len(a$) endif inizio: flag=0 repeat d$=inkey$() c=asc(d$) until d$>"" for i=1 to le for b=1 to le if d$=mid$(a$,i) then flag=i next b next i if flag=0 then attendi(): goto inizio if c=8 lu=len(stringa$) if lu>0 pox=pox-8 : dec char:dec lu stringa$=left$(stringa$,lu) ink 0,0 box pox+8,22+yy,pox+16,36+yy goto _print else attendi() goto inizio endif endif if c=13 then goto finito char=char+1 if char=<maxchar pox=pox+8:stringa$=stringa$+d$ else dec char attendi() goto inizio endif Rem Type your string _print: ink rgb(255,255,255),0 play sound 1 text pox,20+yy,d$ : attendi() : goto inizio Rem shows what you wrote finito: text 10,400+yy, "You wrote: "+stringa$ wait key inc flagger inc yy,12 if flagger<4 then goto _IMPUT end function attendi wait 10 while inkey$()<>"":endwhile endfunction |