Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Mordeth

SetCallback..?

Recommended Posts

In Eternity's default start map, there's a function that allows for a "sliding door" trick:

public SDoorCB()
{
   static tag = 15;

   SectorSetSpecial(2048, tag);
   FloorAction(false, PlaneUp, FLOORSPEED, FNoChg, tag, 0, FtoLnF);
   tag += 1;
   if(tag < 21)
      SetCallback("SDoorCB", WAIT_DELAY, 1);
}
Couple of questions about this... firstly, why the use of semi-colons? Thought these are optional for Small. More importantly, why use SetCallback and not eg. a "for" loop?

Share this post


Link to post

I am accustomed to using semicolons. I frequently use them in EDF also, but usually only with inline definitions because they look better that way.

The SetCallback is *not* optional for this effect. If you used a for loop here, all of the sectors would move at once. Instead, they need to move one at a time, one gametic apart. This makes the door appear to slide open very quickly.

Of course, with PolyObjects in place, this kind of hackery is now less useful. I will not, however, be updating the start map since it works well enough as-is.

Share this post


Link to post

Quasar said:
The SetCallback is *not* optional for this effect. If you used a for loop here, all of the sectors would move at once. Instead, they need to move one at a time, one gametic apart. This makes the door appear to slide open very quickly.


Ah, because there's no "delay" type pointer, except for the one in that SetCallback function? Ok, I see.

Share this post


Link to post

Right. Small doesn't support pausing scripts at an arbitrary point (actually it is supposed to, but it is extremely buggy and I decided it was best not to mess with it). Instead, I have added scheduled callbacks, which can ultimately accomplish everything that delays can do, just in a different way.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×