wiseant
8th May 2012, 23:00
Hi
I am trying to use GScript to create a for loop
I have an avsi file that list 34 fonts, i.e.
f1 = "ARIAL" ... f34 = "Vrinda"
and another avsi file that lists 140 colors,
i.e. global aliceblue=$F0F8FF ... global yellowgreen=$9ACD32
i.e. global c1=aliceblue ... global c140=yellowgreen
In the GScript code, I would like to increment f1 to f34 - i.e. display the 34 fonts in order
The problem is how can I use the for loop to increment values from f1 to f34
I tried renaming the fonts 1 to 34 in the avsi file but this doesn't work
I have also tried other ways:
for f(i) = 1 to 34
subtitle(f(i) ...
for i = 1 to 34
subtitle("f" + i ...
or
subtitle (f+"i" ...
Can I do this without using AVSLib to create some arrays?
[I would also like to increment the textcolor and/or halocolor]
Here is my script:
fontsize=40
vwidth=98*fontsize/2
vheight=72*fontsize/2
xspace=2
yspace=fontsize + 4
textcolor1=c8
halocolor1=c120
blankclip(60,vwidth,vheight,color=$ffffff)
text=" 0123456789 AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
GScript("""
for ( i = 1 , 34 , 1 ) {
subtitle(f3+text,x=xspace,y=i*fontsize,font=f3,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
}
""")
The script works if I just use a font value, i.e f1 ... f34
# without a for loop
#~ subtitle(f1+an,x=xspace,y=1*fontsize,font=f1,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f2+an,x=xspace,y=2*fontsize,font=f2,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f3+an,x=xspace,y=3*fontsize,font=f3,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f4+an,x=xspace,y=4*fontsize,font=f4,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f5+an,x=xspace,y=5*fontsize,font=f5,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f6+an,x=xspace,y=6*fontsize,font=f6,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f7+an,x=xspace,y=7*fontsize,font=f7,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f8+an,x=xspace,y=8*fontsize,font=f8,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f9+an,x=xspace,y=9*fontsize,font=f9,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f10+an,x=xspace,y=10*fontsize,font=f10,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f11+an,x=xspace,y=11*fontsize,font=f11,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f12+an,x=xspace,y=12*fontsize,font=f12,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f13+an,x=xspace,y=13*fontsize,font=f13,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f14+an,x=xspace,y=14*fontsize,font=f14,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f15+an,x=xspace,y=15*fontsize,font=f15,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f16+an,x=xspace,y=16*fontsize,font=f16,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f17+an,x=xspace,y=17*fontsize,font=f17,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f18+an,x=xspace,y=18*fontsize,font=f18,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f19+an,x=xspace,y=19*fontsize,font=f19,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f20+an,x=xspace,y=20*fontsize,font=f20,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f21+an,x=xspace,y=21*fontsize,font=f21,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f22+an,x=xspace,y=22*fontsize,font=f22,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f23+an,x=xspace,y=23*fontsize,font=f23,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f24+an,x=xspace,y=24*fontsize,font=f24,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f25+an,x=xspace,y=25*fontsize,font=f25,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f26+an,x=xspace,y=26*fontsize,font=f26,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f27+an,x=xspace,y=27*fontsize,font=f27,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f28+an,x=xspace,y=28*fontsize,font=f28,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f29+an,x=xspace,y=29*fontsize,font=f29,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f30+an,x=xspace,y=30*fontsize,font=f30,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f31+an,x=xspace,y=31*fontsize,font=f31,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f32+an,x=xspace,y=32*fontsize,font=f32,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f33+an,x=xspace,y=33*fontsize,font=f33,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f34+an,x=xspace,y=34*fontsize,font=f34,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
TIA
I am trying to use GScript to create a for loop
I have an avsi file that list 34 fonts, i.e.
f1 = "ARIAL" ... f34 = "Vrinda"
and another avsi file that lists 140 colors,
i.e. global aliceblue=$F0F8FF ... global yellowgreen=$9ACD32
i.e. global c1=aliceblue ... global c140=yellowgreen
In the GScript code, I would like to increment f1 to f34 - i.e. display the 34 fonts in order
The problem is how can I use the for loop to increment values from f1 to f34
I tried renaming the fonts 1 to 34 in the avsi file but this doesn't work
I have also tried other ways:
for f(i) = 1 to 34
subtitle(f(i) ...
for i = 1 to 34
subtitle("f" + i ...
or
subtitle (f+"i" ...
Can I do this without using AVSLib to create some arrays?
[I would also like to increment the textcolor and/or halocolor]
Here is my script:
fontsize=40
vwidth=98*fontsize/2
vheight=72*fontsize/2
xspace=2
yspace=fontsize + 4
textcolor1=c8
halocolor1=c120
blankclip(60,vwidth,vheight,color=$ffffff)
text=" 0123456789 AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz"
GScript("""
for ( i = 1 , 34 , 1 ) {
subtitle(f3+text,x=xspace,y=i*fontsize,font=f3,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
}
""")
The script works if I just use a font value, i.e f1 ... f34
# without a for loop
#~ subtitle(f1+an,x=xspace,y=1*fontsize,font=f1,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f2+an,x=xspace,y=2*fontsize,font=f2,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f3+an,x=xspace,y=3*fontsize,font=f3,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f4+an,x=xspace,y=4*fontsize,font=f4,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f5+an,x=xspace,y=5*fontsize,font=f5,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f6+an,x=xspace,y=6*fontsize,font=f6,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f7+an,x=xspace,y=7*fontsize,font=f7,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f8+an,x=xspace,y=8*fontsize,font=f8,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f9+an,x=xspace,y=9*fontsize,font=f9,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f10+an,x=xspace,y=10*fontsize,font=f10,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f11+an,x=xspace,y=11*fontsize,font=f11,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f12+an,x=xspace,y=12*fontsize,font=f12,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f13+an,x=xspace,y=13*fontsize,font=f13,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f14+an,x=xspace,y=14*fontsize,font=f14,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f15+an,x=xspace,y=15*fontsize,font=f15,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f16+an,x=xspace,y=16*fontsize,font=f16,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f17+an,x=xspace,y=17*fontsize,font=f17,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f18+an,x=xspace,y=18*fontsize,font=f18,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f19+an,x=xspace,y=19*fontsize,font=f19,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f20+an,x=xspace,y=20*fontsize,font=f20,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f21+an,x=xspace,y=21*fontsize,font=f21,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f22+an,x=xspace,y=22*fontsize,font=f22,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f23+an,x=xspace,y=23*fontsize,font=f23,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f24+an,x=xspace,y=24*fontsize,font=f24,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f25+an,x=xspace,y=25*fontsize,font=f25,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f26+an,x=xspace,y=26*fontsize,font=f26,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f27+an,x=xspace,y=27*fontsize,font=f27,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f28+an,x=xspace,y=28*fontsize,font=f28,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f29+an,x=xspace,y=29*fontsize,font=f29,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f30+an,x=xspace,y=30*fontsize,font=f30,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f31+an,x=xspace,y=31*fontsize,font=f31,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f32+an,x=xspace,y=32*fontsize,font=f32,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f33+an,x=xspace,y=33*fontsize,font=f33,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
#~ subtitle(f34+an,x=xspace,y=34*fontsize,font=f34,size=fontsize,text_color=textcolor1, halo_color=halocolor1)
TIA