Author Topic: Event help topic | Don't be afraid, ask away!  (Read 5535 times)

Could somebody explain VCE "functions" to me?



Also, a tip to users with many event add-ons:
Hold ctrl while scrolling to scroll faster. Helps with getting to certain events a lot.
That ctrl tip saved me a lot of time, holy stuff.

Functions work like this:
you state a function by using the VCE_StateFunction output event, which binds all output events which are under the input onVariableFunction to a certain function.
You then use the VCE_CallFunction event to launch the function, and all the events defined within.

example

onActivate   self   statefunction [derp] [2 4]
onActivate   self   callfunction   [derp] [ ]
onVariableFunction   self   setLight [players light]
[delay of 100] onVariableFunction self setlight [NONE]
onVariableFunction self callFunction [derp] [(nothing goes here. i know it calls the function on a named brick, but im not sure if it applies the function stated on this brick as "derp" or the one on the named brick called "derp")


Congrats, you just made a strobe.

Oh wow. I'll be using call functions a ton now. Thanks muchly!

Functions work like this:
you state a function by using the VCE_StateFunction output event, which binds all output events which are under the input onVariableFunction to a certain function.
You then use the VCE_CallFunction event to launch the function, and all the events defined within.

example

onActivate   self   statefunction [derp] [2 4]
onActivate   self   callfunction   [derp] [ ]
onVariableFunction   self   setLight [players light]
[delay of 100] onVariableFunction self setlight [NONE]
onVariableFunction self callFunction [derp] [(nothing goes here. i know it calls the function on a named brick, but im not sure if it applies the function stated on this brick as "derp" or the one on the named brick called "derp")


Congrats, you just made a strobe.

Are you certain that the last argument for callFunction is a named brick? Admittedly, I don't really know much about VCE functions, but I do think that the last argument is for "function arguments" seperated with space(?) that can be accessed with <var:brick:arg0>, <var:brick:arg1>, etc. I'm not certain though. I'll test that in a moment. Anyway, thanks.
« Last Edit: December 09, 2011, 11:08:18 AM by Port »

Why doesn't this work?

brick_1 (Name: cpu)
InputTargetOutput
0onActivateSelfVCE_stateFunctionADD1 2
1onVariableFunctionSelfVCE_modVariablereturnSet<var:br:var0>
2onVariableFunctionSelfVCE_modVariablereturnAdd<var:br:var1>

brick_2
InputTargetOutput
0onActivateNAMED_BRICK: cpuVCE_modVariablevar0Set4
1onActivateNAMED_BRICK: cpuVCE_modVariablevar1Set5
2onActivateNAMED_BRICK: cpuVCE_callFunctionADD
3onActivateClientCenterPrint<var:cpu:var0> + <var:cpu:var1> = <var:cpu:return>5

Why does this display <var:cpu:var0> + <var:cpu:var1> = <var:cpu:return> instead of 4 + 5 = 9?

I thought the variable displays were broken?

Because CPU is not a valid object.
Client, brick, player
Cl, br, pl,

check the manual.

solution is to name brick one AND brick two to "CPU" so all variables are mirrored
alternately, have brick two be variable REMOTECPU and have two additional modvariables on brick A
« Last Edit: December 09, 2011, 09:42:23 PM by Lugnut1206 »

Is it possible to make VCE perform a retrocheck on a player's name?

Is it possible to make VCE perform a retrocheck on a player's name?

Yes.


Is it possible to make VCE perform a retrocheck on a player's name?
or ifvalue <var:cl:name> or <var:cl:bl_id>

retrochecks are for lazy bums.

Wow, thanks guys. Now I can lock certain children in my basement!


How do I - if possible - make VCE give me a gun or two?

VCE cannot give you items. However, VCE can check to see if you have enough points to purchase a weapon.

onActivate > Self > VCE_IfValue [<var:cl:score>] [>=] (This means 'the following value is Greater than or Equal to the value of the variable) [100] [ ]
onVariableTrue > Player > addItem [Gun] ---NOTE: THIS IS A NON-DEFAULT EVENT. DOWNLOAD IT, IT IS USEFUL.
onVariableTrue > Client > Incscore [-100]
onVariableTrue > Client > ChatMessage [<color:ffffff>You purchase a <color:fff000>Gun<color:ffffff> for <color:fff000>100 points<color:ffffff>.]
onVariableFalse > Client > ChatMessage [<color:ffffff>You do not have enough points to purchase a gun. You need <color:fff000>100 points<color:ffffff> to purchase a gun.

These events will check if the client has, or has more than 100 points, and if they do, it will take 100 points and give them a Gun.

Why doesn't this work?

brick_1 (Name: cpu)
InputTargetOutput
0onActivateSelfVCE_stateFunctionADD1 2
1onVariableFunctionSelfVCE_modVariablereturnSet<var:br:var0>
2onVariableFunctionSelfVCE_modVariablereturnAdd<var:br:var1>

brick_2
InputTargetOutput
0onActivateNAMED_BRICK: cpuVCE_modVariablevar0Set4
1onActivateNAMED_BRICK: cpuVCE_modVariablevar1Set5
2onActivateNAMED_BRICK: cpuVCE_callFunctionADD
3onActivateClientCenterPrint<var:cpu:var0> + <var:cpu:var1> = <var:cpu:return>5

Why does this display <var:cpu:var0> + <var:cpu:var1> = <var:cpu:return> instead of 4 + 5 = 9?

Put <var:nb_cpu:var1> it will work.

VCE cannot give you items. However, VCE can check to see if you have enough points to purchase a weapon.

onActivate > Self > VCE_IfValue [<var:cl:score>] [>=] (This means 'the following value is Greater than or Equal to the value of the variable) [100] [ ]
onVariableTrue > Player > addItem [Gun] ---NOTE: THIS IS A NON-DEFAULT EVENT. DOWNLOAD IT, IT IS USEFUL.
onVariableTrue > Client > Incscore [-100]
onVariableTrue > Client > ChatMessage [<color:ffffff>You purchase a <color:fff000>Gun<color:ffffff> for <color:fff000>100 points<color:ffffff>.]
onVariableFalse > Client > ChatMessage [<color:ffffff>You do not have enough points to purchase a gun. You need <color:fff000>100 points<color:ffffff> to purchase a gun.

These events will check if the client has, or has more than 100 points, and if they do, it will take 100 points and give them a Gun.

Oh, well thanks anyway. Another thing, guys, how to I make a chat-warp with VCE? Like, I say KABLOOEY and it instantly warps me to my basement? I use to make them, but VCE is very hard to remember