This is a simple status bar that allows scripters to display info in a little window, that stays unfocused so you can still move & turn ect. with it open.
For clients:
Simply download this:
http://www.mediafire.com/?zzgma90129uand
extract to blockland/add-ons/clientNow you can use your status bar on status bar enabled servers(be sure to bind a key to toggling it and turn it on!)
For developers:
Since you should know how to make .cs files Im just going to put up the codes and explain them. This is a simple little add-on but I released it so that
1) new coders could get a feel for client-server relations
2) we could use a universal GUI so clients have a 1-time download
3) save coders time when developing GUIs
anyways, lets take a look here.
StatusB.cs
//statusbar serverside
function servercmdSendStatusData(%client){
%i=0;
while(%i<$stcount){
%data = %data @ $stname[%i] @ ":" @ stvarget(%client,%i) @ "|";
%i++;
}
%client.hasgui=1;
commandtoclient(%client,'ReStatusData',%data);
}
function servercmdUpStatusData(%client){
commandtoclient(%client,'UpStatusData');
if(!%client.hasgui){
schedule(1000,0,"nohavegui",%client);
}
}
function nohavegui(%client){
if(!%client.hasgui){
messageclient(%client,'',"Goto the forums, modification discussion, Status bar and you!. First post, download the client files.");
}
}
What this script does:
1) handles the commands for sending data & telling the client to request data
2) if they dont have the gui it tells them to get it
Simply put
servercmdUpStatusData(%client);
in places where the variables shown on the status bar are changed, or stick it in a loop. Clients can also say /UpStatusData to update the statusbar.
ST.cs
if(!$stmaps){
$stname[0]="Cash";
$stcount++;
$stname[1]="Hunger";
$stcount++;
$stname[2]="Food";
$stcount++;
$stname[3]="FoodSell";
$stcount++;
$stname[4]="Class";
$stcount++;
$stname[5]="Time";
$stcount++;
$stmaps=1;
}
function stvarget(%client,%i){
if(%i==0){
return stvar0(%client);
}
if(%i==1){
return stvar1(%client);
}
if(%i==2){
return stvar2(%client);
}
if(%i==3){
return stvar3(%client);
}
if(%i==4){
return stvar4(%client);
}
if(%i==5){
return stvar5(%client);
}
if(%i==6){
return stvar6(%client);
}
}
function stvar0(%client){
if(!%client.money){%client.money=0;}
return %client.money;
}
function stvar1(%client){
if(!%client.hunger){%client.hunger=0;}
return %client.hunger;
}
function stvar2(%client){
if(!%client.food){%client.food=0;}
return %client.food;
}
function stvar3(%client){
if(!%client.foodsell){%client.foodsell=0;}
return %client.foodsell;
}
function stvar4(%client){
if(%client.hobo){%class="Hobo";}
if(!%client.hobo){
if(!%client.mafia){
%class="Normal Person";
}
if(%client.mafia){
%class="Mafia";
}
}
return %class;
}
function stvar5(%client){
if($hoboday){%class="Night";}else{%class="Day";}
return %class;
}
function stvar6(%client){
return;
}
This is an example script for entering the variables that show up on the status bar, taken from my hobo game.
This script:
1) sets up the variables( see the top portion )
2) handles the functions that give the variables to the function that sends them to the client.
To set up your variables
if(!$stmaps){
$stvar[0]="name1";//name of the first variable
$stcount++;//add one to the count of variables
$stvar[1]="name2";//name of the second variable
$stcount++;//remember to do this after each name you define
$stmaps=1;
}
To give the variables to the updating functions
function stvarget(%client,%i){
if(%i==0){//if the variable 0 is requested
return stvar0(%client);//give it to them
}
if(%i==1){//same as above, but for variable 1
return stvar1(%client);
}
}
and
function stvar0(%client){
return %client.money;// send the clients money
}
function stvar1(%client){
if(%client.yeti){
%t="yes";//it will send yes
}else{
%t="no";//it will send no
}
return %t;//send yes/no
}
Advanced:Changing formating:
while(%i<$stcount){
%data = %data @ $stname[%i] @ ":" @ stvarget(%client,%i) @ "|";
%i++;
}
this is the default formatting see in StatusB.cs
to change it, take this line
%data = %data @ $stname[%i] @ ":" @ stvarget(%client,%i) @ "|";
var1:0|var2:1|var3:yes|
and change it.
%data = %data @ "[" @ $stname[%i] SPC "/" SPC stvarget(%client,%i) @ "]";
[var1 / 0][var2 / 1][var3 / yes]
Thats all, enjoy this little resource. Tell me if you encounter any errors or if I did something horribly wrong and should be sent to hell.