does acs have some sort of "null"

I'm trying to make a fake class in acs I guess. This is the main data for a point. "Instance variables" are spread to multiple arrays (I suspect doing so removes complex nesting, ie. not going points[2][2] but rather zs[2] to refer to the z of the 3rd point, and also "zs" is self describing (a list of z floats) whereas [2] is cryptic and requiring knowing it means "z").:

xs[3] = {5,9,7};
ys[3] = {8,4,2};
zs[3] = {2,8,1};

Index starts on 0, so the 3rd point is 7,2,1:

Anyway, if I want to delete/erase index 1:
I could set them to null or something (i noticed "no" is color coded red in acs so maybe that's it), then basically "if that spot is null, consider it erased/gone".
If I use 0s instead, 0/0/0 is still a valid point location. So if there aren't any nulls, I guess I could add another "instance variable"
alive[3] = {1,1,1}
then just set the alive bit off for an erased one:

I intend all the "instance variables" and functions to have the prefix "p_" to stand for point, just to organize everything and make it obvious which function are supposed to go with which "objects" (really just an index to all the "instance variable" arrays like xs/ys/zs), like p_xs, p_newIndex(), p_rotate(pointIndex, angle), bla bla

Share this post

Link to post

NULL is 0.

Boolean keywords like NO or FALSE are also 0.

What you want is NaN (not-a-number). There is no coding for such a value in ACS; since all variables are really integers. (Even decimal values are really integers, thanks to the magic of fixed point.)

So you have two choices: either set some sort of magic number which will mean "not a number" in your code (and you'll have to check for it), preventing from using it legitimately; or use an additional variable to keep track of whether the whatever it is is valid or not.

Share this post

Link to post

Ok, thanks, I'll go with the additional variable.

I like the idea of "erasing" an element of an array by packing it with filler, because all the indexes after that (which function as IDs) don't bump down 1 place like with python lists. Just give precedence to use the filled "holes" as the next new point indexes/ids.

Share this post

Link to post

And there is no way to create a nullable type in acs?
Like in C# using int? nullableInt = null or bool? nullableBool = null
In C++ NULL is actually 0 though... maybe a const int null = 0 ? But I'm not sure you can create a constant in acs...

Share this post

Link to post

You can make a constant like this in acs:
#define a 134
and you can use a constant in outermost scope (where arrays have to be declared)
int bla[a];
makes a 134 long array.
(you can't use a normal variable in outer scope, other than declare it, and can only do equations etc with them inside scripts)

I'd probably use a constant for total number of point instances possible, like:
#define p_maxPoints 256

Share this post

Link to post

EDIT: here's some stuff I found out:
* spawn an imp, then constantly setactorpitch() to the imp has no affect on the imp (other than having getactorpitch() print what you set it to.. but seems bound by 0.25999, and probably the negative of that)
* Constantly setactorpitch(-0.25) to the player will make him constantly look down (y-shear), and printing getactorpitch() will print "-0.25" even though its supposed to be bound by -0.0888977.
* spawnprojectile("doomimpball, bla bla) then constantly setactorpitch() to that projectile has no affect on the projectile. Same if you spawn() the projectile so it just sits there.
* spawn an imp, then spawn a doomimpball inside the imp hurts the imp even though they're supposed to be immune to doomimpballs (also spawn a projectile outside the imp that runs into the imp also hurts him)
I'm guessing normal projectile attacks don't spawn from the monster center but from in front of the monster outside its bounding box.

may as well ask this too.

I thought of making a thing class with th_bla variables and "methods"/functions to operate on those variables.

Things already seem wrapped up in a class in acs, so it might be kinda pointless to re-wrap them in my own fake "class". At least one reason though is to keep track of TIDs (deleting and getting an unused one as necessary).

Each thing would probably have a pointIndex variable referring to the index of the point in the point class that works as the thing's center.

NEWAYZ I thought of giving each thing an "angle" and "pitch" variable, but then I thought about pitch and y-shearing:
and now I suspect that "pitch" is meaningless for anything but a camera? Like you can setActorPitch to an imp, but does that have no effect on anything? You might think that would affect the direction it shoots projectiles, but projectiles are their own things with their own direction, probably not having any basis on the imps pitch. (not sure if setActorPitch would affect the projectile itself).
Plus there is the "Due to the limits of freelook in the software renderer, this value is bounded by -0.0888977 and 0.155548" problem of not being able to pitch directly upward/downward (not sure if you can SET outside those bounds but only the y-shearing is limited, like I think a projectile can shoot straight up).
Maybe I could just give each thing a 2nd orbitting point which could orbit anywhere and function as its overall pitch/angle/direction.

I guess I could find some of this stuff out with some code tests, but then I don't get to type stuff in a forum!

And since you like answering my questions so much, when an imp spawns a fireball right from its center (assuming that is the spot), I'm guessing it doesn't collide with the imp itself because it knows the imp was the "activator/creator" of the fireball and just ignores that tag for collisions or something?

If I want gravity free imps bouncing around the room and NOT colliding into eachother, acs-only solutions are maybe to set the mass or width or something to 0 (and gravity to 0)? noclip seems decorate-only. I can spawnForced but then they'd probably block the player if they spawn on top of him.

Share this post

Link to post

It's also pretty likely that you won't ever have anything at the complete extents of your maps. You can use the constants 0x7FFFFFFF for positive ranges and 0x80000000 for negative ranges. But pick one and only use that and treat it as your null (although you shouldn't consider it null but INVALID or something like that).

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