| Blockland Forums > General Discussion |
| Event help topic | Don't be afraid, ask away! |
| << < (4/16) > >> |
| Lugnut:
--- Quote from: Port on December 08, 2011, 02:31:06 PM ---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. --- End quote --- 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. |
| Katadeus:
Oh wow. I'll be using call functions a ton now. Thanks muchly! |
| Port:
--- Quote from: Lugnut1206 on December 08, 2011, 03:09:22 PM ---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. --- End quote --- 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. |
| Port:
Why doesn't this work? brick_1 (Name: cpu) InputTargetOutput0onActivateSelfVCE_stateFunctionADD1 21onVariableFunctionSelfVCE_modVariablereturnSet<var:br:var0>2onVariableFunctionSelfVCE_modVariablereturnAdd<var:br:var1> brick_2 InputTargetOutput0onActivateNAMED_BRICK: cpuVCE_modVariablevar0Set41onActivateNAMED_BRICK: cpuVCE_modVariablevar1Set52onActivateNAMED_BRICK: cpuVCE_callFunctionADD3onActivateClientCenterPrint<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? |
| Demian:
I thought the variable displays were broken? |
| Navigation |
| Message Index |
| Next page |
| Previous page |