Jump to content

Timers


Morgan

Recommended Posts

Are timers in any way possible in BoA?

 

The most obvious way, as I saw it, was to do the following -

 

inc_flag(0,0,1);

if(get_flag(0,0) == 5)

{

code chunk

}

break;

 

Unfortunately, when I put this in the START_STATE in a town script, it tells me I have an improper command. I figured this was because the game thought I was creating an eternal loop (though I wasn't - the code I'm using is a bit more complex then that), but I'm not entirely sure what to do about it. I also tried it with variables.

 

Any ideas for making this work, or an alternative timer?

 

Scrap that. I found me a workaround -

 

beginstate START_STATE;

 

if(get_flag(180,1) == 0)

{

timer = get_current_tick();

set_flag(180,1,1);

}

 

if((get_current_tick()) == (timer + 6))

{

add_dialog_str(0,"This is working",0);

add_dialog_choice(0,"Done");

run_dialog(0);

}

 

break;

 

Where timer is (obviously) a variable.

Link to comment
Share on other sites

If I'm understanding you correctly, and you're wanting an event that happens every nth tick, an alternative would be:

 

if ((get_current_tick() % n) == 0) {

// do stuff here

}

 

(where n is the number of ticks between occurences). Of course, that doesn't allow you to start on a particular tick and then every nth one after that... it just hits every nth one starting with the next multiple of n.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...