Blockland Forums > Help
Transfer Variables From A Brick To A Player
(1/4) > >>
GenaralSkar:
What events do you have to use to transfer x variables on a brick to player?
Deriboy:
set variable of the player to the variable on the brick. I don't know, I haven't used variable events in a while.
GenaralSkar:
All I can think of is transferring 5 variables at a time.
Orthone:
I would suppose you would do exactly that..

Just for a test, I had two bricks. The one getting/giving variables, and another to toggle whether that first brick magicly got some variables or gave them all to the player.

--- Code: ---The Toggle Brick

[X] [0] onActivate -> namedBrick(GetGive) -> toggleEventEnabled -> 0 1 2 3 4 5
[X] [0] onActivate -> client -> chatMessage -> <color:ffffff>Brick Toggled!

--- End code ---

--- Code: ---The GetGive Brick

[X] [0] onActivate -> Self -> VCE_modVariable -> Brick -> Test -> Add -> 1
[X] [0] onActivate -> Client -> chatMessage -> <color:ffff00>[Status]<color:ffffff>: This brick currently has <var:br:Test> variables.
[  ] [0] onActivate -> Client -> chatMessage -> <color:ffff00>[Status]<color:ffffff>: All of the variables have been transfered to you.
[  ] [0] onActivate -> Self -> VCE_modVariable -> Player -> Test -> Add -> <var:br:Test>
[  ] [0] onActivate -> Client -> chatMessage -> <color:ffff00>[Self]<color:ffffff>: You now have <var:pl:Test> variables!
[  ] [0] onActivate -> Self -> VCE_modVariable -> Brick -> Test -> Set -> (Blank)

--- End code ---
The brick increments by one 'Test' value each click. Then when toggled, it deletes all of it's variables after giving the player all of them.
GenaralSkar:
I was thinking

--- Code: ---Onactivate->Client->Prompt->Do you want to transfer 5 variables?
Onpromptaccept->Self->ifvariable->[variable][>=][5]
Onvariabletrue->Self->Modvariable->[variable][subtract][5]
Onvariabletrue->client->modvariable->[variable][add][5]
Onvariablefalse->client->This brick does not have 5 variables

--- End code ---
Navigation
Message Index
Next page

Go to full version