drawbox

O Ilusionista

Captain 100K
Hi, I am trying to use Draw box, following this example
http://www.caskeys.com/arc/games/openbor/wiki/index.php?title=Scripted_Graphics

I use this:
drawbox({x}, {y}, {width}, {height}, {z}, {color}, {alpha})

But it remains on the screen for just 1 tick (centisecond). How to make it stay for X seconds?
 
Solution
finally solved this ok first make any new file for the code i called mine textbox.c you can place this in your levels folder or in your scripts folder for this example I used my scripts folder now copy this code to the textbox.c file:

void main()
{
void box=getglobalvar("textbox");
if(box==1)
  {
  drawbox(0,0,300,200,99999999,0,6);
  }
else
{
}
}

now save it then open your level file that you wish to use this script in and add this line: updatescript data/scripts/textbox.c (add this line after all your main options like music and panel and then save it)

now to activate the box you just made on screen enter this code in before any animation frame:  @cmd setglobalvar("textbox", 1)  and to disable: @cmd setglobalvar("textbox", 0)

I...
This script function needs to be in update.c which runs on every screen tick, im not exactly sure how its called cause i dont like to use scripts that run whole time on every screen update.
I used it for combo onscreen display and different samples after 10 or 15 hits but that used too much memory on psp, its in my old marvel demo.
Find some info about script names and there should be update one.
 
bWWd said:
This script function needs to be in update.c which runs on every screen tick, im not exactly sure how its called cause i dont like to use scripts that run whole time on every screen update.
I used it for combo onscreen display and different samples after 10 or 15 hits but that used too much memory on psp, its in my old marvel demo.
Find some info about script names and there should be update one.

very interesting i will have to look in to the update.c file thanks bwwd
 
ok so i have made a simple script in update.c but when my mod starts a level it crashes and i get the error in my log:

There's an exception while executing script 'update'

the code i am using is:

void showbox()
{
void textbox=getlocalvar(textbox);
if(textbox==1)
{
drawbox(0,0,200,200,9999,rgbcolor(255,255,0),1);
}
}

can anyone tell me what "if(!textbox)" and "if(textbox)" mean ?
 
finally solved this ok first make any new file for the code i called mine textbox.c you can place this in your levels folder or in your scripts folder for this example I used my scripts folder now copy this code to the textbox.c file:

void main()
{
void box=getglobalvar("textbox");
if(box==1)
  {
  drawbox(0,0,300,200,99999999,0,6);
  }
else
{
}
}

now save it then open your level file that you wish to use this script in and add this line: updatescript data/scripts/textbox.c (add this line after all your main options like music and panel and then save it)

now to activate the box you just made on screen enter this code in before any animation frame:  @cmd setglobalvar("textbox", 1)  and to disable: @cmd setglobalvar("textbox", 0)

I am guessing this is the same if you want to use the drawsrpite option hope this helps anyone who wants to use these options !
 
Solution
Back
Top Bottom