Sub domsg
mtxx="Turtle commander V1.1"+_nln +"(p)2015 by SB community"
If Text.StartsWith(args[1],"$") Then
mtxx=text.GetSubTextToEnd(args[1],2)
Endif
LDDialogs.Wait(mtxx,"Green")
Program.Delay(2500)
LDDialogs.EndWait ()
EndSub
If mov=1 Then
Turtle.x= GraphicsWindow.MouseX
Turtle.y=GraphicsWindow.MouseY
mov=0
elseif rec=1 and nxt=1 Then
nxt=0
'cang()
ota=turtle.angle
Turtle.Angle=Turtle.Angle+aag
If Turtle.Angle>180 then
Turtle.Angle=Turtle.Angle-360
elseif Turtle.Angle<-180 then
Turtle.Angle=Turtle.Angle+360
endif
nta=turtle.angle
dta=nta-ota
dst=0' Math.SquareRoot ( ESLMaths.Square (GraphicsWindow.MouseX - Turtle.x)+ESLMaths.Square (GraphicsWindow.Mousey - Turtle.y))
dst=math.Round (dst)
Turtle.Move (dst)
dd="R "
If dta<0 then
dd="L "
endif
'TextWindow.WriteLine (aag)
'Clipboard.SetText(cr+dd+Math.Abs(dta)+cr+"F "+dst)
LDFocus.SetFocus(pgm)
' aw = SPExtra.SendKeys("+{INS}")
EndIf
EndSub
Sub findvar
ar=Text.ConvertToUpperCase(args[1])
For ax=1 To vcnt
If Text.ConvertToUpperCase(mem[ax][0])=ar Then
return=ax
Goto xxx
endif
EndFor
TextWindow.WriteLine (ar+" VAR-notfnd!")
return="!VARnotfnd!"
xxx:
endsub
Sub rmm
dd= LDDialogs.LastRightClickMenuItem
if dd>0 Then
LDControls .RichTextBoxSetText(pgm, LDText.Replace ( deff[dd],"!",_nln ),"False")
Else
rr=LDDialogs.Confirm("YES-save NO-load CANC=add","Menu Action:" )
If rr="Yes" Then
' The following line could be harmful and has been automatically commented.
' File.WriteContents ("d:\defs.txt",deff)
' The following line could be harmful and has been automatically commented.
' File.WriteContents ("d:\defm.txt",dmt)
LDCall.Function ("DoMsg","$Saved ok.")
elseIf rr="No" Then
' The following line could be harmful and has been automatically commented.
' deff=File.ReadContents ("d:\defs.txt")
' The following line could be harmful and has been automatically commented.
' dmt=File.ReadContents ("d:\defm.txt")
LDCall.Function ("DoMsg","$Load ok.")
LDDialogs.AddRightClickMenu(dmt,"")
else
li= LDText.Split (src,CR)
att=""
For t=1 To Array.GetItemCount (li)
att=att+li[t]+"!"
endfor
tree=LDControls.TreeViewGetData(trr)
deff[dmm]= att
dmt[dmm]=tree[12][11]
dmm=dmm+1
LDDialogs.AddRightClickMenu(dmt,"")
endif
EndIf
EndSub
Sub hshow
txx= LDText.Split("FWD!BCK!<<>>!LOOP!VAR!CNST!SUB!FOR!GRID!Rec!MvTo!IF!EDIT!OPEN!SAVE!NEW","!")
For x=1 To 17
bb[x]= Controls.AddButton(txx[x], 2, 5+(x-1)*40)
EndFor
EndSub
Sub Main
nwwp:
nww=0
tree=""
tree[1][0]="Main"
tree[2][1]="Defs
tree[3][2]="Heading
tree[4][3]="0
tree[5][2]="Bgrnd
tree[6][5]="#bbccdd
tree[7][2]="ForeClr
tree[8][7]="AUTO
tree[9][2]="Width
tree[10][9]="4
tree[11][1]="Con/Vars
tree[12][11]="0
tree[13][1]="Subs/Lps
Turtle.Show()
Turtle.PenUp()
Turtle.MoveTo (700,400)
Turtle.PenDown()
Turtle.Angle=0
GraphicsWindow.FontName = "Lucida Console"
GraphicsWindow.FontSize =12
While "True"
If rst=1 Then
src = LDControls .RichTextBoxGetText (pgm)
tree=LDControls.TreeViewGetData(trr)
bcll =tree[6][5]
rst=0
If nww=1 then
Goto nwwp
else
Goto rrr
endif
elseIf clicked Then
Controls.SetButtonCaption(c1,"STOP")
clicked = "False"
src = LDControls .RichTextBoxGetText(pgm)
If Text.GetSubText(src,1,1)="{" or Text.GetSubText(src,1,1)="#" then
If Text.GetSubText(src,1,1)="#" then
dbg="True"
Else
dbg="False"
endif
line= LDText.Split (src,_nln )
rrw= ( text.GetSubTextToEnd(line[1],2))'tonum!
nLines =Array.GetItemCount (line)
If dbg then
TextWindow.WriteLine (">>>>>>>>>>>>>>>>>>>>>runn>>>>>>>>>>>>>>>>>>")
endif
GraphicsWindow.Title="Run mode..."
tree=LDControls.TreeViewGetData(trr)
'TextWindow.WriteLine(tree)
GraphicsWindow.PenWidth=tree[10][9]
'GraphicsWindow.Title=rrw
tree=LDControls.TreeViewGetData(trr)
Turtle.Angle =tree[4][3]
sbscan()
For tt=1 To rrw
vcnt=0
scnt=0
'TextWindow.WriteLine (line)
For i = 2 To rwx
linee=line[i]
If Text.StartsWith(linee,"##") then
Goto finn
elseif Text.StartsWith(linee,"<") then
smd=1
elseif Text.StartsWith(linee,">") then
smd=0
ElseIf smd=0 and stpp=0 then
Sub sbscan
c=1
rwx=nLines
While Text.StartsWith (line[c],"##")<>"True
c=c+1
If c>nLines then
TextWindow.WriteLine("No ##")
goto tt
endif
EndWhile
rwx=c-1
For i=c To nLines
If Text.StartsWith(line[i], "<") Then
_sbc=_sbc+1
smd=1
sbb[_sbc]["Stt"] = i + 1
For k = i+1 To nLines
If Text.StartsWith(line[k], ">") Then
sbb[_sbc]["End"] = k-1
smd=0
endif
endfor
tree=LDControls.TreeViewGetData(trr)
tnd=Array.GetAllIndices(tree)
nc=array.GetItemCount (tnd)+1
If dbg then
typ="Sb"
sbb[_sbc][0]=Text.GetSubTextToEnd (linee, 2)
tree[nc][13]=typ+":"+_sbc+">"+sbb[_sbc]["Stt"]+" to "+sbb[_sbc]["End"]
LDControls.TreeViewContent(trr,tree)
nset()
endif
endif
endfor
tt:
Endsub
Sub nset
LDControls.TreeViewExpand(trr,0,"True","True")
nn= LDText.Split("4,6,8,10,12",",")
For x=1 To Array.GetItemCount(nn)
LDControls.TreeViewEdit(trr,nn[x],"True")
endfor
EndSub
Sub drwgrd
GraphicsWindow.PenWidth=1
GraphicsWindow.PenColor="#aaaaaa
For x=1 To 70
GraphicsWindow.DrawLine(220+x*20,0,220+x*20,800)
EndFor
For x=1 To 40
GraphicsWindow.DrawLine(220,x*20,1400,x*20)
EndFor
nLines =Array.GetItemCount (line)
TextWindow.WriteLine ("{Main loop, repeating times:"+rrw)
For i=2 To nLines
linee=line[i]
If Text.StartsWith(linee,"##") then
TextWindow.WriteLine ("} Main loop end.*******************")
else
xpline()
endif
EndFor
endsub
Sub OnButtonClicked
'"FWD!BCK!<<>>!LOOP!VAR!CNST!sub!FOR!SUB!SAVE!LOAD!IF!HLP!NEW"
clb=Controls.LastClickedButton
If clb=c2 then
rst=1
elseIf clb=c3 then
xplain ()
elseIf clb=c4 then
LDControls.RichTextBoxSetText(pgm,Src,"False")
rst=1
elseif clb=bb[1] then
LDControls.RichTextBoxSetText(pgm,"F ","True")
elseif clb=bb[2] then
LDControls.RichTextBoxSetText(pgm,"R 180"+cr+"F "+cr+"R 180","True")
elseif clb=bb[3] then
LDControls.RichTextBoxSetText(pgm,"L ","True")
elseif clb=bb[4] then
LDControls.RichTextBoxSetText(pgm,"R ","True")
elseif clb=bb[5] then
LDControls.RichTextBoxSetText(pgm,"{1 "+cr+"}","True")
elseif clb=bb[6] then
LDControls.RichTextBoxSetText(pgm,"|v1=1","True")
elseif clb=bb[7] then
LDControls.RichTextBoxSetText(pgm,"%1","True")
elseif clb=bb[8] then
ctx=(cr+""+cr)
LDControls.RichTextBoxSetText(pgm,ctx,"True")
elseif clb=bb[9] then
ctx=(cr+"|f1~1"+cr+"FOR %1;10;+1 ["+cr+"]"+cr)
LDControls.RichTextBoxSetText(pgm,ctx,"True")
elseif clb=bb[10] then
DrwGrd()
elseif clb=bb[11] then
elseif clb=bb[12] then
mov=1
elseif clb=bb[13] then
ctx=(cr+"{IF =%1;n;2 "+cr+"//True"+cr+":$2 "+cr+"//False"+cr)
LDControls.RichTextBoxSetText(pgm,ctx,"True")
elseif clb=bb[14] then
Controls.SetSize(pgm,800, gh - 360)
elseif clb=bb[16] then
fnm=LDDialogs.SaveFile("txt","i:\txt")
li= LDText.Split (src,CR)
att=""
For t=1 To Array.GetItemCount (li)
att=att+li[t]+"!"
endfor
' The following line could be harmful and has been automatically commented.
' ss=File.WriteContents(fnm,att)
LDCall.Function ("DoMsg","$Save "+ss)
elseif clb=bb[15] then
fnm=LDDialogs.OpenFile("txt","i:\txt")
' The following line could be harmful and has been automatically commented.
' If ldFile.Exists(fnm) then
' The following line could be harmful and has been automatically commented.
' fcc=File.ReadContents(fnm)
LDControls.RichTextBoxSetText(pgm,fcc,"False")
endif
elseif clb=c5 then
Helpp()
elseif clb=c6 then
tree=LDControls.TreeViewGetData(trr)
cch=tree[12][11]
If text.GetCharacterCode (cch)>32 then
GraphicsWindow.FontName="Times New Roman"
GraphicsWindow.FontSize=540
GraphicsWindow.FontBold="True
GraphicsWindow.FontItalic="True
GraphicsWindow.BrushColor="#bbbbbb
GraphicsWindow.DrawText(300,150,cch)
endif
elseif clb=bb[17] then
rst=1
nww=1
src="{1"+cr
LDControls .RichTextBoxSetText (pgm, src,"False")
else
clicked = "True"
endif
EndSub
Sub DoLine '----------------------------------------------LINEPROC-----------------------------
linee= LDText.Trim (linee)
If linee="" Or Text.StartsWith(linee,"//") Then
Goto exx
endif
If tree[8][7]="AUTO" Then
GraphicsWindow.PenColor=LDColours.HSLtoRGB(math.Remainder (ch,360) ,0.9,0.4)
Else
GraphicsWindow.PenColor=tree[8][7]
endif
ch=ch+1
While Text.IsSubText(linee,"%")
dorepl()
endwhile
ree:
If Text.StartsWith(linee, Text.GetCharacter (34)) Then 'virtual mode
If _inn>0 Then
linee=text.GetSubTextToEnd (linee,2)
Goto ree
Endif
elseIf Text.StartsWith(linee, "|") Then
vn=text.GetSubText(linee,2,2)
vv=text.GetSubTextToEnd (linee,5)
dfc=text.GetSubText(linee,4,1)
If dfc="=" then
vcnt=vcnt+1
mem[vcnt][1]=vv
mem[vcnt][0]=vn
elseif dfc="'" then
rr=ldcall.Function("findvar",vn)
mem[rr][1]=text.GetCharacter (vv)
elseif dfc="." then
pp= (text.GetSubText(linee,5,2))'mathplus.ToNumber
scnt=scnt+1
Matr[scnt]=Text.GetSubTextToEnd ( vv,4)
elseif dfc=";" then
For scnt=1 to Text.GetLength (vv)
Matr[scnt]=Text.GetSubText(vv,scnt,1)
endfor
elseif dfc="+" then
rr=ldcall.Function("findvar",vn)
mem[rr][1]=mem[rr][1]+vv
elseif dfc="~" then
rr=ldcall.Function("findvar",vn)
mem[rr][1]=vv
elseif dfc="*" then
rr=ldcall.Function("findvar",vn)
mem[rr][1]=mem[rr][1]*vv
elseif dfc="/" then
rr=ldcall.Function("findvar",vn)
mem[rr][1]=mem[rr][1]/vv
elseif dfc=":" then
rr=ldcall.Function("findvar",vn)
mem[rr][1]=math.Remainder(mem[rr][1],vv)
endif
ElseIf Text.StartsWith(linee, "~B#") Then 'block wdth
tww= Text.GetSubTextToEnd (linee,4)
ElseIf Text.StartsWith(linee, "WB#") Then 'block txt
ttx= Text.GetSubTextToEnd (linee,4)
ElseIf Text.StartsWith(linee, "W#") Then 'console debug writting
ttx= Text.GetSubTextToEnd (linee,3)
If Text.StartsWith (ttx,"|") then
vn=text.GetSubText(ttx,2,2)
ttx=ldcall.Function("findvar",vn)
Endif
TextWindow.WriteLine(">:"+ttx)
ElseIf Text.StartsWith(linee, "WRT") Then
ttx= Text.GetSubTextToEnd (linee,5)
If Text.StartsWith (ttx,"|") then
vn=text.GetSubText(ttx,2,2)
ttx=ldcall.Function("findvar",vn)
Endif
GraphicsWindow.DrawText(Turtle.x, Turtle.y, ttx)
elseif Text.StartsWith(linee, "F") Then
distance = Text.GetSubTextToEnd(linee, 3)
If Text.StartsWith(distance,"|") Then
rr=ldcall.Function("findvar",vn)
dist=mem[rr][1]
Else
dist=distance
endif
Turtle.Move(math.Floor (dist*sc))
if objm=1 then
obj[oo][1]=Turtle.X
obj[oo][2]=Turtle.Y
oo=oo+1
endif
'GraphicsWindow.Title="Dst:"+math.Round ( dist*sc)
if dbg then
TextWindow.WriteLine(math.Floor (dist*sc))
endif
Elseif Text.StartsWith(linee, "S") Then
If Text.GetSubText(linee,2,1)="/" then
sc=sc/ Text.GetSubTextToEnd(linee, 3)
else
sc=sc* Text.GetSubTextToEnd(linee, 3)
endif
If sc=0 then
sc=1
EndIf
ElseIf Text.StartsWith(linee, "$") Then
tx=Turtle.x
ty=Turtle.Y
ta= Turtle.Angle
ts=sc
_inn=_inn+1
DoLine()
_inn=_inn-1
Endfor
i = Stack.PopValue("locali")+1
j=Stack.PopValue("localj")
ElseIf Text.StartsWith(linee, "&") Then
Turtle.x=tx
Turtle.Y=ty
Turtle.Angle=ta
sc=ts
ElseIf Text.StartsWith(linee, "#X") Then
'FCExtensions.Eval(Text.GetSubTextToEnd(linee, 4))
ElseIf Text.StartsWith(linee, "#E") Then
' mem[1][1]=FCExtensions.MathEval(Text.GetSubTextToEnd(linee, 4))
ElseIf Text.StartsWith(linee, "#F") Then
ff=Text.GetSubTextToEnd(linee, 4)
fn=LDText.Split(ff,";")
GraphicsWindow.FontName=fn[1]
GraphicsWindow.FontBold=_tfl[fn[2]]
GraphicsWindow.FontItalic=_tfl[fn[3]]
GraphicsWindow.FontSize=fn[4]
ElseIf Text.StartsWith(linee, "#P") Then
GraphicsWindow.BrushColor=GraphicsWindow.PenColor
ElseIf Text.StartsWith(linee, "~S") Then
LDQueue.Enqueue("q1",Turtle.x+":"+Turtle.y)
ElseIf Text.StartsWith(linee, "~G") Then
tp=LDQueue.Dequeue ("q1")
tt=LDText.Split(tp,":")
Turtle.x=tt[1]
Turtle.y=tt[2]
ElseIf Text.StartsWith(linee, "#C") Then
ww = ( Text.GetSubTextToEnd(linee, 4))'tonum
GraphicsWindow.BrushColor=GraphicsWindow.PenColor
If ww=0 then
ww=5
endif
GraphicsWindow.FillEllipse(Turtle.x-ww, Turtle.y-ww,ww*2,ww*2)
ElseIf Text.StartsWith(linee, "XC") Then
ww = ( Text.GetSubTextToEnd(linee, 4))'tonum
GraphicsWindow.BrushColor=GraphicsWindow.BackgroundColor
If ww=0 then
ww=5
endif
ElseIf Text.StartsWith(linee, "~") Then
Program.Delay (Text.GetSubTextToEnd(linee, 2))
ElseIf Text.StartsWith(linee, "U") Then
Turtle.PenUp()
ElseIf Text.StartsWith(linee, "D") Then
Turtle.PenDown()
ElseIf Text.StartsWith(linee, "R") Then
distance = Text.GetSubTextToEnd(linee, 3)
If Text.StartsWith(distance,"|") Then
rr=ldcall.Function("findvar",vn)
dist=mem[rr][1]
Else
dist=distance
endif
Turtle.Turn(dist)
ElseIf Text.StartsWith(linee, "L") Then
distance = Text.GetSubTextToEnd(linee, 3)
If Text.StartsWith(distance,"|") Then
rr=ldcall.Function("findvar",vn)
dist=mem[rr][1]
Else
dist=distance
endif
Turtle.Turn(-dist)
ElseIf Text.StartsWith(linee, "A") Then
distance = -Text.GetSubTextToEnd(linee, 3)
If Text.StartsWith(distance,"|") Then
rr=ldcall.Function("findvar",vn)
dist=mem[rr][1]
Else
dist=distance
endif
Turtle.Angle=dist
ElseIf Text.StartsWith(linee, ":$") Then
icc=Text.GetSubTextToEnd (linee, 3)
i=i+icc
ElseIf Text.StartsWith(linee, "IF") Then
icc=Text.GetSubTextToEnd (linee, 4)
iif= LDText.Split(icc,";")
v1=iif[1]
v2=iif[2]
If iif[3]=0 then
skp=2
Else
skp=iif[3]
endif
cond=0
TextWindow.WriteLine ("Sk:"+Skp)
If Text.StartsWith(icc,"=") then
If v1=v2 then
cond=1
Else
cond=2
endif
elseIf Text.StartsWith(icc,">") then
If v1
cond=1
Else
cond=2
endif
elseIf Text.StartsWith(icc,"<") then
If v1>v2 then
cond=1
Else
cond=2
endif
elseIf Text.StartsWith(icc,"!") then
If v1<>v2 then
cond=1
Else
cond=2
endif
endif
If cond=0 then
TextWindow.WriteLine ("IF invalid cond error!")
else
if cond=1 then 'true part
TextWindow.WriteLine ("TRue")
Else 'false part
TextWindow.WriteLine ("Flss")
For k = iStart[_l] To nLines
'TextWindow.WriteLine(">>"+k)
If Text.StartsWith(line[k], "{") Then
nest = nest + 1
ElseIf Text.StartsWith(line[k], "]") or Text.StartsWith(line[k], "}") Then
If nest = 0 Then
iEnd[_l] = k - 1
k= nLines
Else
nest = nest - 1
EndIf
EndIf
EndFor
If dbg then
typ="Lp"
tree[nc][13]=typ+":"+nest+">"+iStart[_l]+" to "+iEnd[_l]
LDControls.TreeViewContent(trr,tree)
nset()
endif
j = count[_l]
_l = _l + 1
While j>0
Stack.PushValue("local", j)
_inn=_inn+1
For i = iStart[_l - 1] To iEnd[_l - 1]
linee=line[i]
If Text.IsSubText (linee,"%$$") Then
linee=LDText.Replace (linee,"%$$",j)
elseIf Text.IsSubText (linee,"%$A") Then
linee=LDText.Replace (linee,"%$A",Turtle.Angle )
elseIf Text.IsSubText (linee,"%$C") Then
linee=LDText.Replace (linee,"%$C",GraphicsWindow.PenColor )
elseIf Text.IsSubText (linee,"%$") Then
linee=LDText.Replace (linee,"%$","%"+ text.GetSubText (_hexx,j,1) )
endif
If dbg then
TextWindow.WriteLine (i+">>"+linee)
endif
Sub dorepl
If Text.IsSubText (linee,"%") Then
aq="!!
If Text.IsSubText(linee,aq) Then
m2=Text.Append("0", mem[2][1])
m2=Text.GetSubTextToEnd (m2,text.GetLength( mem[2][1]))
m3=Text.Append("0", mem[3][1])
m3=Text.GetSubTextToEnd (m3,text.GetLength( mem[3][1]))
endif
If Text.IsSubText (linee,"%1") Then
linee=LDText.Replace (linee,"%1",mem[1][1])
elseIf Text.IsSubText (linee,"%2"+aq) Then
linee=LDText.Replace (linee,"%2"+aq,m2)
elseIf Text.IsSubText (linee,"%3"+aq) Then
linee=LDText.Replace (linee,"%3"+aq,m3)
elseIf Text.IsSubText (linee,"%2") Then
linee=LDText.Replace (linee,"%2",mem[2][1])
elseIf Text.IsSubText (linee,"%3") Then
linee=LDText.Replace (linee,"%3",mem[3][1])
elseIf Text.IsSubText (linee,"%4") Then
linee=LDText.Replace (linee,"%4",mem[4][1])
elseIf Text.IsSubText (linee,"%5") Then
linee=LDText.Replace (linee,"%5",mem[5][1])
elseIf Text.IsSubText (linee,"%6") Then
linee=LDText.Replace (linee,"%6",mem[6][1])
elseIf Text.IsSubText (linee,"%7") Then
linee=LDText.Replace (linee,"%7",mem[7][1])
elseIf Text.IsSubText (linee,"%8") Then
linee=LDText.Replace (linee,"%8",mem[8][1])
elseIf Text.IsSubText (linee,"%9") Then
linee=LDText.Replace (linee,"%9",mem[9][1])
elseIf Text.IsSubText (linee,"%A") Then
linee=LDText.Replace (linee,"%A",mem[10][1])
elseIf Text.IsSubText (linee,"%B") Then
linee=LDText.Replace (linee,"%B",mem[11][1])
elseIf Text.IsSubText (linee,"%C") Then
linee=LDText.Replace (linee,"%C",mem[12][1])
elseIf Text.IsSubText (linee,"%D") Then
linee=LDText.Replace (linee,"%D",mem[13][1])
elseIf Text.IsSubText (linee,"%E") Then
linee=LDText.Replace (linee,"%E",mem[14][1])
elseIf Text.IsSubText (linee,"%F") Then
linee=LDText.Replace (linee,"%F",mem[15][1])
elseIf Text.IsSubText (linee,"%M") Then
mm=text.GetSubTextToEnd(linee,text.GetIndexOf(linee,".")+1)
linee=LDText.Replace (linee,"%M."+mm,matr[(mm)])
elseIf Text.IsSubText (linee,"%X") Then
linee=LDText.Replace (linee,"%X",math.Round (Turtle.x))
elseIf Text.IsSubText (linee,"%Y") Then
linee=LDText.Replace (linee,"%Y",math.Round (Turtle.y))
elseIf Text.IsSubText (linee,"%W") Then
linee=LDText.Replace (linee,"%W",math.Remainder (Turtle.Angle,360) )
endif
endif
endsub
Sub fWriteLn
TextWindow.WriteLine(idd+args[1])
EndSub
Sub xpline '**************************************xplains prg....*********************
If Text.StartsWith(linee, "|") Then
vn=text.GetSubText(linee,2,2)
vv=text.GetSubTextToEnd (linee,5)
dfc=text.GetSubText(linee,4,1)
If dfc="=" then
LDCall.Function("fWriteLn","Define New VAR "+vn+" and assign value:"+vv)
vcnt=vcnt+1
mem[vcnt][0]=vn
elseif dfc="+" then
LDCall.Function("fWriteLn","Increase VAR "+vn+" by:"+vv)
elseif dfc="~" then
LDCall.Function("fWriteLn","Find VAR "+vn+" and assign value:"+vv)
elseif dfc="*" then
LDCall.Function("fWriteLn","Multiply VAR "+vn+" by:"+vv)
elseif dfc="/" then
LDCall.Function("fWriteLn","Divide VAR "+vn+" by:"+vv)
endif
endif
If Text.StartsWith(linee, "W#") Then 'console debug writting
ttx= Text.GetSubTextToEnd (linee,3)
LDCall.Function("fWriteLn","Write to console:"+ttx)
ElseIf Text.StartsWith(linee, "%") then
LDCall.Function("fWriteLn","Perform "+Text.GetSubTextToEnd (linee,4))
ElseIf Text.StartsWith(linee, "WRT") Then 'turtle writting
ttx= Text.GetSubTextToEnd (linee,5)
LDCall.Function("fWriteLn","Write to screen:"+ttx)
ElseIf Text.StartsWith(linee, "Ht") Then
LDCall.Function("fWriteLn","Reset to Home pos.")
elseif Text.StartsWith(linee, "F") Then
dist = Text.GetSubTextToEnd(linee, 3)
If Text.StartsWith(dist,"%") then
dist = "var value:"+mem[Text.GetIndexOf (_hexx, Text.GetSubTextToEnd(dist, 2))][0]
endif
LDCall.Function("fWriteLn","Forward by:"+ dist)
Elseif Text.StartsWith(linee, "<") Then
ttx= Text.GetSubTextToEnd (linee,2)
LDCall.Function("fWriteLn","
idd=idd+" "
Elseif Text.StartsWith(linee, ">") Then
idd=text.GetSubTextToEnd(idd,3)
LDCall.Function("fWriteLn",">END SUB.")
Elseif Text.StartsWith(linee, "]") Then
idd=text.GetSubTextToEnd(idd,4)
LDCall.Function("fWriteLn","] END Repeat block")
Elseif Text.StartsWith(linee, "}") Then
idd=text.GetSubTextToEnd(idd,4)
LDCall.Function("fWriteLn","} END block")
Elseif Text.StartsWith(linee, "S") Then
If sc=0 then
sc=1
LDCall.Function("fWriteLn","Set scale to 1")
else
If Text.GetSubText(linee,2,1)="%" then
LDCall.Function("fWriteLn","Alter scale <(kind +/*) selected by VAR:"+mem[Text.GetIndexOf (_hexx, Text.GetSubText(linee, 3,1))][0]+"> by factor:"+Text.GetSubTextToEnd(linee, 5))
elseIf Text.GetSubText(linee,2,1)="/" then
LDCall.Function("fWriteLn","Divide scale by:"+Text.GetSubTextToEnd(linee, 3))
else
LDCall.Function("fWriteLn","Multiply scale by:"+Text.GetSubTextToEnd(linee, 3))
endif
EndIf
ElseIf Text.StartsWith(linee, "$") Then
LDCall.Function("fWriteLn","Save turtle pos.")
ElseIf Text.StartsWith(linee, "@") Then ' subbs
scc=Text.GetSubTextToEnd (linee,2)
LDCall.Function("fWriteLn","Call sub:"+sbb[scc][0])
ElseIf Text.StartsWith(linee, "&") Then
LDCall.Function("fWriteLn","Restore turtle pos.")
ElseIf Text.StartsWith(linee, "U") Then
LDCall.Function("fWriteLn","Pen UP - moving")
ElseIf Text.StartsWith(linee, "D") Then
LDCall.Function("fWriteLn","Pen DN - drawing")
ElseIf Text.StartsWith(linee, "R") Then
dist = Text.GetSubTextToEnd(linee, 3)
LDCall.Function("fWriteLn","Turn RIGHT by:"+dist)
ElseIf Text.StartsWith(linee, "L") Then
dist = Text.GetSubTextToEnd(linee, 3)
LDCall.Function("fWriteLn","Turn LEFT by:"+dist)
txx=txx+"%$$ = loop counter backward"+_nln
txx=txx+"%$A = Turtle.Angle"+_nln
txx=txx+"%$C = Pen color"+_nln
txx=txx+"%$n = n=[ 1..F(hex)] ref. in loop to vars 1..15"+_nln
txx=txx+_nln+"Spec.cmds:"+_nln
txx=txx+"%M.nn= matrix row nn _1..99"+_nln
txx=txx+"|vv;txt <= stores txt as chars in matrix %M"+_nln
txx=txx+"|vv~nnn <= stores data in existing var vv"+_nln
txx=txx+"|vv=nnn <= stores data in new var vv"+_nln
txx=txx+"|vv+nnn <= adds value to var vv"+_nln
txx=txx+"|vv*nnn <= multipl. value to var vv"+_nln
txx=txx+"|vv/nnn <= divides var vv by val."+_nln
txx=txx+"|vv'cccc <= stores chr unicode cccc to var vv"+_nln
txx=txx+"~n = delay n msecs"+_nln
txx=txx+"#C ww = fill circle rad.ww px"+_nln
txx=txx+"XC ww = del. circle rad.ww px"+_nln
txx=txx+"~C = del. watch zone"+_nln
txx=txx+"$ = save turtle loc."+_nln
txx=txx+"& = restore turtle loc."+_nln
txx=txx+"#F fnam;bld;itl;siz = set font name, bold 0 or 1, italic 0/1, size"+_nln
txx=txx+"#P = set pen clr from treedef."+_nln
txx=txx+"~H = Home turtle"+_nln
txx=txx+"#E xpr = matheval xpr expression"+_nln
txx=txx+"#X cmd = exec. sb cmd"+_nln