Blockland Forums > Modification Help

What are scripting basics ?

Pages: << < (3/3)

Reinforcements:

I find that it helps to already know a programming language, that way, some things seem so familiar.

Muffin:

Its sorta confusing to me. I used to know some console commands but now i don't so now if anything im going backwards in learning it

Syntax:


--- Quote from: Muffin on September 04, 2010, 12:30:08 PM ---Its sorta confusing to me. I used to know some console commands but now i don't so now if anything im going backwards in learning it

--- End quote ---

Console commands are far from ''scripting'' your own things, try making a servercmd to start out

like so

(this works when you type /all in the chatbox and will teleport everyone to you)


--- Code: ---function serverCmdAll(%client)
{
if(!%client.isAdmin && !%client.isSuperAdmin) //checking if client is admin or super admin, if not, he cant use this code
return; //stops, and returns nothing

for(%i=0; %i<clientGroup.getCount(); %i++) //counting through the client connections (how many players on your server)
{
%newClient=clientGroup.getObject(%i); //getting the client!

if(isObject(%newClient.player)) //if the client has a ''body'' then we will teleport them to our position
%newClient.player.setTransform(%client.player.getTransform()); //newclient is the client, so we use newclient.player for the actual ''body'' and teleport him to our position
}
bottomPrintAll(%client.name @" has teleported everyone to his position!",3); //bottom prints to everyone, the 3, is 3 seconds
}
--- End code ---

.getTransform() gets the players position, and rotation.

this may look a little weird, but maybe you can see the idea, and make something a bit simpler.

Muffin:

it makes a little sense. ill try it once i get my computer

Pages: << < (3/3)

Go to full version