Ok, here's an updated version, I discovered that my compressor was somehow losing the first commands of every program, which was many times the sync on sync rate 0 commands...
Anyways fixed that lil problem:
Full Code:
remstart
sync on
sync rate 0
big ol comment block...
remend sync on
sync rate 0
`this way you can just drag and drop a file onto the program and it'll automaticaly convert it for you
path$=cl$()
if path$>""
`lotsa lotsa variables
n=len(path$)
filename$=left$(right$(path$,n-1),n-2)
open to read 1,filename$
dim storeline(1000) as string
dim Quotes(10000) as string
dim lines(10000) as string
dim linesFinal(10000) as string
global dotqty as integer = 0
global dots as string
global totalLines as integer
global CurStorLines as integer
global CommentBlock as integer
global selConvNum as integer
global dim selConvVar(10) as string
labRestoreQty = 0
selConvNum = 0
CommentBlock = 0
`read the file into an array...
repeat
cls
read string 1, tmp$
`perform special stuff on the line...
tmp$ = removeExtraWhiteSpace(tmp$)
tmp$ = IF_Then_Conv(tmp$)
lines(totalLines) = tmp$
inc totalLines
text 10,10,"Loading Data"
text 10,25,lines(totalLines - 1)
syn
il file end(1)=1
`file done loading, close file
close file 1
for a = 1 to 2
n = 0
m = 0
`loop through and expand all commands...
repeat
cls
tmp = commandCount(lines(n))
if tmp > 1
`if there is more than one command on a line, then split up the commands...
tmp$ = first token$(lines(n),":")
for j = 1 to tmp
linesFinal(m) = removeExtraWhiteSpace(tmp$)
inc m
tmp$ = next token$(":")
next j
else
`if there's one line then add it if there's more than one character
if len(lines(n)) > 1
linesFinal(m) = lines(n)
inc m
endif
endif
inc n
text 10,10,"Editing " + str$(n) + "/" + str$(totalLines) + " compleated"
text 10,25,lines(n)
syn
il n > totalLines
`for const and Init conversion there can be only ONE command on a line, so I have to parse twice
if a = 1
totalLines = m
for n = 0 to totalLines
lines(n) = const_and_Init_Conv(linesFinal(n))
linesFinal(n) = ""
next n
endif
next a
`variable initialization
totalLines = m-1
CurStorLines = 0
commandNumber = 0
`now go and format into 20line code
for n = 0 to totalLines
cls
if n <> 0
linesFinal(n) = Quote_Replace(linesFinal(n))
if ((find sub string$(lower$(linesFinal(n)),"function ") > 0 and find sub string$(lower$(linesFinal(n)),"exitfunction ") > 0) or find sub string$(lower$(linesFinal(n)),"function ") < 1) and find sub string$(linesFinal(n), "endfunction") < 1
`so if there is no function or endfunction statements then treat line like a normal command...
`check to see if it is a data statement, if so then turn consecutive data statements into one long line...
if find sub string$(lower$(linesFinal(n)),"data") >= 0 and find sub string$(lower$(linesFinal(n-1)),"data") >= 0
tmp$ = right$(linesFinal(n),len(linesFinal(n)) - (find sub string$(lower$(linesFinal(n)),"data")+3))
storeline(CurStorLines) = left$(storeline(CurStorLines), (len(storeline(CurStorLines)) - 3))
storeline(CurStorLines)=storeline(CurStorLines)+","+tmp$+" : "
else
if linesFinal(n)>""
storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : "
inc commandnumber
endif
endif
else
`if a function or endfunction is found then you have to be carefull...
if find sub string$(lower$(linesFinal(n)),"function ") > 0 and find sub string$(lower$(linesFinal(n)),"endfunction") <= 0
if find sub string$(lower$(linesFinal(n-1)),"endfunction") > 0
storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : "
inc commandnumber
else
storeline(CurStorLines) = left$(storeline(CurStorLines), len(storeline(CurStorLines))-3)
inc CurStorLines
commandnumber = 1
storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : "
endif
endif
if find sub string$(lower$(linesFinal(n)),"endfunction") > 0
storeline(CurStorLines) = left$(storeline(CurStorLines), len(storeline(CurStorLines))-3)
inc CurStorLines
commandnumber = 1
storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : "
endif
endif
storeline(CurStorLines) = Quote_Restore(storeline(CurStorLines))
else
`this is so data don't get lost
if linesFinal(n)>""
storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : "
inc commandnumber
endif
endif
`only 25 commands per line...
if commandnumber >= 25 or n = totalLines
storeline(CurStorLines) = left$(storeline(CurStorLines), len(storeline(CurStorLines))-3)
inc CurStorLines
commandnumber = 0
endif
`a little prompt to show the user that the program is working
text 10,10,"Parsing line " + str$(n) + " of " + str$(totalLines) + " compleated"
text 10,25,linesFinal(n)
sync
next n
`open to write conversion file...
if file exist (left$(filename$, len(filename$)-4)+"_compressed.dba") then delete file left$(filename$, len(filename$)-4)+"_compressed.dba"
open to write 2,left$(filename$, len(filename$)-4)+"_compressed.dba"
`write data
for n = 0 to CurStorLines+1
write string 2, storeline(n)
next n
`finished writing, close file 2
close file 2
`tell the user we are done
exit prompt "Finished compressing file into " + str$(CurStorLines) + " lines","Compression Finished"
endif
end
`removes excess whitespace to give nice, compressed code.
function removeExtraWhiteSpace(txt as string)
local rtrn as string
local char as string
local quoteOn as integer = 0
n = 1
`loops through, ignoring quotes, elimating more than two spaces, tabs, and non text characters...
txt = Quote_Replace(txt)
while n <= len(txt)
char = mid$(txt,n)
if n > 0
if ((char = " " and mid$(txt, n-1) <> " ") or char <> " ") and asc(char) >= 32
rtrn = rtrn + char
endif
else
rtrn = rtrn + char
endif
inc n
endwhile
rtrn = Quote_Restore(rtrn)
`remove comments...
rtrn = removeComments(rtrn)
`if there's only one space left then remove...
if rtrn = " "
rtrn = ""
endif
endfunction rtrn
`turn constants into global variables (the don't work inline and so for compatability I removed them)
`Also turns initialized statements into two (ie. global var1 as integer = 0 into global var1 as integer : var1 = 0
function const_and_Init_Conv(txt as string)
`first get quotes outa da way
txt = Quote_Replace(txt)
`ok, remove constants
local pos as integer
pos = find sub string$(lower$(txt),chr$(35)+"constant")
if pos > 0
`so we found a constant... whoop dee dooo
txt = "global" + right$(txt, len(txt) - 9)
pos = find sub string$(txt, "=")
if pos < 0
txt = left$(txt,6) + " =" + right$(txt, len(txt) - 6)
endif
`check for decimal constants
if find sub string$(txt,".") > 0
txt = Replace_Text(txt,"="," as float=")
endif
if find sub string$(lower$(txt),"qquote") > 0
txt = Replace_Text(txt,"="," as string=")
endif
if find sub string$(lower$(txt),"rgb(") > 0
txt = Replace_Text(txt,"="," as integer=")
endif
endif
`now we need to remove var initalizing
pos = find sub string$(lower$(txt)," as ")
if pos > 0
`now we know that the statement has both "as" and an "=" sign...
tmp$ = txt
txt = Replace_Text(txt,"="," : ^^^var^^^ = ")
if lower$(tmp$) <> lower$(txt)
`isolate the variable
tmp$ = left$(txt, pos-1)
pos = find sub string$(lower$(tmp$),"global ")
tmp$ = right$(tmp$, len(tmp$) - pos - 6)
pos = find sub string$(lower$(tmp$),"local ")
tmp$ = right$(tmp$, len(tmp$) - pos - 5)
txt = Replace_Text(txt,"^^^var^^^",tmp$)
endif
endif
`ok, now we gotta do some select : endselect : case : endcase conversions...
pos = find sub string$(lower$(txt),"select ")
if pos > 0
inc selConvNum
selConvVar(selConvNum) = right$(txt,len(txt)-pos-6)
txt = ""
endif
if find sub string$(lower$(txt),"endselect") > 0
txt = ""
selConvVar(selConvNum) = ""
dec selConvNum
endif
pos = find sub string$(lower$(txt),"case ")
if pos > 0
if find sub string$(lower$(txt),"case default") > 0
txt = "if " + selConvVar(selConvNum) + " = " + selConvVar(selConvNum)
repeat
cls
center text screen width()/2, screen height()/2, "Warning! Cannot convert 'case default'"
center text screen width()/2, screen height()/2+15, "Will be converted to '" + txt + "'"
center text screen width()/2, screen height()/2+30, "Press Space Key to continue"
syn
il spacekey() = 1 or returnkey() = 1
repeat
syn
il spacekey() = 0 and returnkey() = 0
else
txt = "if " + selConvVar(selConvNum) + " = " + right$(txt,len(txt)-pos-4)
endif
endif
if find sub string$(lower$(txt),"endcase") > 0
txt = "endif"
endif
txt = Quote_Restore(txt)
endfunction txt
`removes comments
function removeComments(txt as string)
local rtrn as string
local comPos as integer
local tmp as integer
rtrn = Quote_Replace(txt)
if CommentBlock = 0
comPos = find sub string$(lower$(rtrn),"`")
if comPos > 0
rtrn = left$(rtrn, comPos-1)
endif
comPos = find sub string$(lower$(rtrn),"rem ")
if comPos > 0
rtrn = left$(rtrn, comPos-1)
endif
if find sub string$(lower$(rtrn),"remstart") > 0 and find sub string$(lower$(rtrn),"remend") <= 0
CommentBlock = 1
comPos = find sub string$(lower$(rtrn),"remstart")
rtrn = left$(rtrn, comPos-1)
else
comPos = find sub string$(lower$(rtrn),"remend")
tmp = find sub string$(lower$(rtrn),"remstart")
if comPos > 0
rtrn = left$(rtrn, tmp - 1) + right$(rtrn, len(rtrn) - comPos - 6)
endif
endif
else
comPos = find sub string$(lower$(rtrn),"remend")
if comPos > 0
rtrn = right$(rtrn, len(rtrn) - comPos - 6)
CommentBlock = 0
else
rtrn = ""
endif
endif
rtrn = Quote_Restore(rtrn)
endfunction rtrn
`counts the numbe of commands in a line, so if there's more they'll be counted in the final version
function commandCount(txt as string)
local rtrn as integer
txt = Quote_Replace(txt)
tmp$ = first token$(txt, ":")
while tmp$ <> ""
inc rtrn
tmp$ = next token$(":")
endwhile
Quote_Restore(txt)
endfunction rtrn
`Rii-Dii's code, converts if then statements into if : bla bla : endif
Function IF_Then_Conv(text$)
local if_pos as integer
local thn_pos as integer
local else_pos as integer
local IfCount as Integer
text$=Quote_Replace(text$)
`Do a look through for IF's and THEN's.
thn_pos=find sub string$(lower$(text$)," then ")
if thn_pos<1
text$=Quote_Restore(text$)
ExitFunction text$
Endif
if_pos=find sub string$(lower$(text$),"if ")
if if_pos<1
text$=Quote_Restore(text$)
ExitFunction text$
Endif
`so there's a if and a then... how convienent...
IfCount=0
new_part1$=""
Do
thn_pos=FIND SUB STRING$(lower$(text$)," then ")
if thn_pos<1 Then Exit
if_pos=FIND SUB STRING$(lower$(text$),"if ")
if if_pos<1 Then Exit
if if_pos>thn_pos
text$=Left$(text$,thn_pos-1)+" NEHT "+Right$(text$,len(text$)-(thn_pos+5))
Else
new_part1$=new_part1$ + Left$(text$,thn_pos-1)+":"
text$=Right$(text$,len(text$)-(thn_pos+5))
text$=Replace_Text(text$,": else ",":else ")
text$=Replace_Text(text$," else ",":else ")
Inc IfCount
Endif
Loop
text$=new_part1$+text$
For i = 1 to IfCount
text$=text$+":endif"
Next i
text$=Quote_Restore(text$)
Endfunction text$
`replaces quotes so that we don't end up with odd results...
Function Quote_Replace(text$)
`Temporarily replace Quotes so we don't confuse them in the search strings
place=0:qn=0
Do
place=place+1
if place > len(text$) Then Exit
l$=Mid$(text$,place)
if l$=Chr$(34)
t$=l$
Do
place=place+1
l$=Mid$(text$,place)
t$=t$+l$
if l$=Chr$(34) or place > len(text$) Then Exit
Loop
if place <= len(text$)
Quotes(qn)=t$
text$=Replace_Text(text$,t$,"QQuote"+Str$(qn))
Place=0
qn=qn+1
endif
Endif
Loop
Endfunction text$
`restores replaced quotes
Function Quote_Restore(text$)
`Replaces the quotes from a previous Quote Replace
qn=0
Do
If Quotes(qn)="" Then Exit
text$=Replace_Text(text$,"QQuote"+Str$(qn),Quotes(qn))
Quotes(qn)=""
qn=qn+1
Loop
Endfunction text$
`replaces text...
Function Replace_Text(text$,find$,replace$)
local find_pos as integer
find_pos=find sub string$(lower$(text$),lower$(find$))
if find_pos<1 Then exitfunction text$
new_text$=left$(text$,find_pos-1)+replace$+right$(text$,len(text$)-(find_pos+(len(find$)-1)))
Endfunction new_text$
Compressed Itself into 20 lines:
sync on : sync rate 0 : path$=cl$() : if path$>"" : n=len(path$) : filename$=left$(right$(path$,n-1),n-2) : open to read 1,filename$ : dim storeline(1000) as string : dim Quotes(10000) as string : dim lines(10000) as string : dim linesFinal(10000) as string : global dotqty as integer : dotqty = 0 : global dots as string : global totalLines as integer : global CurStorLines as integer : global CommentBlock as integer : global selConvNum as integer : global dim selConvVar(10) as string : labRestoreQty = 0 : selConvNum = 0 : CommentBlock = 0 : repeat : cls : read string 1, tmp$
tmp$ = removeExtraWhiteSpace(tmp$) : tmp$ = IF_Then_Conv(tmp$) : lines(totalLines) = tmp$ : inc totalLines : text 10,10,"Loading Data" : text 10,25,lines(totalLines - 1) : syn : il file end(1)=1 : close file 1 : for a = 1 to 2 : n = 0 : m = 0 : repeat : cls : tmp = commandCount(lines(n)) : if tmp > 1 : tmp$ = first token$(lines(n),":") : for j = 1 to tmp : linesFinal(m) = removeExtraWhiteSpace(tmp$) : inc m : tmp$ = next token$(":") : next j : else : if len(lines(n)) > 1 : linesFinal(m) = lines(n)
inc m : endif : endif : inc n : text 10,10,"Editing " + str$(n) + "/" + str$(totalLines) + " compleated" : text 10,25,lines(n) : syn : il n > totalLines : if a = 1 : totalLines = m : for n = 0 to totalLines : lines(n) = const_and_Init_Conv(linesFinal(n)) : linesFinal(n) = "" : next n : endif : next a : totalLines = m-1 : CurStorLines = 0 : commandNumber = 0 : for n = 0 to totalLines : cls : if n <> 0 : linesFinal(n) = Quote_Replace(linesFinal(n)) : if ((find sub string$(lower$(linesFinal(n)),"function ") > 0 and find sub string$(lower$(linesFinal(n)),"exitfunction ") > 0) or find sub string$(lower$(linesFinal(n)),"function ") < 1) and find sub string$(linesFinal(n), "endfunction") < 1 : if find sub string$(lower$(linesFinal(n)),"data") >= 0 and find sub string$(lower$(linesFinal(n-1)),"data") >= 0
tmp$ = right$(linesFinal(n),len(linesFinal(n)) - (find sub string$(lower$(linesFinal(n)),"data")+3)) : storeline(CurStorLines) = left$(storeline(CurStorLines), (len(storeline(CurStorLines)) - 3)) : storeline(CurStorLines)=storeline(CurStorLines)+","+tmp$+" : " : else : if linesFinal(n)>"" : storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : " : inc commandnumber : endif : endif : else : if find sub string$(lower$(linesFinal(n)),"function ") > 0 and find sub string$(lower$(linesFinal(n)),"endfunction") <= 0 : if find sub string$(lower$(linesFinal(n-1)),"endfunction") > 0 : storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : " : inc commandnumber : else : storeline(CurStorLines) = left$(storeline(CurStorLines), len(storeline(CurStorLines))-3) : inc CurStorLines : commandnumber = 1 : storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : " : endif : endif : if find sub string$(lower$(linesFinal(n)),"endfunction") > 0 : storeline(CurStorLines) = left$(storeline(CurStorLines), len(storeline(CurStorLines))-3) : inc CurStorLines : commandnumber = 1
storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : " : endif : endif : storeline(CurStorLines) = Quote_Restore(storeline(CurStorLines)) : else : if linesFinal(n)>"" : storeline(CurStorLines)=storeline(CurStorLines)+linesFinal(n)+" : " : inc commandnumber : endif : endif : if commandnumber >= 25 or n = totalLines : storeline(CurStorLines) = left$(storeline(CurStorLines), len(storeline(CurStorLines))-3) : inc CurStorLines : commandnumber = 0 : endif : text 10,10,"Parsing line " + str$(n) + " of " + str$(totalLines) + " compleated" : text 10,25,linesFinal(n) : sync : next n : if file exist (left$(filename$, len(filename$)-4)+"_compressed.dba") : delete file left$(filename$, len(filename$)-4)+"_compressed.dba" : endif : open to write 2,left$(filename$, len(filename$)-4)+"_compressed.dba" : for n = 0 to CurStorLines+1 : write string 2, storeline(n)
next n : close file 2 : exit prompt "Finished compressing file into " + str$(CurStorLines) + " lines","Compression Finished" : endif : end
function removeExtraWhiteSpace(txt as string) : local rtrn as string : local char as string : local quoteOn as integer : quoteOn = 0 : n = 1 : txt = Quote_Replace(txt) : while n <= len(txt) : char = mid$(txt,n) : if n > 0 : if ((char = " " and mid$(txt, n-1) <> " ") or char <> " ") and asc(char) >= 32 : rtrn = rtrn + char : endif : else : rtrn = rtrn + char : endif : inc n : endwhile : rtrn = Quote_Restore(rtrn) : rtrn = removeComments(rtrn) : if rtrn = " " : rtrn = "" : endif
endfunction rtrn : function const_and_Init_Conv(txt as string) : txt = Quote_Replace(txt) : local pos as integer : pos = find sub string$(lower$(txt),chr$(35)+"constant") : if pos > 0 : txt = "global" + right$(txt, len(txt) - 9) : pos = find sub string$(txt, "=") : if pos < 0 : txt = left$(txt,6) + " =" + right$(txt, len(txt) - 6) : endif : if find sub string$(txt,".") > 0 : txt = Replace_Text(txt,"="," as float=") : endif : if find sub string$(lower$(txt),"qquote") > 0 : txt = Replace_Text(txt,"="," as string=") : endif : if find sub string$(lower$(txt),"rgb(") > 0 : txt = Replace_Text(txt,"="," as integer=") : endif : endif : pos = find sub string$(lower$(txt)," as ") : if pos > 0 : tmp$ = txt : txt = Replace_Text(txt,"="," : ^^^var^^^ = ")
if lower$(tmp$) <> lower$(txt) : tmp$ = left$(txt, pos-1) : pos = find sub string$(lower$(tmp$),"global ") : tmp$ = right$(tmp$, len(tmp$) - pos - 6) : pos = find sub string$(lower$(tmp$),"local ") : tmp$ = right$(tmp$, len(tmp$) - pos - 5) : txt = Replace_Text(txt,"^^^var^^^",tmp$) : endif : endif : pos = find sub string$(lower$(txt),"select ") : if pos > 0 : inc selConvNum : selConvVar(selConvNum) = right$(txt,len(txt)-pos-6) : txt = "" : endif : if find sub string$(lower$(txt),"endselect") > 0 : txt = "" : selConvVar(selConvNum) = "" : dec selConvNum : endif : pos = find sub string$(lower$(txt),"case ") : if pos > 0 : if find sub string$(lower$(txt),"case default") > 0 : txt = "if " + selConvVar(selConvNum) + " = " + selConvVar(selConvNum) : repeat
cls : center text screen width()/2, screen height()/2, "Warning! Cannot convert 'case default'" : center text screen width()/2, screen height()/2+15, "Will be converted to '" + txt + "'" : center text screen width()/2, screen height()/2+30, "Press Space Key to continue" : syn : il spacekey() = 1 or returnkey() = 1 : repeat : syn : il spacekey() = 0 and returnkey() = 0 : else : txt = "if " + selConvVar(selConvNum) + " = " + right$(txt,len(txt)-pos-4) : endif : endif : if find sub string$(lower$(txt),"endcase") > 0 : txt = "endif" : endif : txt = Quote_Restore(txt)
endfunction txt : function removeComments(txt as string) : local rtrn as string : local comPos as integer : local tmp as integer : rtrn = Quote_Replace(txt) : if CommentBlock = 0 : comPos = find sub string$(lower$(rtrn),"`") : if comPos > 0 : rtrn = left$(rtrn, comPos-1) : endif : comPos = find sub string$(lower$(rtrn),"rem ") : if comPos > 0 : rtrn = left$(rtrn, comPos-1) : endif : if find sub string$(lower$(rtrn),"remstart") > 0 and find sub string$(lower$(rtrn),"remend") <= 0 : CommentBlock = 1 : comPos = find sub string$(lower$(rtrn),"remstart") : rtrn = left$(rtrn, comPos-1) : else : comPos = find sub string$(lower$(rtrn),"remend") : tmp = find sub string$(lower$(rtrn),"remstart") : if comPos > 0 : rtrn = left$(rtrn, tmp - 1) + right$(rtrn, len(rtrn) - comPos - 6) : endif
endif : else : comPos = find sub string$(lower$(rtrn),"remend") : if comPos > 0 : rtrn = right$(rtrn, len(rtrn) - comPos - 6) : CommentBlock = 0 : else : rtrn = "" : endif : endif : rtrn = Quote_Restore(rtrn)
endfunction rtrn : function commandCount(txt as string) : local rtrn as integer : txt = Quote_Replace(txt) : tmp$ = first token$(txt, ":") : while tmp$ <> "" : inc rtrn : tmp$ = next token$(":") : endwhile : Quote_Restore(txt)
endfunction rtrn : Function IF_Then_Conv(text$) : local if_pos as integer : local thn_pos as integer : local else_pos as integer : local IfCount as Integer : text$=Quote_Replace(text$) : thn_pos=find sub string$(lower$(text$)," then ") : if thn_pos<1 : text$=Quote_Restore(text$) : ExitFunction text$ : Endif : if_pos=find sub string$(lower$(text$),"if ") : if if_pos<1 : text$=Quote_Restore(text$) : ExitFunction text$ : Endif : IfCount=0 : new_part1$="" : Do : thn_pos=FIND SUB STRING$(lower$(text$)," then ") : if thn_pos<1 : Exit : endif : if_pos=FIND SUB STRING$(lower$(text$),"if ")
if if_pos<1 : Exit : endif : if if_pos>thn_pos : text$=Left$(text$,thn_pos-1)+" NEHT "+Right$(text$,len(text$)-(thn_pos+5)) : Else : new_part1$=new_part1$ + Left$(text$,thn_pos-1)+":" : text$=Right$(text$,len(text$)-(thn_pos+5)) : text$=Replace_Text(text$,": else ",":else ") : text$=Replace_Text(text$," else ",":else ") : Inc IfCount : Endif : Loop : text$=new_part1$+text$ : For i = 1 to IfCount : text$=text$+":endif" : Next i : text$=Quote_Restore(text$)
Endfunction text$ : Function Quote_Replace(text$) : place=0 : qn=0 : Do : place=place+1 : if place > len(text$) : Exit : endif : l$=Mid$(text$,place) : if l$=Chr$(34) : t$=l$ : Do : place=place+1 : l$=Mid$(text$,place) : t$=t$+l$ : if l$=Chr$(34) or place > len(text$) : Exit : endif : Loop : if place <= len(text$) : Quotes(qn)=t$ : text$=Replace_Text(text$,t$,"QQuote"+Str$(qn)) : Place=0 : qn=qn+1
endif : Endif : Loop
Endfunction text$ : Function Quote_Restore(text$) : qn=0 : Do : If Quotes(qn)="" : Exit : endif : text$=Replace_Text(text$,"QQuote"+Str$(qn),Quotes(qn)) : Quotes(qn)="" : qn=qn+1 : Loop
Endfunction text$ : Function Replace_Text(text$,find$,replace$) : local find_pos as integer : find_pos=find sub string$(lower$(text$),lower$(find$)) : if find_pos<1 : exitfunction text$ : endif : new_text$=left$(text$,find_pos-1)+replace$+right$(text$,len(text$)-(find_pos+(len(find$)-1)))
Endfunction new_text$
And enjoy!
CPU
[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\[center]