Author Topic: finding stats to do with the server  (Read 1239 times)

Right then guys. I am learning to script within Blockland which I shall post a lot of topics. But let me get to the point.

I am making a script which is client sided, but I was wondering if I would be able to find out the functions for...

*The name of the server.
*My Blockland Identification number.
*My Client ID.
*My Blockland Name.
*My score within the server.

Thank you.

*The name of the server. = Substring operations on NPL_Window.getValue()

Code: [Select]
function getServerName()
{
%value = NPL_Window.getValue();
%pos = strPos( %value, " Players - " );

if ( %pos < 0 )
{
return "";
}

return getSubStr( %value, %pos + 11, strLen( %value ) );
}

*My Blockland Identification number.

getNumKeyID()

*My Client ID.

What do you mean by this?

*My Blockland Name.

$Pref::Player::NetName
« Last Edit: January 28, 2012, 01:45:40 PM by Port »

*My Client ID. = What do you mean by this?
Uh, as in my Object ID when I have spawned.

Code: [Select]
function getServerName()
{
return $ServerInfo::Name;
}

function getMyScore()
{
%count = NPL_List.rowCount();

for ( %i = 0 ; %i < %count ; %i++ )
{
%row = NPL_List.getRowText( %i );

if ( getField( %row, 1 ) $= $Pref::Player::NetName && getField( %row, 3 ) == getNumKeyID() )
{
return getField( %row, 2 );
}
}

return 0;
}

function getMyPlayer()
{
return serverConnection.getControlObject();
}

function getMyName()
{
return $Pref::Player::NetName;
}

function getMyBL_ID()
{
return getNumKeyID();
}

All in function form because I don't know why.
« Last Edit: January 28, 2012, 01:50:27 PM by Port »

function getServerName()
{
   %value = NPL_Window.getValue();
   %pos = strPos( %value, " Players - " );
   
   if ( %pos < 0 )
   {
      return "";
   }
   
   return getSubStr( %value, %pos + 11, strLen( %value ) );
}
$ServerInfo::Name


Uh, as in my Object ID when I have spawned.
Not sure if you could get the client object client-side, but you can get your player object with serverConnection.getControlob ject()
There's not a lot you can do with it though



Update. finished it off with your help. Thanks alot guys.


Update. finished it off with your help. Thanks alot guys.

-Pic-
You can also use getSubStr($ServerInfo::Name, 0, strStr($ServerInfo::Name, "\'")); to get the Host's name if you like.

You can also use getSubStr($ServerInfo::Name, 0, strStr($ServerInfo::Name, "\'")); to get the Host's name if you like.

You don't need to escape ' unless if it's in a tagged string.