Author Topic: "Looping" something in the bottom print?  (Read 2887 times)

I'm trying to figure out how you can keep something in the bottom print... Seeing as a regular function (function displayscore(%client) { stuff...) didn't do it for me, I'm wondering how you can keep something in the bottom print.

In one of my mods, I set the time to -1 and it still wouldn't stay forever, so what I did was, since I needed it anyways, I had a looping tick and whenever the tick passed, it'd show the bottomprint to all clients.

In one of my mods, I set the time to -1 and it still wouldn't stay forever, so what I did was, since I needed it anyways, I had a looping tick and whenever the tick passed, it'd show the bottomprint to all clients.
How would you make a looping tick?

How would you make a looping tick?
Code: [Select]
function tickthing()
{
  cancel($tickthing);
  //STUFF
  $tickthing = schedule(time,0,tickthing);
}

If you dont specify a time, it should just stay up forever.

Code: [Select]
function tickthing()
{
  cancel($tickthing);
  //STUFF
  $tickthing = schedule(time,0,tickthing);
}
Alright, so I have that...
Code: [Select]
function displayscore(%client, %mini)
{
   cancel($GunGame::DisplayScore);
   //stuff
   $GunGame::DisplayScore = schedule(3000,0,displayscore);

And I have a command that triggers it, I tried both displayscore(); and $GunGame::DisplayScore = schedule(3000,0,displayscore); and neither have worked. =/

Alright, so I have that...
Code: [Select]
function displayscore(%client, %mini)
{
   cancel($GunGame::DisplayScore);
   //stuff
   $GunGame::DisplayScore = schedule(3000,0,displayscore);

And I have a command that triggers it, I tried both displayscore(); and $GunGame::DisplayScore = schedule(3000,0,displayscore); and neither have worked. =/
Did you add the actual centerprint code?

Did you add the actual centerprint code?
Yeah, I have the bottomprint stuff in there.

Alright, so this is how my loop is activated...
Code: [Select]
function serverCmdtogglegungame(%client)
{
if(!%client.isSuperAdmin)
{
messageClient(%client, '', "\c0You are not allowed to use this command.");
return;
}

if($GunGame::Status == 0)
{
activatePackage(GunGame);
chatMessageAll(%client, "\c6Gun Game Enabled!");
$GunGame::Status = 1;
$GunGame::DisplayScore = schedule(3000,0,displayscore);
$GunGame::GrenadeTickLoop = schedule(100,0,grenadetickloop);
return;
}
        //The rest of the stuff...

and this is my loop.

Code: [Select]
function displayscore(%client,%mini) //Displaying the score to the clients.
{
cancel($GunGame::DisplayScore);
%leveldiff = %client.score - %mini.member0.score;
if(%leveldiff > 0)
commandToClient(%client, 'BottomPrint', "\c3You are at level \c6" @ %client.score @ "\c3. You are \c6" @ %leveldiff @ "\c3 levels behind the leader.", 3);
else
commandToClient(%client, 'BottomPrint', "\c3You are at level \c6" @ %client.score @ "\c3. You are the leader!", 3);
$GunGame::DisplayScore = schedule(3000,false,displayscore);
}

I tried triggering the loop with displayscore(); and it did not work. I tried switching out 0 for false (yes, I know they are the same thing. I just wanted to see if it would work) and that didn't work.

What am I doing wrong? :o

This is (basically) the code I used. I used a servercmd and a time of -1. Even though it's -1, it goes away after about three minutes, so every three minutes, it brings it back up.
Code: [Select]
function serverCmdInfo(%client)
{
commandToClient(%client,'bottomPrint',"TEXT", -1, 2, 3, 4);
}

Code: [Select]
function thing_tick()
{
cancel($thingTick);
for(%i = 0; %i < clientGroup.getCount(); %i++)
serverCmdInfo(%client);
$thingTick = schedule(3*60000,0,thing_tick);
}

Theres 2 steps to this.

first what everyone has said, you use -1 as the time so it stays forever.

next - is to disable the minigame score display

just add this to your script
Code: [Select]
function MinigameSO::displayScoresList(%this)
  {
   // do nothing
   echo("display scores bypassed");
  }
adding it to a package is optional - but do NOT call Parent or it wont work.

This is what I do for my mining mod and it works great.  No need for schedules or anything else.

next - is to disable the minigame score display
I never even thought of that.

Theres 2 steps to this.

first what everyone has said, you use -1 as the time so it stays forever.

next - is to disable the minigame score display

just add this to your script
Code: [Select]
function MinigameSO::displayScoresList(%this)
  {
   // do nothing
   echo("display scores bypassed");
  }
adding it to a package is optional - but do NOT call Parent or it wont work.

This is what I do for my mining mod and it works great.  No need for schedules or anything else.
Alright a few questions...
1) If I put -1 as the time, does it still update?
2) When it bypasses the Minigame Score Display is it that score display in TDM?
3) Is there a way to do this with T+T's ammo?

This is (basically) the code I used. I used a servercmd and a time of -1. Even though it's -1, it goes away after about three minutes, so every three minutes, it brings it back up.
Code: [Select]
function serverCmdInfo(%client)
{
commandToClient(%client,'bottomPrint',"TEXT", -1, 2, 3, 4);
}

Code: [Select]
function thing_tick()
{
cancel($thingTick);
for(%i = 0; %i < clientGroup.getCount(); %i++)
serverCmdInfo(%client);
$thingTick = schedule(3*60000,0,thing_tick);
}
I'll mess with that and see what I get.

Alright a few questions...
1) If I put -1 as the time, does it still update?
if you want a different value, you have to send bottom print again.
what i gave, prevents the minigame score display from overwriting what you print out.


Alright a few questions...
2) When it bypasses the Minigame Score Display is it that score display in TDM?
yes I think this is the same thing.
trace(1) is your friend here -- use it often to see whats going on.

was this ever resovled?