I have a cat named Mittens. Now that you are bonded with it please login or register so that I dont have to eat him for dinner.

Current time: 07-29-2010, 10:49 PM Hello There, Guest! (LoginRegister)

This ad will disappear when you log in.


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Your first Expression 2
Author Message
DiscoBiscuit Offline
Administrator
*****

Posts: 559
Joined: May 2009
Post: #1
Your first Expression 2
Alright, E2 isn't as hard as it looks, as this tutorial will show (hopefully).
What this is going to do is make your character flash a random color very quickly. (Your first E2 is supposed to be pointless)
First, take out your E2 tool in the Wire tab. Then right click and the editor should come up. You can erase all the crap that's on there except the first 5 lines. Make sure it looks like this so far:
Code:
@name Party Time
@inputs
@outputs
@persist
@trigger all

Now you've set the name of the E2.
Since we want it to change color quickly we have to tell it to run quickly.
So now a few lines down type
Code:
interval(10)

Now for the coloring itself, setColor() uses 3 variables, Red, Green, and Blue. Each one can be any number between 1 (darkest) and 255 (lightest). So if you wanted red you would use setColor(255,0,0).
However, we want a random color. So first we have to make some variables.
Go a couple lines down and type
Code:
A=random(1,255)
B=random(1,255)
C=random(1,255)
This makes new variables A, B, and C. The variables now have a value of a random number between 1 and 255. This ensures you will turn all kinds of crazy colors. So now instead of setColor(0,0,0) we would use setColor(A,B,C). See where this is going?
Go down and type
Code:
owner():setColor(A,B,C)
Now wait a minute, where did the owner() come from? Well we have to tell it what to color, and whoever spawns the Expression chip is considered the 'owner'. So we link that function to the other one with a colon. You can link all kinds of them together.

The final code should look something like this:
Code:
@name Party Time
@inputs
@outputs
@persist
@trigger all


interval(10)

A=random(1,255)
B=random(1,255)
C=random(1,255)

owner():setColor(A,B,C)

Now all you have to do is spawn it and you will flash all kinds of colors! Impress your friends! Give them seizures! Whatever you want.

[Image: oteyj7.png]
(This post was last modified: 08-20-2009 07:36 PM by DiscoBiscuit.)
08-20-2009 07:35 PM
Visit this user's websiteFind all posts by this user Quote this message in a reply
XxsiezexX Offline
Member
*

Posts: 166
Joined: Jun 2009
Post: #2
RE: Your first Expression 2
this is a fun code if u set it to like this
A=random(1,5)
B=random(1,255)
C=random(1,5)
its like making ppl siezure ^^
Edit:
oh and set interval to 1000 ^^ (never done this on UFA on a diff SB server nocturnal gamings SB

[Image: 2061myu.jpg]
United as one divided by zero
thinking in Binary
speaking in ip
(This post was last modified: 10-16-2009 05:42 AM by XxsiezexX.)
10-16-2009 05:42 AM
Find all posts by this user Quote this message in a reply
Post Reply