Blockland Welcome, Guest. Please login or register.
Did you miss your activation email?
October 20, 2014, 07:18:20 AM

Home Help Login Register
+  Blockland Forum
|-+  Blockland Forums
| |-+  General Discussion
| | |-+  Simply Worded VCE Tutorial
Pages: [1] 2 3 4
Author Topic: Simply Worded VCE Tutorial  (Read 3010 times)
Big Brother

« August 15, 2011, 04:42:04 PM »

Simply Worded VCE Tutorial

Hi there, I've noticed that lots of people that I know are having trouble using VCE, so I thought I'd post a tutorial on how to get started by doing some simple and advanced tricks. I'm going to try and word this as simply as possible - I know that reading a long chain of big words is quite difficult. I'm aware that other people have posted VCE Tutorials, but I have tried to make it so this is as easy to read as possible. So let's get started, shall we?

Section 1: Being completely hopeless

Not to worry, that's what this tutorial is for. We're starting from square one, so don't expect yourself to be fantastic. Let's start by explaining some simple stuff.

onVariableTrue - An input event, very useful for when you are using VCE_ifVariable - Which is an output event. onVariableTrue basically does what it says on the tin. if the variable is true, then something happens.



Here's an example of what it looks like. Let's look at it by converting it into normal words.

"When activated, your client checks if the variable called 'Example' has been set to 1. If so, then run all event lines ranging from 1 to 1 and make a message on the center of your screen stating that this is an example."

Easy stuff, right? The same rule basically applies for onVariableFalse. If I changed the onVariableTrue into onVariableFalse, then it would check if 'Example' is not 1. Let's look at that by converting it into normal words.

"When activated, your client checks if the variable called 'Example' has been set to 1. If that is not the case, then run all the event lines ranging from 1 to 1 and make a message on the center of your screen stating that this is an example."

It's the exact same concept.

The little box on the far right - This box is so you can tell the event what lines it corresponds with. If you typed '1 5' it would execute event lines ranging from 1 to 5, and if you typed '1 1' it would execute the event line of 1.

Now we have that out of the way, let's move onto some more complicated things with VCE.

Section 2: Not being as hopeless but still rather hopeless

Let's have a look at this image.



As you can see, it shows that when you click the brick, it will modify the client variable 'Example'. There is a long list of ways you can change a variable apart from Set, Add, Subtract, Multiply and Divide.

Floor and Ceil: After stating a variable, Floor will automatically round it down. For example, if I changed the variable 'Example' to 10.75 and then floored it, it would change to 10. Ceil does the opposite. If I changed the variable 'Example' to 10.75 and then ceiled it, it would change to 11.

Preview of Floor:

|onActivate|Client|ModVariable|Example|Set|10.75|
|onActivate|Client|ModVariable|Example|Floor|<Nothing goes in the remaining box>|
Result is 10

Preview of Ceil:

|onActivate|Client|ModVariable|Example|Set|10.75|
|onActivate|Client|ModVariable|Example|Ceil|<Nothing goes in the remaining box>|
Result is 11

Power and Radical: After setting a variable, Power will multiply that number by itself a specified number of times. After setting a variable with Radical, it will find the square root of that number.

Preview of Power

|onActivate|Client|ModVariable|Example|Set|10|
|onActivate|Client|ModVariable|Example|Power|5|
'Example' is set to 10 and then multiplied by itself 5 times, resulting in 100,000  

Preview of Radical

|onActivate|Client|ModVariable|Example|Set|100|
|onActivate|Client|ModVariable|Example|Radical|<Nothing goes in the remaining box>|
Radical is basically the square root. 'Example' is set to 100 and then the square root is found, the answer is 10

Percent and Random: After setting a variable to any numerical value, you can find the percentage of that number out of anything. An example is shown later on. When you use 'Random', you innitially set a number as the minimum and then a number as the maximum. It will automatically pick a number inbetween.

Preview of Percent

|onActivate|Client|ModVariable|Example|Set|15|
|onActivate|Client|ModVariable|Example|Percent|105|
This is basically finding 15% of 105%. The answer is 15.75

Preview of Random

|onActivate|Client|ModVariable|Example|Set|1|
|onActivate|Client|ModVariable|Example|Random|5|
This is going to randomly pick a number between 1 and 5. You can get the result of 1, 2, 3, 4 or 5

Words: After setting a variable, you can get a specific word of that variable. This is quite strange, because if you try and get the third word, it will get the second word and if you try and get the sixth word it will get the fifth word, etc.

Preview of Words

|onActivate|Client|ModVariable|Example|Set|Hi, my name is Big Brother!|
|onActivate|Client|ModVariable|Example|Words|3|
This will get the 2nd word, so 'Example' will be to set to 'my'

Lowercase and Uppercase: This is extremely simple. It will take the variable and either set it to fully lowercase or fully uppercase.

Preview of Lowercase

|onActivate|Client|ModVariable|Example|Set|Hi, my name is Big Brother|
|onActivate|Client|ModVariable|Example|Lowercase|<Nothing goes in the remaining box>|
This will set 'Example' to "hi, my name is big brother"

Preview of Uppercase

|onActivate|Client|ModVariable|Example|Set|Hi, my name is Big Brother|
|onActivate|Client|ModVariable|Example|Uppercase|<Nothing goes in the remaining box>|
This will set 'Example' to "HI, MY NAME IS BIG BROTHER"

Character and Length: After setting a variable, you can edit a variable so it starts from a certain point. For example, you can change 'Hi, my name is Big Brother' to 'name is Big Brother'. After setting a variable to 'Hi, my name is Big Brother' with Length, you can get the length of the sentence.

Preview of Character

|onActivate|Client|ModVariable|Example|Set|Hi, my name is Big Brother|
|onActivate|Client|ModVariable|Example|Character|N|
This will change 'Example' so it starts from 'N'. You cannot type things greater than one character in the box where I typed 'N'. 'Example' changes to 'name is Big Brother'

Preview of Length

|onActivate|Client|ModVariable|Example|Set|Hi, my name is Big Brother|
|onActivate|Client|ModVariable|Example|Length|<Nothing goes in the remaining box>|
This will set 'Example' to "26" - as it has 26 letters; including spaces

*Deep exhale*



Section 3: Starting to get less hopeless

If you understood everything I've written so far, congratulations! You can move on to Section 3. This section is about VCE_ifVariable and other random parts of VCE. People use this to check if a variable is equal to the requirements set. There are 7 requirements available.



== - This means 'Is Equal To'
!= - This means 'Is Not Equal To'
> - This means 'Is Greater Than'
< - This means 'Is Less Than'
>= - This means 'Is Greater Than or Equal To' (Example: If your BL_ID is greater than or equal to 1337, you would jump into the air)
<= - This means 'Is Less Than or Equal To' (Example: If your BL_ID is less than or equal to 1337, you would jump into the air)
~= - This means 'Contains' (Example: If your last message contained 'Hello', then you would jump into the air)

OK, now we've covered that we're going to move on to Booleans and Special Variable Replacers.

What is a Boolean?

A boolean is a value that is either 1 or 0. If the value is 1, then that means 'ON'. If the value is 0, then that means 'OFF'. This is usually used with VCE_ifValue.

What are Special Variable Replacers?

Special Variable Replacers are basically values that are to do with a brick, your client, your player, your minigame, the server or even a vehicle. Here is a list of a few of them that you can use.

<var:cl:lastmsg> - The last message of your client
<var:cl:Score> - Your score
<var:cl:bl_id> - Your BL_ID
<var:pl:firing> - A boolean to determine if you're firing
<var:pl:crouching> - A boolean to determine if you're crouching
<var:pl:sitting> - A boolean to determine if you're sitting
<var:br:name> - The name of a brick
<var:br:ownerName> - The owner of a brick
<var:br:colorID> - The color ID of a brick
<var:mg:membercount> - The amount of players in a minigame
<var:mg:lastmsg> - The last message in a minigame
<var:gl:date> - The date
<var:gl:time> - The time
<var:gl:serverName> - The name of the server

I don't understand how to use that!

You can start by doing the following:

|onActivate|Client|Centerprint|<var:cl:bl_id>|

Which will display your blockland identification code on the center of your screen.

Why is it '<var:cl:bl_id>'?

It's actually short for something else, take a look at it in it's current state:

<var:cl:bl_id>

But upon closer inspection, you can see that this is short for:

<variable:client:blocklandidentificationcode>

Which won't work when you try it. But, you can use <var:client:bl_id> as apposed to <var:cl:bl_id>.

Where to put the Variables

There are multiple places where you can put variables, which I have previously stated.

Client - If you send a variable to your client it will not be lost when you die
Player - If you send a variable to your player it will be lost when you die
Brick - If you send a variable to a brick, only the brick will be able to display that variable
Minigame - If you send a variable to a minigame, it will only display that variable when the minigame is active



Can I see some examples?

Yes, these are a few of mine.



An Actual Representation

Lines always start at 0.

|33 Delay|Line 0|onActivate|Self|FireRelay|
|0 Delay|Line 1|onRelay|Self|VCE_ifValue|<var:cl:lastmsg>|=~|Hello|3 6|
|33 Delay|Line 2|onRelay|Self|FireRelay|
|0 Delay|Line 3|onVariableTrue|Client|ModVariable|Example|Set|<var:cl:lastmsg>|
|0 Delay|Line 4|onVariableTrue|Client|ModVariable|Example|Length| |
|0 Delay|Line 5|onVariableTrue|Client|Centerprint|That sentence contains 'Hello' and it has <var:cl:Example> letters.|3|
|0 Delay|Line 6|onVariableFalse|Client|Centerprint|That sentence does not contain 'Hello'.|3|


How do I make an event that checks if I am firing?
|33 Delay|Line 0|onActivate|Self|FireRelay|
|0 Delay|Line 1|onRelay|Self|ifValue|<var:pl:firing>|==|1| |4 4|
|33 Delay|Line 3|onRelay|Self|FireRelay
|0 Delay||Line 4|onVariableTrue|Client|Centerprint|You are firing.|3|


Using AND / OR

In events, there is also a recent ability to use AND/OR functions. With this, you're given the ability to use much less eventing lines and save time. Using 'AND' looks like this:

|Line 0|onActivate|Self|ifValue|<var:cl:lastmsg> & <var:cl:Score>|==|10|1 1|
|Line 1|onVariableTrue|Client|Centerprint|Your last message and your score are 10!|3|
Basically this checks if your last message and your score are both equal to 10. If this is correct, a message is shown.

Using OR is basically the same thing, the difference being is that you type | instead of &. This will check if either one of the variables equal 10 by themselves as apposed to checking if both of them equal 10 together.



Simple Weapon Shop

Basically this checks whether or not your score is greater than 5 by using onVariableTrue, onVariableFalse and >=. If your score is greater or equal to 5, you get a gun and a warm message. If not, you are rejected.


This is a slightly more complicated version - innitially it checks if your score exceeds 5. If it does, then you are awarded a Gun, but it doesn't stop there. If you have greater than 5 points, it also checks if you have greater than 10 points. After two seconds, if you have greater than 10 points also, you are awarded a Sword.

Modifying Your Clan Tags In-Game
This was a cool little function that was added a while back. It's very simple to do, here's an image of how to do it:

Thankfully you cannot exceed 4 characters, so you cannot abuse this. The clan tags will change until you leave the server.

Recently Added
Modifying Your Clan Tags In-Game
AND/OR
Simple Weapon Shop

Well that's all for now, folks! I will update this whenever I want to. Be sure to read the VCE Manual for further explanations on things I haven't touched up on. If I have done something incorrectly or missed something out, please do correct me. Thank you for reading.
« Last Edit: October 09, 2011, 07:05:52 AM by Big Brother » Logged
Ad Bot

Full members do not see ads

Donro98

« August 15, 2011, 04:58:31 PM »

Really nice, It really helped.
Bookmarked!
Logged
Frostbyte

« August 15, 2011, 05:00:37 PM »

Bookmarked.
Logged
Awdax

« August 15, 2011, 05:00:45 PM »

Wow, this is nice for people who aren't familiar with VCE.
Logged
Big Brother

« August 15, 2011, 05:03:06 PM »

Thanks for the positive feedback, guys :D
Logged
Donro98

« August 15, 2011, 05:06:00 PM »

One question, does the ifvariable have to be 1?
Logged
Big Brother

« August 15, 2011, 05:07:06 PM »

One question, does the ifvariable have to be 1?
No, the value (being 1) is just an example.
Logged
Blockflame

« August 15, 2011, 05:50:08 PM »

Badspot should really sticky this.
Logged
Big Brother

« August 15, 2011, 05:55:57 PM »

Badspot should really sticky this.
Thanks :)
Logged
Mega-Bear

« August 15, 2011, 06:52:58 PM »

holy shit nice job man
Logged
Nasoa

« August 15, 2011, 06:56:43 PM »

This is really good. Pictures, good explanation; definitely worthy of a sticky.
Logged
Big Brother

« August 15, 2011, 07:08:33 PM »

This is really good. Pictures, good explanation; definitely worthy of a sticky.
holy shit nice job man
Thanks to both of you :D

I'm usually quite shy of posting topics because of my insane paranoia, but I'm glad I did.
Logged
RedGajin

« August 15, 2011, 07:22:21 PM »

Hope you're including the multiple if variables, thats one of the first things I learned.
But nice tutorial.
Logged
DontCare4Free

« August 15, 2011, 07:24:09 PM »

Just don't fall into the trap of naming your variables something like "var", it's a recipe for disaster (bugs).
Logged
Big Brother

« August 15, 2011, 07:26:26 PM »

Hope you're including the multiple if variables, thats one of the first things I learned.
elaborate please :o
« Last Edit: August 15, 2011, 07:29:41 PM by Big Brother » Logged
Pages: [1] 2 3 4  


Login with username, password and session length

Powered by SMF 1.1.19 | SMF © 2013, Simple Machines
Page created in 0.143 seconds with 15 queries.