Posted: 20th Jun 2007 2:37
hi, there is a problem with this code, it says unknown perameter on line 7 (that the line with "initfont("gfont",1)" on it)

i can't seem to figure out why it won't just work

i've tryed taking the "'s out but then it says image not found, even thou it is

any ideas?

+ Code Snippet
sync on
make object box 1,32,32,32



initfont("gfont",1)






do
ftext(20,20,"aftermath beta")
sync
loop

function ftext(x,y,text$)
for t=1 to len(text$)
 a=asc(UPPER$(mid$(text$,t)))
 if a>32 then paste image a,x,y,1
 x=x+13
next t
endfunction

function initfont(font_name, f_num)
   load image "gfx\f_" + str$(font_name) + ".bmp",f_num
   paste image f_num,0,0,1
   x=1:y=1
   for t=65 to 90
      get image t,x,y,x+13,y+14,1
      x=x+14
      if x=183 then x=1:y=y+15
   next t
      for t=48 to 57
      get image t,x,y,x+13,y+14,1
      x=x+14
   next t
   delete image f_num
endfunction
Posted: 20th Jun 2007 3:03
function initfont(font_name, f_num)

Because you are trying to pass a string parameter to an integer. It won't work. And if you change your other variable to an integer, then the Load Image command will fail.

I saw your other thread. You need to learn some programming basics. Start with some tutorials.
Posted: 20th Jun 2007 3:04
i have read through the tutorials, & will read some code aswell,
theres a few things that are a bit hazy but otherwise can do most stuff with basic


i know it doesn't work but how would you go about making it work?

i'm just programming some of the functions for my game, save me having to do it later

ill need alot more skill to put all the functions & scripts together when i've done them all.

...otherwise all the rest of that code works & bitmap fonts are working fine, along with the skybox, some AI and a very basic level editor (to place enimies/active objects & lights)
Posted: 20th Jun 2007 3:25
Assuming that your filename and relative path are correct...
+ Code Snippet
function initfont(font_name$, f_num)
   load image "gfx\f_" + font_name$ + ".bmp",f_num
   paste image f_num,0,0,1
   x=1:y=1
   for t=65 to 90
      get image t,x,y,x+13,y+14,1
      x=x+14
      if x=183 then x=1:y=y+15
   next t
      for t=48 to 57
      get image t,x,y,x+13,y+14,1
      x=x+14
   next t
   delete image f_num
endfunction
Posted: 20th Jun 2007 3:30
hey thanx, easily missed

i allways thought you had to put str$ when it was a string, obviously not.

cheerz
Posted: 20th Jun 2007 3:41
edit: fixed