Answered Could something like this work?

Cxwh

Veteran
Messages
64
Reaction score
45
Points
793
Is there any way to get something like this to work?
Code:
function monitorButtons()
{
    test = &testButton;
    for(;;)
    {
        if(test)
            self iPrintln("^1test");
        wait 0.05;
    }
}

function testButton()
{
    //level.players[0] since you cant pass args
    return level.players[0] jumpButtonPressed();
}

//ik it gets used like self [[ &testButton ]](); (i mean function pointers)
//just askin if something like this could work?
 
Last edited:

CabCon

Head Administrator
Staff member
Head Staff Team
Messages
4,873
Reaction score
2,882
Points
1,053
Is there any way to get something like this to work?
Code:
function monitorButtons()
{
    test = &testButton;
    for(;;)
    {
        if(test)
            self iPrintln("^1test");
        wait 0.05;
    }
}

function testButton()
{
    //level.players[0] since you cant pass args
    return level.players[0] jumpButtonPressed();
}

//ik it gets used like self [[ &testButton ]](); (i mean function pointers)
//just askin if something like this could work?
Yes, this should work like this:
Code:
function monitorButtons()
{
    for(;;)
    {
        test = testButton();
        if(test)
            self iPrintln("^1test");
        wait 0.05;
    }
}

function testButton()
{
    return level.players[0] jumpButtonPressed();
}
 
Top