Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

'get'' this'

10 replies · 2,513 views · Started 04 December 2009

..And I'll never post a more clever title than that ever. 😛

So anyway, get this:

void doControls15()
{
if( Link->getPressUp() ) MoveSelected15( 0 );
if( Link->getPressDown() ) MoveSelected15( 1 );
if( Link->getPressLeft() ) MoveSelected15( 2 );
if( Link->getPressRight() ) MoveSelected15( 3 );
if( Link->getPressA() ) MovePiece15();
Link->X = 16;
Link->Y = 16;
}

This is what you have to do to get these to compile in 1104. Strangely enough some other functions such as "->X" don't need the full get or setX to parse.

_L_ you got any insight? I'm sure these were working fine in build 1089.

Uh?

bool PressUp
* True if this key's state was activated this frame.
* Writing to this variable simulates the press or release of the keys input press state.

ergo

void doControls15()
{
if( Link->PressUp ) MoveSelected15( 0 );
if( Link->PressDown ) MoveSelected15( 1 );
if( Link->PressLeft ) MoveSelected15( 2 );
if( Link->PressRight ) MoveSelected15( 3 );
if( Link->PressA ) MovePiece15();
Link->X = 16;
Link->Y = 16;
}

(I suspect you already figured this out, based on the other thread, but for other people's reference...)

Well for now we apparently need them.

Seems to apply to some but not all of the pointer functions that actually return something. Very annoying.

		if( Link->getInputUp() ) DPad[0]++;
if( Link->getInputDown() ) DPad[1]++;
if( Link->getInputLeft() ) DPad[2]++;
if( Link->getInputRight() ) DPad[3]++;

Link->InputUp = false;
Link->InputDown = false;
Link->InputLeft = false;
Link->InputRight = false;

That's because they're only added by the internals to point to the correct function. ex;

Link->Wife = take_half_ his_stuff // type void , sets value
if(Link->Gay) // type bool , gets value

That's why it's a bug.

As I understand, all of the 'variables' in ZScript are turned into functions before being broken down into ASM. So '->X' is actually made up of a '->getX' and a '->setX' component.

I think I just realized something....

ffc script useless
{
void run()
{
int i;
if( Link->PressUp() ) i++;
if( Link->PressDown() ) i++;
if( Link->PressLeft() ) i++;
if( Link->PressRight() ) i++;
if( Link->PressA() ) i++;
}
}

Could someone with build 1119 through 1122 see if this compiles with no problems?

EDIT: NVRMD... :|

This thread is full of confuse.

I just tried this:

void test() {
Link->PressUp;
}

And, it compiled (even though it does less than nothing). So... bug? Or, what?

Gleeok wrote:Hmm... That's odd. Try the one I posted. Failed for me earlier today.


Well, yeah. The one you posted is entirely wrong. Press* are variables, not functions. Get rid of the trailing parentheses!

Oh! Funny that no one noticed 'till now. Good eye. :P

Fun fact! -You can use any variable in ZScript as functions by adding an "()" at the end! o: