Author Topic: VCE Guide  (Read 17697 times)

Displaying a Variable.

Player- <var:pl:(insert variable here)>
Client- <var:cl:(insert variable here)>
Brick- <var:br:(insert variable here)>
   NOTE: you put these codes in a client (chatmessage, centerprint, etc.)

Example: <OnActivate-Client-[You have <var:pl:Gold> Gold]>

The VCE_IfVariable.

the same as the old one except that if you want player you go to the Player tab (OnActivate-Player-VCE_IfVariable)

The Mod_Color extension pack has a good guide here By Tyler66:
http://forum.blockland.us/index.php?topic=93168.0

---If you have anything to add to this post it here---

VCE_modVariable

This is what you use to set a variable. To set a variable, click what you want to set it on (i.e. you click "player" and it applies the variable to the player). If you select "self," then you get to pick what you set the variable on. Here's how it should look:

onactivate--Player--VCE_modVariable--(in this spot, you put in the variable's name)money--(in here, you put in what you want to do to this variable. The list of these and what they do is in the variable guide for modVariable)set--20

Now, you have added 20 to the variable's value. In the example, the player has 20 dollars. The variable doesn't necessarily have to be money, it can be anything, from logs to coal to just something to check if someone has done something, as in if someone already received money from a giver.

This comes from my eventing guide, the BETC (Boom's Event Training Center)

For help on other events, go here.

--- A. Introduction ---

   Welcome to the most advanced form of Wrench Events. The Variable Conditional Events,
   or VCE, controls variables, and allows you to do things that would be nearly impossible
   with basic events. Everything covered in this section will be appliable to both VCE Values
   and VCE Variables.

   Let's take a VCE code, and break it apart:
   In a VCE code, you have the basic things like "[X] 0 [0] (Event)"
   You then have two text boxes. Before I explain what they are,
   you need to know these math symbols:

      "= =" equals
      "!="does not equal
      ">=" greater than or equal to
      "<=" less than or equal to
      ">" greater than
      "<" less than
      "~=" similiar or equal to

   So, here how it works. If this "= =" this, do this [2 4]
   The "[2 4]" box means run events 2 through 4.

   Events triggered by the VCE will normally be "Variable True/False" events.
   Events that are not toggled on will not run.
   Events that are not variable true/false arguments will be played no matter what.

--- B. Values ---

   In the VCE, a Value is normally a string of text, or a boolean (0 or 1).
   Values aren't too hard to grasp, but allow new levels of eventing.

   To use Values, you must first know how to set up the "if [this] = = [that]"
   The "[this]" part, is what you're comparing "[that]" to.
   Let’s introduce the possible "[this]" entrees:

      <var:client:name> : The player's name
      <var:client:bl_id> : The player's Blockland ID.
      <var:client:lastmsg> : The player's last message
      <var:client:lastteammsg> : The player's last team message
      <var:client:score> : The player's score
      <var:client:isAdmin> : If the player is an Admin (Boolean)
      <var:client:isSuperAdmin> : If the player is a Super Admin (Boolean)
      <var:client:clanPrefix> : The player's clan prefix tag
      <var:client:clanSuffix> : The player's clan suffix tag

      <var:player:jetting> : If the player is jetting (Boolean)
      <var:player:jumping> : If the player is jumping (Boolean)
      <var:player:firing> : If the player if firing the mouse (Boolean)
      <var:player:damage> : The amount of damage the player does to another
      <var:player:health> : The player's current health
      <var:player:maxhealh> : The player's maximum health
      <var:player:velx> : The player's velocity on the x-axis
      <var:player:vely> : The player's velocity on the y-axis
      <var:player:velz> : The player's velocity on the z-axis
      <var:player:currentItem> : The UI Name of the current item the player is using
      <var:player:item*> : The UI Name of the *th item in the player's inventory

      <var:brick:colorid> : The brick's color name
      <var:brick:printcount> : The brick's printcount
      <var:brick:colorfxid> : The brick's color effect name
      <var:brick:shapefxid> : The brick's shape effect name

   Values cannot be changed, for they are properties,
   but they can be displayed in an evented print.

--- C. Variables ---

   VCE Variables come in two parts.
   One is setting the Variable, and the other is using the Variable.
   Variables are numbers that are kept track of, and is given a unit name.
   The name is the Variable's Name, and the Value is the Numerical Value of the Variable.

   Part 1-Modifing Variables
   When you select the event "VCE_modVariable",
   You'll see a text box, a math operand (set, add, multiply, etc.), and another text box.
   The first text box handles the name of the Variable.
   The math operand tells you how you plan on modifying the Variable.
   The second text box will always be a digit,
   unless you want it as a string, but then,
   using operands other than "set" won't work.

   Part 2-If Variable Statements
   When you select the event "ifVariable"
   You'll see a text box, a math symbol (= =, !=, <=, etc.), and another text box.
   The first text box states the name of the Variable.
   The math symbol tells you what you are comparing the number to.
   The second text box will normally be a digit.

   Example:
   Let’s say you have a teleporter, there are two senders, and one receiver.
   To make that receiver send to both senders, you need a VCE Variable.
   Okay, assuming you know how to set up a teleporter*,
   create the events for the two senders, but wait on the receiver.
   Once you have set up your teleporters, add a VCE Mod Variable Event.
   You may name the Variable anything you want, but in this case,
   I'll call it "Sender". Then change the math statement to "set",
   then on one teleporter, have "Sender" set to "1", and on another,
   have "Sender" set to "2". Now to the receiver.

   On the receiver, instead of teleporting the player,
   create an "ifVariable" Event. Then have input "Sender = = 1",
   meaning if the "Sender" Variable is at the Value of "1",
   the statement is true, if it is not 1, like "2", then the
   statement is false. Now add the events to teleport the player
   to the first teleporter on a "VariableTrue" event, and add the
   events to teleport the player on "VariableFalse".

   Now try out the teleporter!

--- D. Functions ---

   Variable Functions are a little hard to get at first, but once you get it down,
   you will love them.

   What is a Variable Function? Think of it as a relay with a name.
   Instead on using "fireRelay" you will you "VCE_callFunction".

   Easy, right?

   Now hold your horses. You can't just call a function out of the blue!
   In order to call a function, you must first state that function,
   by using "VCE_stateFunction".

   Here is an example of a stated function:

Code: [Select]
[X] 0 [0] onActivate > Self > VCE_stateFunction > [Example] [1 1]
[X] 1 [0] onVariableFunction > Player > setPlayerScale > [I---------]

   Now you have a stated function!

   Now to call that function:

Code: [Select]
[X] 0 [0] onActivate > Self > VCE_stateFunction > [Example] [1 1]
[X] 1 [0] onVariableFunction > Player > setPlayerScale > [I---------]
[X] 2 [0] onActivate > Self > VCE_callFunction > [Example] [ ]

   There you have it! This may seem a little simple, and that was because it was just an example.

   When would I need functions? When you find yourself in need of using multiple relays,
   you normally would have to make another brick for another relay. Well that is no more!

   With VCE Functions, you can have up to 17,340 functions on ONE brick!

   Lastly, let's look at Event 2 in the example:

Code: [Select]
[X] 2 [0] onActivate > Self > VCE_callFunction > [Example] [ ]
   Wondering what that last textbox is for? You can use it to call functions on other bricks!
   You do this by typing in the name of that brick.
   If the box is left empty, or the brick named does not exist,
   then the function is called on itself, and if a called function doesn't exist,
   then nothing happens!

   This means that on a server, you can have 300,675,600 different functions,
   and you can call them ALL with ONE brick!

   That my friend, is the power of the VCE.

--- E. Saving/Loading Variables ---

   Saving and loading variables is pretty simple.
   When you choose the event to save/load a variable,
   you will be asked to save/load to or from either the player or the client.

   Let me take some time to describe the difference between the player and the client.
   The player is the Blockhead himself. Everytime you die,
   you get a new Blockhead with full health, and the server/minigame's defualt items.
   When you die, all variables on the player are lost.
   Meaning it is probably a bad idea to save variables to the player,
   unless what you want would require that.

   For instance, let's say that you have a button that gives the player a key.
   If you die, the key should remain with your body.
   Meaning you would loose the key variable if you died.
   If you have a long maze with several different keys,
   you might add checkpoints for just incase you die.
   If you have save points in the maze,
   The player can load the key variable from their previous life.

   The client, is the actuall connection of the player.
   If the player dies, the variable is kept.
   If the player logs out, the variable is lost.
   A variable that you might want to save to the client could be a currency.
   If you have the players obtain gold,
   when they died, they would keep their gold amount.
   If they logged out, all they would have to do is reload their gold amount!

   Now that you know the difference, and their possible uses,
   Let's move on to how to type the variables you want saved.
   You do not have to save each variable individually.
   You can if you want to, but it is not needed.
   To save variables, you just simply type the variable name in the box,
   and you separate each variable by a comma.

   Here are some correct examples:

      [Blocks,Exp,Key1,Key2,Shield]
      [Points, Level, Status, Score]
      [Q1Complete,Q2Complete,Gold,Silver,Bronze]

   Here are some incorrect examples:

      [Money, Car,Grown, Int]
      [Data1.Data2,Data3 Data4]
      [Arg1 . Arg 2 . Team]
      [Cash,Spawn, Tools,Color]

   Saving and loading works the same way in both text boxes.
   Just note that if you use a comma, but no space, then
   that style must be continued, and vise-versa with commas
   with spaces.

--- F. Using VCE_retroCheck ---

   VCE_retroCheck was made for the people who prefer the old variables.
   Here's a list of the options:

      ifPlayerName : The player's name
      ifPlayerID : The player's ID
      ifAdmin : If the player is an admin
      ifPlayerEnergy : The amount of energy left (refers to the blue bar)
      ifPlayerDamage : The player's health
      ifPlayerScore : The player's score
      ifLastPlayerMsg : The last message the player said
      ifBrickName : The name of the brick
      ifRandomDice : The random number between 1 and 6 (This changes every time the event is called)

   VCE_retroCheck works just like any other value, it can't be changed,
   but it can't be displayed in an evented print. Some people prefer these
   over VCE_ifValue, but I personally like VCE_ifValue, but that's just me.



If something isn't well explained, or you see inaccurate info, please let me know. I do my best to keep my guide up to date and accurate.

Also, I know that varlinks and onVariableUpdate is not covered. This is coming soon.
« Last Edit: April 24, 2010, 01:56:41 PM by Deathwishez »


I didn't know you could save more then one variable If you used commas so i would make a new save line event for every variable so that will save me a lot of time :p

Will the commas work for loading them to?

I didn't know you could save more then one variable If you used commas so i would make a new save line event for every variable so that will save me a lot of time :p

Will the commas work for loading them to?
Me too
This song fits what I did when I found that out just now:
http://www.youtube.com/watch?v=4pXfHLUlZf4

This is a great guide my good friend.

Me too
This song fits what I did when I found that out just now:
http://www.youtube.com/watch?v=4pXfHLUlZf4

I laughed so loving hard.

I didn't know you could save more then one variable If you used commas so i would make a new save line event for every variable so that will save me a lot of time :p

Will the commas work for loading them to?

   Saving and loading works the same way in both text boxes.

I didn't know you could save more then one variable If you used commas so i would make a new save line event for every variable so that will save me a lot of time :p

Will the commas work for loading them to?

I didn't know this either, I thought the same way too, a different line for every different variable! Thus, I never really tried to save a variable. But now I will!