Author Topic: how to display variables?  (Read 4373 times)

new op.

so how do you show variables?
i cant get it to work. i dont know what i have done wrong as i just learnt this last night and theres no posts on variables or what to put in the () at the end of
Code: [Select]
function servercmdmessage(%client) all i know is that %client goes in there.

i also need to know how to do IF statements i know what they are i use them in batch.
if you get the chance whats the diffence between client.cs and server.cs?
Code: [Select]
function serverCmdmessage(%client, %message)
{
announce("%message)";
  }
  
function serverCmdload(%client)
{
talk("Loading script...");
exec("Add-Ons/Script_Testing/server.cs");
talk("Script loaded!");
  }

Code: [Select]
function serverCmdmessage(%client, %message)
{
announce(%message);
}

If statements run what's inside them if the variable is equal to 1.
Code: [Select]
if(%variable)
{
   echo("%variable is 1");
}
else
{
   echo("%variable is 0 :c");
}

You can also check for values and strings.

Code: [Select]
if(%variable == 12345)
{
   echo("%variable is 12345");
}
else
{
   echo("%variable is something else :c");
}

if(%variable $= "String")
{
   echo("%variable is \"String\"");
}
else
{
   echo("%variable is something else :c");
}

Client.cs is executed when blockland is launched, server.cs is executed when a server is being hosted.

Code: [Select]
snip
Client.cs is executed when blockland is launched, server.cs is executed when a server is being hosted.
Thank you so much. but i did it heres what i did and it did not work, i have no idea why. The file is server.cs, i loaded a server(singleplayer)

Anyway heres the code i used, it did not work it should reply with an id, right?
Code: [Select]
function serverCmdme(%client)
{
  echo("%client");
}
« Last Edit: April 06, 2012, 04:36:41 AM by deathrider »

Thank you so much. but i did it heres what i did and it did not work, i have no idea why. The file is server.cs, i loaded a server(singleplayer)

Anyway heres the code i used, it did not work it should reply with an id, right?
Code: [Select]
function serverCmdme(%client)
{
  echo("%client");
}
Remove the ""s when using a variable.

Remove the ""s when using a variable.
done and it worked thanks. Are there any vars that are already set so like %client must be one idk what %player is but i got commands i did
Code: [Select]
findclientbyname(deathrider).player.dump;
quick edit:
any way i can get the console to talk to me? Like i do /load it then loads the script the problem is i have to open console just to see if any errors any whay i can get it to do talk();with all the errors. also i need to know how to ask the client for varabiles so like you say /admin dom

it would then do
findclientbyname(dom).player.isadmin(1);

dom is the var.

new edit:
Code: [Select]
  function servercmdadmin(%client)
{
  if(%client.isAdmin)
    {
      talk(%clientname SPC "is hacking!");
    }
else
    {
    echo(no.");
    }
}
has syntax errors after echo("no.");
%clientname is a var i set using
Code: [Select]
%clientname = %client.getName();
« Last Edit: April 06, 2012, 05:43:11 AM by deathrider »

You are missing a " in front of no.
also in this function you have not defined %clientname, you should use %client.name for getting their name.


function servercmdadmin(%client)
{
    if(%client.isAdmin)
    {
        talk(%client.name SPC "is hacking!");
    }
    else
    {
        echo("no.");
    }
}

You are missing a " in front of no.
also in this function you have not defined %clientname, you should use %client.name for getting their name.


function servercmdadmin(%client)
{
    if(%client.isAdmin)
    {
        talk(%client.name SPC "is hacking!");
    }
    else
    {
        echo("no.");
    }
}

i always miss the little things i did not know that %client.name was a set var what are the ones that just like that

on a client object, %client, you can use:

%client.name - The client's name
%client.bl_id - The client's Blockland ID
%client.clanPrefix - self explanitory
%client.clanSuffix - ditto.
%client.isSuperAdmin - 1 if the client is super admin, 0, if not
%client.isAdmin - same as above but for admin

and a long list:

  .accent = "0"
  .accentColor = "0 0.200 0.640 0.700"
  .bl_id = "2992"
  .bpsCount = "0"
  .brickGroup = "9887"
  .Camera = "14343"
  .chest = "0"
  .chestColor = "1 1 1 1"
  .connected = "1"
  .currentPhase = "3"
  .currentPreparePhase = "1"
  .currInv = "-1"
  .currInvSlot = "-1"
  .decalName = "Space-Old"
  .eventCamType = "None"
  .faceName = "memeYaranika"
  .hasDownloadedGUI = "1"
  .hasHeightControlClient = "1"
  .hasPrefList = "1"
  .hasRTB = "1"
  .hasSpawnedOnce = "1"
  .hasTeamDM = "1"
  .hasVCE = "1"
  .hat = "0"
  .hatColor = "0.5 0.5 0.5 1"
  .HCchecknumber = "5"
  .headColor = "1 1 1 1"
  .Hip = "0"
  .hipColor = "0.105 0.458 0.768 1"
  .inventory0 = "320"
  .inventory1 = "212"
  .inventory2 = "210"
  .inventory3 = "204"
  .inventory4 = "202"
  .inventory5 = "201"
  .inventory6 = "209"
  .inventory7 = "265"
  .inventory8 = "278"
  .inventory9 = "336"
  .isAdmin = "1"
  .isSuperAdmin = "1"
  .LANname = "Fluffy"
  .Larm = "0"
  .larmColor = "0.105 0.458 0.768 1"
  .lastUpdateBodyColorsTime = "11219"
  .lastUpdateBodyPartsTime = "11219"
  .Lhand = "1"
  .lhandColor = "0.749 0.18 0.482 1"
  .lleg = "1"
  .llegColor = "0.105 0.458 0.768 1"
  .name = "Fluffy"
  .netName = "Fluffy"
  .numFoundTreasureChests = "0"
  .pack = "3"
  .packColor = "0.9 0 0 1"
  .persistenceSchedule = "1127"
  .Player = "14344"
  .Rarm = "0"
  .rarmColor = "0.749 0.18 0.482 1"
  .Rhand = "1"
  .rhandColor = "0.105 0.458 0.768 1"
  .rleg = "1"
  .rlegColor = "0.749 0.18 0.482 1"
  .rtbVersion = "4.01"
  .score = "0"
  .secondpack = "0"
  .secondPackColor = "0 1 0 1"
  .tcpObj = "9871"
  .undoStack = "14342"

on a client object, %client, you can use:

%client.name - The client's name
%client.bl_id - The client's Blockland ID
%client.clanPrefix - self explanitory
%client.clanSuffix - ditto.
%client.isSuperAdmin - 1 if the client is super admin, 0, if not
%client.isAdmin - same as above but for admin

and a long list:

-snip-
thats what im looking for

on a client object, %client, you can use:

%client.name - The client's name
%client.bl_id - The client's Blockland ID
%client.clanPrefix - self explanitory
%client.clanSuffix - ditto.
%client.isSuperAdmin - 1 if the client is super admin, 0, if not
%client.isAdmin - same as above but for admin

and a long list:

-snip-
Is not %client.isHost valid too?


It's not default, but truce made a .isHost function

the only thing i need to know is how to ask for var's so like /admin dom

it then give admin to dom dom is the var

this is what i have has lots of errors when i load it
Code: [Select]
functionservercmdtest(%client, %message)
{
announce(%message);
}
« Last Edit: April 06, 2012, 07:28:56 AM by deathrider »

you forgot the space between function and serverCmd...

you forgot the space between function and serverCmd...
im a handicap