Jump to content

Ticks


Xaiya

Recommended Posts

In the appendix, it has a neat section about ticks. It showed a few bits that had to do with it.

 

...But I don't think that is all.

 

Is there somewhere that has all that has to do with ticks and explaining ways to use them? Looking at other scripts is kind of confusing with this.

Link to comment
Share on other sites

How to print time, useful when writing a scenario:

s = get_current_tick() % 5000;

print_big_str("The time is now ",s," minutes.");

 

The BoA day:

3,750 start of dusk

4,000 it gets darker

4,250 darker still

4,500 midnight

4,750 brighter

5,000 brighter still

5,250 daylight

 

See my posts in this forum, or is it the Lyceum?, on timers in BoA.

Link to comment
Share on other sites

A single tick is one movement in the game, or one round of combat. So, when you move your PC one space, that is one tick. When you complete one round of combat, that is also one tick. Ticks are, as Laz said, really only useful if you want something to happen a set amount of time after a particular event, or, if you want to do something with lighting.

Link to comment
Share on other sites

Know what ticks are is pretty much all there is to know. They tell you what time it is, so you can use them to solve problems involving needing to know what time it is. The only other thing to be aware of is that you can also set what time it is by using set_ticks_forward(). It's handy to be aware of these tools in case you need them, but they aren't terribly interesting in and of themselves.

Link to comment
Share on other sites

Wouldn't set_time_forward actually set the ticks forward or backward instead of actually setting it?

 

Also, tick_difference call makes no sense.

 

I've also been trying to say that all calls related to ticks are not in that section. I saw a call in a script that wasn't with the other calls in the tick section in the appendix.

 

It's not like I'm trying to be dumb, but seeing that makes me confused since the appendix supposedly has all the calls.

Link to comment
Share on other sites

set_ticks_forward(value - get_current_tick()) will set time to value. Note that you can turn back time with a negative number, which is important here.

 

tick_difference() is about as useless as it would appear. Great for those of us who don't know how to subtract... tongue

 

set_ticks_forward and get_current_tick are the important ones, and pretty much the only ones. I don't know of any tick calls not in the appendix, but if that's your question then why don't you say what the call is. You know, instead of just asking how ticks work. tongue

Link to comment
Share on other sites

*sigh* I have still barely scratched the surface of BoA scripts and this is simple compared to other stuff.

 

If I had known I could manipulate calls like that (with doing a whole bunch of stuff inside the ()'s), than it might have made things easier...

 

Good thing I'm good with Algebra...

 

So the only drawback of setting the time yourself is that the day thing will be different. Oh well, this is for the end of the scenario.

Link to comment
Share on other sites

Since The Lyceum seems to be a not very popular ghost town these days I will reprint my last post here:

 

Finally, I have come up with a timer that can be used in a chain and is not affected

by the length of the intervals between the various states. Previously all intervals

had to be a multiple of the same number. This version is intended for intervals that

are less than 256 turns.

Here u is the time delay in turns and w is the state that is called when the timer

runs out. As no script can have more than 20 variables, there is a distinct limit as to

how many timers you can have running at the same time.

 

If it is desired to have a timer running from the time that the party enters the town,

just initialize u and w with different values.

 

The example below is highly condensed and only includes the details of the timer, it

is taken from the BoA port of the BoE scenario River and Leaf. The sequence

starts when the party walks into a line of squares and triggers state 16.

Incrementing flag (121,0) makes the timer work.

 

// TOWN SCRIPT

// Town 21: The Dacgban (L2)

 

begintownscript;

 

variables;

 

short i,j,k,r1,t,x,y,choice;

short u = 0;

short w = 0;

 

body;

 

 

beginstate START_STATE;

if (u == 0)

end();

 

if ((get_flag(121,0) > 0) && (get_flag(121,0) <= u)){

inc_flag(121,0,1);

set_state_continue(50);

}

 

break;

 

// Activated by walking into a square

beginstate 16;

set_state_continue(19);

break;

 

beginstate 19;

reset_dialog();

add_dialog_str(0,"The captain's room behind you erupts in a blast of water!

Someone must have drilled through the ship's hull. The bay's fury is pouring

frantically into the lower deck. Duty, it seems, has prompted this suicidal attack.",0);

 

set_flag(121,0,1);

u = 5;

w = 21;

break;

 

beginstate 21;

message_dialog("The ship shudders and turns, sinking rapidly. You had

better make it to the top soon.","");

set_flag(121,0,1);

u = 5;

w = 23;

break;

 

beginstate 23;

message_dialog("Blasts of water fill in from everywhere. You don't make it

another two steps before being overwhelmed.","");

i = 0;

while (i < 6) {

if (char_ok(i)) {

kill_char(i,2,0);

}

i = i + 1;

}

break;

 

 

 

beginstate 50;

(This state provides for the steady flooding of the town with water, as detailed in my

post Sinking Ships.)

 

if (get_flag(121,0) == u)

set_state_continue(w);

break;

 

 

For intervals longer than 255 turns it is simple enough to use a number generated

by (256*get_flag(121,0) + get_flag(121,1).

 

For a multi day timer it might be simpler to use the day number:

 

beginstate 16;

if (what_day_of_scenario() < (get_flag(211,22) + 2))

message_dialog("The herb patch hasn't grown back yet.","");

else set_state_continue(18);

break;

 

beginstate 18;

reset_dialog_preset_options(1);

add_dialog_str(0,"You find a small patch of Energetic Herbs in the

swamp.",0);

choice = run_dialog(1);

if (choice == 2) {

if (reward_give(216)) {

set_flag(211,22,what_day_of_scenario());

}

}

break;

Link to comment
Share on other sites

Actually, I was wondering about ticks in general. Outside of BoA. For example, what is a tick in Geneforge? Do all programs define ticks differently? In Revolution (a slightly high-level programming language), a tick is 1/60 sec. In Ares, a dying but great game, a tick is 1/20 sec. In BoA (obviously) a tick is a turn. But does a tick have one master definition, or is that up to the programmer?

Link to comment
Share on other sites

In BoA time never passes unless the party moves somewhere. (Edit: time will also pass if a PC casts a spell or uses an item.) Thus there is no connection whatsoever between time in the game and time in the real world. I determined this by altering the Start State to show the current game time, using the method outlined in my post on August 17.

 

By contrast, in real time games there may well be a definite connection between the two.

 

Unlike "word" or "short" the word "tick" has no inherent meaning in programming. Thus its meaning is always purely subjective.

Link to comment
Share on other sites

Iffy, what exactly is it you want? I see you quoted HIM scripts, and you say you want something like in HIM. Do you mean the earthquakes? If you want, you can send me a PM and I can tell you what is happening in the scripts of HIM. I think that probably, if you understand better what is going on in these scripts, you'll also better understand the working of ticks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...