maybesomethingdunno
22nd Jul 2010, 05:00 AM
Maybe I've been looking at this too long and I simply need another opinion. Maybe I'm going about this all the wrong way. Perhaps my little brain isn't developed enough to wrap its feeble self around this. :P I don't know.
Here's my problem...
I'm trying to coordinate and/or pass information between several objects at once and it's driving me insane. :P
Every time I change the order of what appears first or what does what first, I fall into a trap of "wait, how would X know that Y's attribute has a value of true/false?" or "Argh! Why isn't 'Push Interaction' working?!"
What's involved:
The active Sim (the pink / light red colored female figure in the diagram)
An (invisible) object with with a routing slot (the black square and the green square respectfully)
A NPC in a loop where he routes from the routing slot to a location relative to the object (the orange-ish figure and the blue arrows)
A cart object to be snapped in the NPC to carry the active Sim along the NPC's path (the purplish rectangle)
http://img833.imageshack.us/img833/9849/chart.png (http://img833.imageshack.us/i/chart.png/)
Since I don't have a CRES to adjust the positions of the slots of the NPC, the cart object is necessary.
At this point, I think I'd like the NPC to wait at the routing slot until the Sim boards the cart. I understand this can simply be an attribute check ("AmIReady?" == true/false). Once the Sim has boarded the cart, the NPC would start to move. So, somehow the cart would need to change the value of the NPC's "AmIReady?" attribute to get the NPC moving. However...
The Sim must act one way on the trip to the routing slot (the green square) and act another way on the return trip to the general position relative to the main object (the black square). Once again, it would be easy to constantly toggle the value of an attribute within the NPC each time it routes to and fro ("MyDirection"). But, if the Sim is snapped into the cart and the cart is snapped into the NPC, how would that value get sent upwards from object to object? The Sim would be interacting with the cart, so somehow the cart would need to get the information from the NPC, correct? Once the cart is snapped into the NPC, the NPC somewhat forgets it's there. They wouldn't really have any sort of "My/Stack Object" relationship anymore; neither one is actively running an interaction on the other. Thanks to Echo, I have a "Get ID of Closest X" bhav...so, I might could tell the cart/NPC to look for the closest NPC/cart and get its object ID? Or, would that not work for objects snapped into other objects?
Since the object is invisible, I'm using a self-interaction to make the Sim route to the object's routing slot to start the interaction for the time being. The Sim spawns the NPC who automatically spawns the cart into one of his slots. The NPC is waiting for its attribute value to change to start moving. I assume the Sim must be interacting with the cart to be snapped into it, so I assume I'd want to push the Sim into an interaction with it from within the self-interaction. But, I'm failing spectacularly. Even if I had the object spawn the NPC, I'd still have to go from the self-interaction to the cart. I'd probably still have the attributes issue. Conceptually, I could have the Sim spawn the NPC (which would spawn the cart) and just put a delay between the initial movement, but I'd still need the directional information for deciding the Sim's actions.
(I'll worry about if/when to delete the cart and NPC when I get there.)
In the self-interaction, I have:
Spawning the NPC: "[prim 0x002A] Create New Object Instance (GUID 0xwhatever, place: in front of Me, Create object normally,..."
Getting the closest Cart: "[private 0x100C] Get in Temp 0 - ID - Closest Cart (1 arg: My 0x000B (object id))"
"[prim 0x0002] Expression (Local 0x0000 := Temp 0x0000)"
"[prim 0x000D] Push Interaction (Target: Stack Object, Object: Local 0x0000, Interaction: Literal 0x0000, maximum priority, Icon index: Literal 0x0001)"
The NPC and cart are spawned, but the Sim doesn't do anything afterward. When I click on the cart directly, the interaction seems to work fine on that end. Although I don't get an error, the operands for the Push Interaction must be wrong. (It would help if I knew more what I'm doing. :lol: )
I understand the target is the Sim, the object would be the cart, the interaction would be the corresponding TTAB interaction, and the max priority means it's of the up-most importance. I'm not certain what the Icon index is beyond the guess of what the interaction queue icon is. The cart will also be invisible once I'm able to trust that it's doing what it's supposed to be doing, so I'd rather have a custom graphic for the queue icon or the active Sim's face.
Here's my problem...
I'm trying to coordinate and/or pass information between several objects at once and it's driving me insane. :P
Every time I change the order of what appears first or what does what first, I fall into a trap of "wait, how would X know that Y's attribute has a value of true/false?" or "Argh! Why isn't 'Push Interaction' working?!"
What's involved:
The active Sim (the pink / light red colored female figure in the diagram)
An (invisible) object with with a routing slot (the black square and the green square respectfully)
A NPC in a loop where he routes from the routing slot to a location relative to the object (the orange-ish figure and the blue arrows)
A cart object to be snapped in the NPC to carry the active Sim along the NPC's path (the purplish rectangle)
http://img833.imageshack.us/img833/9849/chart.png (http://img833.imageshack.us/i/chart.png/)
Since I don't have a CRES to adjust the positions of the slots of the NPC, the cart object is necessary.
At this point, I think I'd like the NPC to wait at the routing slot until the Sim boards the cart. I understand this can simply be an attribute check ("AmIReady?" == true/false). Once the Sim has boarded the cart, the NPC would start to move. So, somehow the cart would need to change the value of the NPC's "AmIReady?" attribute to get the NPC moving. However...
The Sim must act one way on the trip to the routing slot (the green square) and act another way on the return trip to the general position relative to the main object (the black square). Once again, it would be easy to constantly toggle the value of an attribute within the NPC each time it routes to and fro ("MyDirection"). But, if the Sim is snapped into the cart and the cart is snapped into the NPC, how would that value get sent upwards from object to object? The Sim would be interacting with the cart, so somehow the cart would need to get the information from the NPC, correct? Once the cart is snapped into the NPC, the NPC somewhat forgets it's there. They wouldn't really have any sort of "My/Stack Object" relationship anymore; neither one is actively running an interaction on the other. Thanks to Echo, I have a "Get ID of Closest X" bhav...so, I might could tell the cart/NPC to look for the closest NPC/cart and get its object ID? Or, would that not work for objects snapped into other objects?
Since the object is invisible, I'm using a self-interaction to make the Sim route to the object's routing slot to start the interaction for the time being. The Sim spawns the NPC who automatically spawns the cart into one of his slots. The NPC is waiting for its attribute value to change to start moving. I assume the Sim must be interacting with the cart to be snapped into it, so I assume I'd want to push the Sim into an interaction with it from within the self-interaction. But, I'm failing spectacularly. Even if I had the object spawn the NPC, I'd still have to go from the self-interaction to the cart. I'd probably still have the attributes issue. Conceptually, I could have the Sim spawn the NPC (which would spawn the cart) and just put a delay between the initial movement, but I'd still need the directional information for deciding the Sim's actions.
(I'll worry about if/when to delete the cart and NPC when I get there.)
In the self-interaction, I have:
Spawning the NPC: "[prim 0x002A] Create New Object Instance (GUID 0xwhatever, place: in front of Me, Create object normally,..."
Getting the closest Cart: "[private 0x100C] Get in Temp 0 - ID - Closest Cart (1 arg: My 0x000B (object id))"
"[prim 0x0002] Expression (Local 0x0000 := Temp 0x0000)"
"[prim 0x000D] Push Interaction (Target: Stack Object, Object: Local 0x0000, Interaction: Literal 0x0000, maximum priority, Icon index: Literal 0x0001)"
The NPC and cart are spawned, but the Sim doesn't do anything afterward. When I click on the cart directly, the interaction seems to work fine on that end. Although I don't get an error, the operands for the Push Interaction must be wrong. (It would help if I knew more what I'm doing. :lol: )
I understand the target is the Sim, the object would be the cart, the interaction would be the corresponding TTAB interaction, and the max priority means it's of the up-most importance. I'm not certain what the Icon index is beyond the guess of what the interaction queue icon is. The cart will also be invisible once I'm able to trust that it's doing what it's supposed to be doing, so I'd rather have a custom graphic for the queue icon or the active Sim's face.