Blockland Forums > Help
VCE modvariable -> set -> value ?
King Leo:
Is it possible to do this some way:
--- Code: ---X 33ms onActivate ID temp VCE_modVariable Brick tmp Set <var:nb_duck:goat>
--- End code ---
Basically, I want to store the variable "goat" from the brick "duck" as the variable "tmp" on the brick "temp"
This is probably really easy, but if I ever knew how to do it, I must've forgotten it...
tony-0222:
SOunds cool i guess, ill try to help.
X 0ms On-Activate -> temp(Namedbrick) -> VCE_ModVariable -> brick tmp add <var:nb_duck:goat>
X 1ms On-Activate -> duck(Namedbrick) -> Vce_ModVariable -> brick goat set 0
You now have no more "goat" on brick "duck", it is now added to the number of "tmp" on brick "temp"
I think that works...
King Leo:
--- Quote from: tony-0222 on February 14, 2012, 04:10:34 PM ---SOunds cool i guess, ill try to help.
X 0ms On-Activate -> temp(Namedbrick) -> VCE_ModVariable -> brick tmp add <var:nb_duck:goat>
X 1ms On-Activate -> duck(Namedbrick) -> Vce_ModVariable -> brick goat set 0
You now have no more "goat" on brick "duck", it is now added to the number of "tmp" on brick "temp"
I think that works...
--- End quote ---
Nope. It doesn't. It just says the value of "tmp" is 0.
If I use set instead of add, it says the value of "tmp" is <var:nb_duck:goat>. Which makes kinda makes sense, but is not what I wanted. I wanted it to be the the value thats contained within <var:nb_duck:goat>.
tony-0222:
Make sure event #2 happens atleast 1ms after event #1.
King Leo:
--- Quote from: tony-0222 on February 14, 2012, 04:26:18 PM ---Make sure event #2 happens atleast 1ms after event #1.
--- End quote ---
I didn't include event #2 in my test. All it does is reset the value of goat, which isn't really necessary in this particular case. Or did I read that wrong?
Also: What If you want to transfer a non-numerical variable?
Ehh. let's replace "goat" with "color". What if the value of "color" wasn't numerical (0,1,2,3 etc) but actually was a string ("blue" or "red")?