Author Topic: VCE modvariable -> set -> value ?  (Read 846 times)

Is it possible to do this some way:

Code: [Select]
X 33ms onActivate ID temp VCE_modVariable Brick tmp Set <var:nb_duck:goat>
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...
 

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...
 


   
 

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...
 
 

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>.

Make sure event #2 happens atleast 1ms after event #1.

Make sure event #2 happens atleast 1ms after event #1.
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")?

Explain more of what your trying to do.

Now i think i understand. You see, you have so set goat to 0 on brick duck AFTER the value is transferred, unless you want goat to stay on brick duck as well as being turned into tmp and added to brick temp

Now i think i understand. You see, you have so set goat to 0 on brick duck AFTER the value is transferred, unless you want goat to stay on brick duck as well as being turned into tmp and added to brick temp
I know I have to reset goat AFTER I send the value, lol. Everything else would be kinda meaningless. But I want to keep the goat AND get tmp.

My brain is fried, i give up :(

I might have found a solution using functions.
Any recommendations on what input to use for quickly stating alot of functions? onRelay?

My brain is fried, i give up :(
No problem, thanks for trying.
It turned out that my named bricks caused part of the problem. Either VCE can't handle bricknames that are more than 10 letters long, or it can't handle underscores..
I think I found a working solution using functions.

Adding variables to namedbricks is broke.

Brick named Test:


Second brick that pulls a variable from the "Test" brick:

<var:nb_test:savedText> is what temp is being set to, the bar doesn't fully show it.

Pulled this from an old example I did where you could store a message on a brick, and then view what the last message was. Intended for a "radio" like setup. Was easy to modify to test what you wanted. =)

And if the saved variable is a number, you can add/subtract/(other operation here) just like it was a number.

Brick named Test:


Second brick that pulls a variable from the "Test" brick:

<var:nb_test:savedText> is what temp is being set to, the bar doesn't fully show it.

Pulled this from an old example I did where you could store a message on a brick, and then view what the last message was. Intended for a "radio" like setup. Was easy to modify to test what you wanted. =)

And if the saved variable is a number, you can add/subtract/(other operation here) just like it was a number.

we talked about this a while ago but how did you do this, was it just a simple screenshot or did you have to do more to get the image of these events?

we talked about this a while ago but how did you do this, was it just a simple screenshot or did you have to do more to get the image of these events?
To get the picture? I used a capture program called Hyperdesktop from imgur, similar to Gyazo but it works a lot better. I don't remember ever talking about how I do it though.. =/