Author Topic: How would I loop a bottom print like when a player spawns  (Read 676 times)

How would I loop something like when a player spawns I want to make a bottomprint never end, until that client left the server.

Does it need to update?
If not, you can call commandToClient(%client, 'bottomPrint', "message", 0); to make it last forever.

an event that has bottomprint would probably end it though
also, there are two addons that do this already, search for VCE prints

Does it need to update?
If not, you can call commandToClient(%client, 'bottomPrint', "message", 0); to make it last forever.
Forever, as in, until clientCmdBottomPrint is called again.

Since it sounds like you're using this for all clients, use a schedule which uses for(%i = 0; %i < clientGroup.getCount(); %i++) to update it for all clients.

Warning - while you were typing a new reply has been posted. You may wish to review your post.
an event that has bottomprint would probably end it though
also, there are two addons that do this already, search for VCE prints

Yeah, referencing add-ons which do similar things is more often than not even better than using Coding Help.

for(%i = 0; %i < clientGroup.getCount(); %i++) to update it for all clients.
Or just use commandToAll

package foobar
{
    function gameConnection::setControlObject( %this, %obj )
    {
        parent::setControlObject( %this, %obj );

        if ( %obj.getType() & $TypeMasks::PlayerObjectType )
        {
            %obj.yourBottomPrintTick();
        }
    }
};

activatePackage( "foobar" );

function player::yourBottomPrintTick( %this )
{
    cancel( %this.yourBottomPrintTick );

    if ( !isObject( %cl = %this.getControllingClient() ) )
    {
        return;
    }
   
    commandToClient( %cl, 'BottomPrint', "pink fluffy unicorns dancing on rainbows: " @ $Sim::Time, 0.4 );
    %this.yourBottomPrintTick = %this.schedule( 200, "yourBottomPrintTick" );
}

How would I loop something like when a player spawns I want to make a bottomprint never end, until that client left the server.

Whoops.

package foobar
{
    function gameConnection::onClientEnterGame( %this )
    {
        parent::onClientEnterGame( %this );
        %this.yourBottomPrintTick();
    }

    function gameConnection::onClientLeaveGame( %this )
    {
        cancel( %this.yourBottomPrintTick );
        parent::onClientLeaveGame( %this );
    }
};

activatePackage( "foobar" );

function gameConnection::yourBottomPrintTick( %this )
{
    cancel( %this.yourBottomPrintTick );
    commandToClient( %this, 'BottomPrint', "pink fluffy unicorns dancing on rainbows: " @ $Sim::Time, 0.4 );
    %this.yourBottomPrintTick = %this.schedule( 200, "yourBottomPrintTick" );
}
« Last Edit: August 25, 2012, 06:41:54 AM by Port »