cancel
Showing results for 
Search instead for 
Did you mean: 

Send/Recieve List

NoSpek
Honored Guest

Hi,

I can send an event to an object with a list as a parameter (in this case a list of vectors). On the recieving end I can't chose a list from the available options... Is this not possible or am I doing something wrong?

All advice much appreciated!

 

3 REPLIES 3

teerez83
Protege

I have not found a way to pass lists in whole so what I've done instead is create a send event that will iterate through the list and a listen event on the target object that will build it's own list on the destination. It's a bit more tedious but it's worked in all of the instances I need. If you want it to reset the list on the destination, in the send event if you have a free parameter use a boolean and then you can simply say on item[0] send reset=true but on all other items reset=false and have the capture event process that accordingly. If anyone knows of a better way to do this, I'd love to update some of my scripts.

kortalian
Honored Guest

Cool workaround! Any chance you could share what that code looks like? I'd love to do something like this.

Sure. Using OP's ask as an example.

Object 1 has a list of vectors named ListVects and is tied to a script VectLists.

Object 1 has a variable called GameCtrl which is defined on the object itself to point to the GameController
Object 2 is a controller named GameController and is tied to a script GameScore

Object 2 has a list of vectors variable named RcvdListVects

 

Code on VectLists

On World Start (or whatever triggers the event with the object 1 which contains the list)

  • Send Event GrabList to self with Int (0)

 

When event GrabList is received with Iterator

  • If (Iterator < length(ListsVect))
    • Send event SendList to GameCtrl with ListsVect[Iterator] and Iterator
      • #ListsVect[Iterator] is the get object from list in position with iterator, I don't recall the exact name of the action
    • Send event GrabList to self with Iterator+1

Code on GameScore

When event SendList is received with Vec(ReceivedVec) and Int(Iterator)

  • If (Iterator = 0)
    • clear RcvdListVects
  • #no else statement
  • Add ReceivedVec to RcvdListVects