Author Topic: Sending a new bottom print to the player without overriding the previous.  (Read 1344 times)

I'm trying to make it so my add-on can constantly display something in a player's bottom print without clearing the previous bottom print sent to the player. One way I was thinking about would be using something like this:
Code: [Select]
package examplePackage {
function commandToClient(%this,%function,%a,%b,%c,%d,%e,%f,%g,%h,%i,%j,%k,%l,%m,%n,%o) {
Parent::commandToClient(%this,%function,%a,%b,%c,%d,%e,%f,%g,%h,%i,%j,%k,%l,%m,%n,%o);
if(%function $= "BottomPrint") {
%this.currentBottomPrint = %a;
%this.currentBottomPrintTime = %b;
%this.currentBottomPrintBar = %c;
}
if(%function $= "ClearBottomPrint") {
%this.currentBottomPrint = "";
%this.currentBottomPrintTime = "";
%this.currentBottomPrintBar = "";
}
}
function exampleFunction(%client) {
if(%client.currentBottomPrint !$= "")
commandToClient(%client,'BottomPrint',%client.currentBottomPrint @ "\nExample",-1)
}
};
Note: I haven't actually tested the code and it clearly isn't perfected to what it should be.

Would this be the best (or a possible) way to do that? If not, is there a better (or possible) way to do it?

%cl.bottomPrint( "foo", 0 );
exampleFunction( %cl );
exampleFunction( %cl );


Suddenly, %cl has "foo\nExample\nExample" as their bottomprint. Is this really what you're intending? Also, why are you saving the line count (currentBottomPrintBar) without using it for anything?

%cl.bottomPrint( "foo", 0 );
exampleFunction( %cl );
exampleFunction( %cl );


Suddenly, %cl has "foo\nExample\nExample" as their bottomprint. Is this really what you're intending? Also, why are you saving the line count (currentBottomPrintBar) without using it for anything?
The script is just supposed to be an example, I whipped it up in a minute with the purpose of illustrating what I meant, not with the purpose of actually being used.

The script is just supposed to be an example, I whipped it up in a minute with the purpose of illustrating what I meant, not with the purpose of actually being used.

Last time I tried packaging commandToClient, it didn't work, but that may just be me remembering things wrong. This is the best way of doing it if a client-sided add-on is not an option and you want it to be compatible with as many other add-ons as possible.

I was never able to package commandToClient because %function is a tagged string.

I was never able to package commandToClient because %function is a tagged string.
How is that a problem?

Might give you some ideas:
Code: [Select]
%msg = "Your current bottomprint.";
%msg2 = %msg SPC "\n2nd line on bottomprint..";
« Last Edit: December 22, 2012, 05:29:03 PM by Honorabl3 »

I was never able to package commandToClient because %function is a tagged string.
I'm pretty sure you aren't able to package commandToClient because Badspot doesn't want you to screw it up.

Might give you some ideas:
Code: [Select]
%msg = "Your current bottomprint.";
%msg2 = %msg SPC "\n2nd line on bottomprint.."
That doesn't allow compatibility with other add-ons though. =/

It is possible client sided.. (Even though you won't need this information)

How is that a problem?
because it made the client explode?