Sync On:Sync Rate 60:Autocam Off Type parser word as string id as integer Endtype #Constant MaxVerbs=20 #Constant MaxNouns=20 Dim verbs(MaxVerbs) as parser Dim nouns(MaxNouns) as parser Dim Objects(500) Global txt as string Global verb as parser Global noun as parser Global Object_Count as Integer Object_Count=0 Restore D_Verbs For i = 1 to MaxVerbs Read w$ if w$="last999" then Exit read v verbs(i).word=w$:verbs(i).id=v Next i Restore D_Nouns For i = 1 to MaxVerbs Read w$ if w$="last999" then Exit read v nouns(i).word=w$:nouns(i).id=v Next i Make Object Cube 1,10 Hide Object 1 Make Object Sphere 2,10 Hide Object 2 Make Object Cylinder 3,10 Hide Object 3 Make Object Plain 4,10,10 Hide Object 4 Set Cursor 0,0 Print "Commands are basic object commands." Print "Use a verb and a noun and an object designation." Print "Example: 'Make a sphere number 20" Print "Example: 'Object 15, turn left." Sync Wait key Do Set Cursor 0,0 Input "Enter command: ",txt Sync C_Parser() Label_Objects() Loop Function C_Parser() Find_Verb(txt) Find_Noun(txt) o=Get_Number(txt) o=o+10 Select verb.id Case 1:Make_Object(o):Endcase Case 2:Move_Object(o):EndCase Case 3,4:Object_Size(o):Endcase Case 5,6:Turn_Object(o):Endcase Endselect Endfunction Function Label_Objects() For i = 10 to 510 If Object Exist(i) i$="# "+str$(i-10) Center Text Object Screen X(i),Object Screen Y(i)-20,i$ Endif Next i Endfunction Function Make_Object(obj) source=noun.id If Object Exist(obj) Then Delete Object obj Clone Object obj,source Show Object obj Position Object obj,0,-5,30 Endfunction Function Move_Object(obj) If Object Exist(obj) Then Move Object obj,1 EndFunction Function Object_Size(obj) If verb.id=3 then size=80 else size=120 If Object Exist(obj) Then Scale Object obj,size,size,size Endfunction Function Turn_Object(obj) If verb.id=5 then direction=-20 else direction=20 If Object Exist(obj) Then Turn Object Right obj,direction Endfunction Function Find_Verb(t$) verb.word="":verb.id=0 v=0 For i = 1 to MaxVerbs If Find_Text(Verbs(i).word,t$) verb.word=Verbs(i).word verb.id=Verbs(i).id Exit Endif Next i Endfunction Function Find_Noun(t$) Noun.word="":Noun.id=0 v=0 For i = 1 to MaxNouns If Find_Text(Nouns(i).word,t$) Noun.word=Nouns(i).word Noun.id=Nouns(i).id Exit Endif Next i Endfunction Function Find_Text(text$, in_text$) text$=Lower$(text$):in_text$=Lower$(in_text$) L1=Len(text$) L2=Len(in_text$) e=L2-L1 f=0 For i = 0 to e test$=Left$(Right$(in_text$,L2-i),L1) if text$=test$ then f=i+1:Exit Next i Endfunction f Function Get_Number(t$) L1=Len(t$) num$="" For i = 1 to L1 If Val(Mid$(t$,i))>0 Or Mid$(t$,i)="0" If i>1 If mid$(t$,i-1)="-" Then num$=num$+"-" Endif num$=num$+Mid$(t$,i) Endif Next i n=val(num$) Endfunction n D_Verbs: Data "create",1 data "make",1 Data "forward",2 Data "move",2 Data "shrink",3 Data "expand",4 Data "grow",4 Data "turn left",5 data "turn right",6 Data "last999",999 D_Nouns: Data "cube",1 Data "box",1 Data "sphere",2 Data "cylinder",3 Data "plain",4 Data "last999",999