here is my old scripting program it is in for a rewrite right now though
it uses a single array for each vairbale type and references them by numbers which is mainly what i am doing the rewrite for
well here is the actual program
start002:
input "What file to run: ",tmp$
if file exist(tmp$)=0 then goto start002
input "what arguments(comma delimited): ",arg$
xscript(tmp$,arg$)
function xscript(file$,arg$)
`declare globals
global xscript_ver# as float
open to read 32,file$
dim ext$(1024)
dim strings$(99) as string
dim ints(99)
dim floats#(99) as float
dim lables(99)
strings$(99)=arg$
for i=1 to 1024
read string 32,ext$(i)
tmp$=""
tmp$=tmp$+mid$(ext$(i),1)
tmp$=tmp$+mid$(ext$(i),2)
tmp$=tmp$+mid$(ext$(i),3)
tmp$=tmp$+mid$(ext$(i),4)
if tmp$="labl"
temp$=mid$(ext$(i),5)+mid$(ext$(i),6)
tmp=val(temp$)
lables(tmp)=i
endif
if file end(32)=1
lines=i
exit
endif
next i
close file 32
for i=1 to 1024
if ext$(i)="preint" and i=1 then gosub _preint
`print i
`if looping=1 and i=loopto+1 `ANOTHER PROBLEM(NOT SURE WHICH PART HAS THE PROBLEM
`i=linenum
`endif
`clear tmp variables
tmp$=""
temp$=""
tmp=0
trash$=""
tmp2$=""
if ext$(i)="lop" and loping2=1 then i=linnum
tmp$=tmp$+mid$(ext$(i),1)
tmp$=tmp$+mid$(ext$(i),2)
tmp$=tmp$+mid$(ext$(i),3)
tmp$=tmp$+mid$(ext$(i),4)
if tmp$="cls " then cls
if escapekey()=1 then exit
if tmp$="goto"
ifing=0
temp$=mid$(ext$(i),5)+mid$(ext$(i),6)
tmp=val(temp$)
i=lables(tmp)
endif
REM LOOPING IS A VARIABLE THAT CAN ENTERFER WITH THE EXIT COMMAND
if tmp$="do " and loping2=0
print "looped"
linnum=i+1
loping2=1
z=0
a=0
_tmp001:
z=z+1
a=i+z
`wait key
`print lines
`print ext$(t)
print a
if ext$(a)="lop"
print "line 59"
goto _tmp002
`EXIT HAS A BUG IN IT HERE
`endif
goto _tmp001
endif
_tmp002:
endif
if tmp$="endd" then goto ended2
if ifing=1 and tmp$="ndif"
ifing=0
endif
if tmp$="echo"
if mid$(ext$(i),5)="!"
for t=6 to len(ext$(i))
temp$=temp$+mid$(ext$(i),t)
next t
print temp$
endif
if mid$(ext$(i),5)="$"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
print strings$(tmp)
endif
if mid$(ext$(i),5)="#"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
print ints(tmp)
endif
if mid$(ext$(i),5)="%"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
print floats#(tmp)
endif
endif
if tmp$="inpt"
if mid$(ext$(i),5)="$"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
input strings$(tmp)
tmp=0
tmp2$=""
endif
if mid$(ext$(i),5)="#"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
input ints(tmp)
tmp=0
tmp2$=""
endif
if mid$(ext$(i),5)="%"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
input floats#(tmp)
tmp=0
tmp2$=""
endif
endif
if tmp$="if "
if mid$(ext$(i),5)="$"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
tmp3$=mid$(ext$(i),9)+mid$(ext$(i),10)
tmp2=val(tmp3$)
if strings$(tmp)=strings$(tmp2)
ifing=1
else
n=i
do
tmp$=""
`read string 32,tmp$
`if file end(32)=1 then exit
n=n+1
if ext$(n)="ndif"
exit
endif
loop
endif
endif
if mid$(ext$(i),5)="#"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
tmp3$=mid$(ext$(i),9)+mid$(ext$(i),10)
tmp2=val(tmp3$)
if ints(tmp)=ints(tmp2)
ifing=1
else
n=i
do
tmp$=""
`read string 32,tmp$
`if file end(32)=1 then exit
n=n+1
if ext$(n)="ndif"
i=n
exit
endif
loop
endif
endif
if mid$(ext$(i),5)="%"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
tmp3$=mid$(ext$(i),9)+mid$(ext$(i),10)
tmp2=val(tmp3$)
if floats#(tmp)=floats#(tmp2)
ifing=1
else
n=i
do
tmp$=""
`read string 32,tmp$
`if file end(32)=1 then exit
n=n+1
if ext$(n)="ndif"
exit
endif
loop
endif
endif
endif
`i=i+1
if tmp$="ifnt"
if mid$(ext$(i),5)="$"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
tmp3$=mid$(ext$(i),9)+mid$(ext$(i),10)
tmp2=val(tmp3$)
if strings$(tmp)=strings$(tmp2)
n=i
do
tmp$=""
`read string 32,tmp$
`if file end(32)=1 then exit
n=n+1
if ext$(n)="ndif"
exit
endif
loop
else
ifing=1
endif
endif
if mid$(ext$(i),5)="%"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
tmp3$=mid$(ext$(i),9)+mid$(ext$(i),10)
tmp2=val(tmp3$)
if floats#(tmp)=floats#(tmp2)
n=i
do
tmp$=""
`read string 32,tmp$
`if file end(32)=1 then exit
n=n+1
if ext$(n)="ndif"
exit
endif
loop
else
ifing=1
endif
endif
if mid$(ext$(i),5)="#"
tmp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp2$)
tmp3$=mid$(ext$(i),9)+mid$(ext$(i),10)
tmp2=val(tmp3$)
if ints(tmp)=ints(tmp2)
n=i
do
tmp$=""
`read string 32,tmp$
`if file end(32)=1 then exit
n=n+1
if ext$(n)="ndif"
exit
endif
loop
else
ifing=1
endif
endif
endif
if tmp$="eqal" `FINALLY THE CONVERT/EQUAL FUNCTION IS COMPLETE
if mid$(ext$(i),5)="$" and mid$(ext$(i),9)="!"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
temp$=""
for t=10 to len(ext$(i))
temp$=temp$+mid$(ext$(i),t)
next t
strings$(tmp)=temp$
endif
if mid$(ext$(i),5)="#" and mid$(ext$(i),9)="!"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
temp$=""
for t=10 to len(ext$(i))
temp$=temp$+mid$(ext$(i),t)
next t
tmp2=val(temp$)
ints(tmp)=tmp2
endif
if mid$(ext$(i),5)="%" and mid$(ext$(i),9)="!"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
temp$=""
for t=10 to len(ext$(i))
temp$=temp$+mid$(ext$(i),t)
next t
tmp2#=val(temp$)
floats#(tmp)=tmp2#
endif
if mid$(ext$(i),5)="$" and mid$(ext$(i),9)="$"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
strings$(tmp)=strings$(tmp2)
endif
if mid$(ext$(i),5)="#" and mid$(ext$(i),9)="#"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
ints(tmp)=ints(tmp2)
endif
if mid$(ext$(i),5)="%" and mid$(ext$(i),9)="%"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
floats#(tmp)=floats#(tmp2)
endif
if mid$(ext$(i),5)="$" and mid$(ext$(i),9)="%"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
strings$(tmp)=str$(floats#(tmp2))
endif
if mid$(ext$(i),5)="$" and mid$(ext$(i),9)="#"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
strings$(tmp)=str$(ints(tmp2))
endif
if mid$(ext$(i),5)="#" and mid$(ext$(i),9)="$"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
ints(tmp)=val(strings$(tmp2))
endif
if mid$(ext$(i),5)="#" and mid$(ext$(i),9)="%"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
tmp3$=str$(floats#(tmp2))
ints(tmp)=val(tmp3$)
endif
if mid$(ext$(i),5)="%" and mid$(ext$(i),9)="#"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
tmp3$=str$(ints(tmp2))
floats#(tmp)=val(tmp3$)
endif
if mid$(ext$(i),5)="%" and mid$(ext$(i),9)="$"
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(tmp3$)
tmp3$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(tmp3$)
tmp2=val(temp$)
floats#(tmp)=val(strings$(tmp2))
endif
endif
`NON CORE ADDONS
if dll_loader1=1 then gosub _dll_loader1
if music_lib=1 then gosub _music_lib
netx:
sync
if error=1 then exit
if i=lines+1 then exit
next i
goto ended2
`GOSUBS ENABLED THRU PREINT DIRECTIVES
_preint: `pre interpret reader
for t=2 to 64
if ext$(t)="end_preint" then exit
tmp$=""
tmp$=tmp$+mid$(ext$(t),1)
tmp$=tmp$+mid$(ext$(t),2)
tmp$=tmp$+mid$(ext$(t),3)
tmp$=tmp$+mid$(ext$(t),4)
if tmp$="ilib"
temp$=""
for z=6 to len(ext$(t))
temp$=temp$+mid$(ext$(t),z)
next z
if temp$="maths1" then maths1=1
if temp$="control1" then control1=1
if temp$="memory" then memory=1`BETA TESTIGN NOT CURRENTLY SUPPORTED
if temp$="dll_loader1" then dll_loader1=1
if temp$="text_cmds" then text_cmds=1
if temp$="input_lib1" then input_lib1=1
if temp$="input_lib2" then input_lib2=1
if temp$="system_lib1" then system_lib1=1
if temp$="file_lib1" then file_lib1=1
if temp$="file_lib2" then file_lib2=1
if temp$="basic2d" then basic2d=1
if temp$="bitmap" then bitmap=1
if temp$="basic_sound" then basic_sound=1
if temp$="extra_sound_lib" then extra_sound_lib=1
if temp$="music_lib" then music_lib=1
if temp$="sprites_lib" then sprites_lib=1
if temp$="images_lib" then images_lib=1
if temp$="animation_lib1" then animation_lib1=1
if temp$="lights_lib" then lights_lib=1
if temp$="camera_lib" then camera_lib=1
if temp$="basic3d_beta" then basic3d_beta=1`BETA TESTING NOT CURRENTLY SUPPORTED
if temp$="matrix_lib" then matrix_lib=1
if temp$="world_lib" then world_lib=1
if temp$="terrain_lib" then terrain_lib=1
if temp$="particle_lib" then particle_lib=1
if temp$="maths3d_beta" then maths3d_beta=1`BETA TESTIGN NOT CURRENTLY SUPPORTED
if temp$="memblock_main" then memblock_main=1
if temp$="memblock_conversion" then memblock_conversion=1
if temp$="directplay_lib" then directplay_lib=1
if temp$="checklist_lib" then checklist_lib=1
if temp$="other_lib1" then other_lib1=1
if temp$="nbif_lib" then nbif_lib=1
if temp$="xexplorer_api1" then xexplorer_api1=1
if temp$="var_control" then var_control=1
if temp$="constants_lib1" then constants_lib1=1
endif
next t
return
`library gosubs:
_maths1:
return
_dll_loader1:
if tmp$="dllo"
if mid$(ext$(i),5)="!"
temp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
temp2=val(temp2$)
endif
if mid$(ext$(i),5)="#"
temp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
temp3=val(temp2$)
temp2=ints(temp3)
endif
if mid$(ext$(i),9)="!"
temp4$=""
for t=10 to len(ext$(i))
temp4$=temp4$+mid$(ext$(i),t)
next i
endif
if mid$(ext$(i),5)="$"
temp2$=mid$(ext$(i),10)+mid$(ext$(i),11)
temp3=val(temp2$)
temp4$=strings$(temp3)
endif
if file exist(temp4$)=0
print "001; DLL file does not exist; line: "+str$(i) `template of error handling
error=1
exit
endif
load dll temp4$,temp2
endif
return
_music_lib:
if tmp$="delm"
if mid$(ext$(i),5)="!"
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(temp$)
else
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(temp$)
tmp=ints(tmp2)
endif
delete music tmp
endif
if tmp$="paum"
if mid$(ext$(i),5)="!"
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(temp$)
else
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(temp$)
tmp=ints(tmp2)
endif
pause music tmp
endif
if tmp$="stpm"
if mid$(ext$(i),5)="!"
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(temp$)
else
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(temp$)
tmp=ints(tmp2)
endif
stop music tmp
endif
if tmp$="resm"
if mid$(ext$(i),5)="!"
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(temp$)
else
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(temp$)
tmp=ints(tmp2)
endif
resume music tmp
endif
if tmp$="lmus"
if mid$(ext$(i),5)="!"
temp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
temp2=val(temp2$)
endif
if mid$(ext$(i),5)="#"
temp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
temp3=val(temp2$)
temp2=ints(temp3)
endif
if mid$(ext$(i),9)="!"
temp4$=""
for t=10 to len(ext$(i))
temp4$=temp4$+mid$(ext$(i),t)
next i
endif
if mid$(ext$(i),9)="$"
temp2$=mid$(ext$(i),10)+mid$(ext$(i),11)
temp3=val(temp2$)
temp4$=strings$(temp3)
endif
if file exist(temp4$)=0
print "002; Music file does not exist; line: "+str$(i) `template of error handling
error=1
goto netx
endif
load music temp4$,temp2
endif
if tmp$="plym"
if mid$(ext$(i),5)="!"
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(temp$)
else
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(temp$)
tmp=ints(tmp2)
endif
play music tmp
endif
if tmp$="muse"
if mid$(ext$(i),5)="!"
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp=val(temp$)
else
temp$=mid$(ext$(i),6)+mid$(ext$(i),7)
tmp2=val(temp$)
tmp=ints(tmp2)
endif
temp$=mid$(ext$(i),9)+mid$(ext$(i),10)
tmp2=val(temp$)
ints(tmp2)=music exist(tmp)
endif
if tmp$="stmv"
if mid$(ext$(i),5)="!"
temp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
temp4=val(temp2$)
endif
if mid$(ext$(i),5)="#"
temp2$=mid$(ext$(i),6)+mid$(ext$(i),7)
temp3=val(temp2$)
temp4=ints(temp3)
endif
if mid$(ext$(i),9)="!"
temp2$=mid$(ext$(i),10)+mid$(ext$(i),11)+mid$(ext$(i),12)
temp2=val(temp2$)
endif
if mid$(ext$(i),9)="#"
temp2$=mid$(ext$(i),10)+mid$(ext$(i),11)
temp3=val(temp2$)
temp2=ints(temp3)
endif
if music exist(temp4)=0
print "002; Music number does not exist; line: "+str$(i) `template of error handling
error=1
goto netx
endif
set music volume temp4,temp2
endif
return
ended2:
`print tmp$
endfunction
and of course a simple media player showing its usability
preint
ilib music_lib
end_preint
echo$99
ifnt$99=00
lmus!01,$99
plym!01
ndif
eqal#02=!2
eqal#03=!3
eqal#04=!4
eqal#05=!5
eqal#06=!6
eqal#07=!7
eqal#08=!8
eqal#31=!1
labl01
cls
echo!Type 1 to load music
echo!Type 2 to play the loaded music
echo!Type 3 to stop the music
echo!Type 4 to change the volume of the loaded music
echo!Type 5 to pause the music
echo!Type 6 to resume paused music
echo!Type 7 to unload the music
echo!Type 8 to exit
inpt#01
if #01=31
echo!What is the music files path
inpt$01
lmus!01,$01
goto01
ndif
if #01=02
plym!01
goto01
ndif
if #01=03
stpm!01
goto01
ndif
if #01=04
echo!So what volume(0-200)
inpt#32
stmv!01,#32
goto01
ndif
if #01=05
paum!01
goto01
ndif
if #01=06
resm!01
goto01
ndif
if #01=07
delm!01
goto01
ndif
if #01=08
delm!01
endd
ndif
well there u go the things i am changing about it are the vairables
able to have gosubs(functions im nto sure about)
able to have unlimited variables as logn as they are predeclared(u cant just say print abc uwould have to dim abc as int then print abc
make it faster
and some other stuff
current rewrite progress 5%