Author Topic: BottomPrint script help.  (Read 2117 times)

Ok i'm a beginner trying to make a script that shows your kills which are points on your bottom print but it never shows up on the screen in minigame.

Code: [Select]
function GameConnection::dispScore(%cl)
{
        cancel(%cl.dispScore);
        if(%cl.lastScore != %cl.score)
        {
                %cl.bottomPrint("\c6Kills: "@%cl.score, 0, 1);
                %cl.lastScore = %cl.score;
        }
        %cl.dispScore = %cl.schedule(16, "dispScore");
}

Please tell me what i did wrong.

Where is the function initially being called?
Edit: You're telling it to display for 0 seconds. Change the 0 in the bottomprint call to.....not a 0
« Last Edit: August 14, 2013, 02:36:42 PM by Headcrab Zombie »

I did what you told me and I still wont get a Kills: bottomprint on the screen.

This is what i did.
Code: [Select]
function GameConnection::dispScore(%client)
{
        cancel(%client.dispScore);
        if(%client.lastScore != %client.score)
        {
                commandToClient(%client, 'bottomPrint', "\c6Kills: "@%client.score, 1, true);
                %client.lastScore = %client.score;
        }
        %client.dispScore = %client.schedule(16, "dispScore");
}

Try %client.bottomPrint

Where is the function initially being called?

Try %client.bottomPrint
There's like three ways to call bottomprint, they all work the same way.
« Last Edit: August 15, 2013, 08:18:24 AM by Headcrab Zombie »

It still not working can someone help.

This is the last time I ask this before I stop trying to help:
Where is the function initially being called?

Code: [Select]
%cl.bottomPrint("\c6Kills: "@%cl.score, 0, 1);
I guess

The fact that you don't know what I mean suggests your aren't doing it.

Just defining the function isn't enough, you need to call it somewhere; you need to tell the function to run.

Add something like this to your code:
Code: [Select]
package ScoreDisplaySupport
{
function GameConnection::onClientEnterGame(%this)
{
%this.dispScore();
return Parent::onClientEnterGame();
}
};
ActivatePackage(ScoreDisplaySupport);

Code: [Select]
function GameConnection::dispScore(%client)
{
        cancel(%client.dispScore);
        if(%client.lastScore != %client.score)
        {
                commandToClient(%client, 'bottomPrint', "\c6Kills: "@%client.score, 0, true);
                %client.lastScore = %client.score;
        }
        %client.bottomPrint = %client.schedule(16, "dispScore");
}
package ScoreDisplaySupport
{
function GameConnection::onClientEnterGame(%this)
{
%this.dispScore();
return Parent::onClientEnterGame();
}
};
ActivatePackage(ScoreDisplaySupport);

Now the server is stuck on loading objects,this is what it said on console.

base/server/scripts/game.cs (540): Unable to find object: '' attempting to call
function 'getBLID'
BackTrace: ->serverCmdMissionStartPhase3Ac k->[ScoreDisplaySupport]GameConnection
::onClientEnterGame->GameConnection::onClientEnterGame
%
%
base/server/scripts/game.cs (542): Unable to find object: '' attempting to call
function 'schedule'
BackTrace: ->serverCmdMissionStartPhase3Ac k->[ScoreDisplaySupport]GameConnection
::onClientEnterGame->GameConnection::onClientEnterGame

Also i want to know if i can call it when the player joins the minigame.

Whoops
Change return Parent::onClientEnterGame(); to return Parent::onClientEnterGame(%this);

Also i want to know if i can call it when the player joins the minigame.
You'd want to package whatever function is called when you join a minigame, and call dispScore in there.
Then the cancel function in whatever function is called when you leave the minigame.
You can find these functions by typing trace(1); in the console, joining/leaving a minigame, trace(0); in console, then looking through for functions relevant to minigame joining/leaving
« Last Edit: August 15, 2013, 07:08:54 PM by Headcrab Zombie »

Ok everything works now but how do i change colors or the message or change the font.

For color you have two options
<color:######> - Each # is a hex character (from 0-F) in the format RRGGBB where 000000 would be black, FFFFFF would be white, and FFAA00 would be a sort of orange.
Examples:
<color:FFFF00>You're winner! => Yellow colored text saying you're winner
<color:00FF00>Succes => Green colored text

\c# - This is a control character you can place in strings with a # 0-8 corresponding each to a different color. You can find out the relation by typing /colortest in game. I also provided an image. So \c0 is red, \c2 is green, and \c6 is white. Notice these colors correspond to the default colors in blockland so if you need to match one of those colors exactly, you might want to use one of these.

Examples:
\c0Blahblahblah => Red colored Blahblahblah
\c3Help me => Yellow colored Help me

For font:
<font:NAME:SIZE> - The font tag allows you to specify the font name and size you want. The default font is Palatino Linotype (with the space) and size 24. Other commonly used fonts are Impact, Arial, and more (most fonts you see in a word processor like MSWord or open office are available in game.
Examples:
<font:impact:20>Woah!  => Uses the impact font and it's size 20. Looks boldish
<font:palatino linotype:24>Default can be fun too => Default font if you ever need to use if you've changed the font in a string and need to change it back for the rest of the string.

TML (torque markup language which is where the <tag>s come from) can do more things like images, links, text shadow, newlines, and more.

Hope that helps

« Last Edit: August 21, 2013, 09:11:49 PM by DRiOD »