JT`
18th Oct 2011, 12:57 PM
I'd like to make a mod which reads World.HandToolPickupEventArgs to see if the player is attempting to drag and drop a newspaper, garbage item, or other item over a trash can in order to cancel the drag-and-drop and push a Recycle/Dispose event to the currently selected sim, but I'm aside from a fair understanding of high-level programming (i.e., high-level above the CPU via a compiler, rather than low-level assembly) I'm still completely new and oblivious to TS3 scripting. (Eventually I intend to expand this for putting items away on bookshelves and putting laundry into hampers as well.)
So, I had a couple questions before diving in headlong:
Object IDs are evidently ulongs -- how do I reference objects in the game tables to determine what type they are?
[edit] Apparently what I'm looking for are things derived from IThrowAwayable, but don't yet know how to check to see how objects are derived from a given class/interface.
By the time the user has already picked up the item, the damage seems to be done. There appears to be an enumeration called (gah, Hungarian notation) "eEditTypeHandTool" with a value kEditTypeCancelled, but I can't figure out if I can force that or if that reacts solely to user input. Is there a way to push an event into the game that simulates a user cancelling a hand-tool action?
If not, is there a cheap and easy way to force the user to Undo?
[edit] Actually, scratch that... seems like that'd only work in Edit Mode, not Live Mode...
The sticky post warning mentions the answer to "is X possible?" is "find out yourself", but I was hoping that people had some experience with this so I don't wind up disheartening myself by biting off more than I can chew with my first project, like I did with GTAIV scripting. ;-)
[edit]
Further disjointed ramblings follow:
Add a delegate to World.IsInLiveDragModeEventHandler which evidently triggers when beginning to drag an object?
World.OnHandToolPickup?
World.HandToolGetObjectHeld()?
The simplest solution would be to disable live mode and edit mode dragging for those objects. But that doesn't push an event; it requires clicking an interaction menu and essentially cripples the existing drag-and-drop feature that's way more physically intuitive and fun. It also doesn't allow you to move stuff temporarily, like putting old newspapers on new table slots to make sure they're not obstructing the serving of food you're trying to give out.
So, I had a couple questions before diving in headlong:
Object IDs are evidently ulongs -- how do I reference objects in the game tables to determine what type they are?
[edit] Apparently what I'm looking for are things derived from IThrowAwayable, but don't yet know how to check to see how objects are derived from a given class/interface.
By the time the user has already picked up the item, the damage seems to be done. There appears to be an enumeration called (gah, Hungarian notation) "eEditTypeHandTool" with a value kEditTypeCancelled, but I can't figure out if I can force that or if that reacts solely to user input. Is there a way to push an event into the game that simulates a user cancelling a hand-tool action?
If not, is there a cheap and easy way to force the user to Undo?
[edit] Actually, scratch that... seems like that'd only work in Edit Mode, not Live Mode...
The sticky post warning mentions the answer to "is X possible?" is "find out yourself", but I was hoping that people had some experience with this so I don't wind up disheartening myself by biting off more than I can chew with my first project, like I did with GTAIV scripting. ;-)
[edit]
Further disjointed ramblings follow:
Add a delegate to World.IsInLiveDragModeEventHandler which evidently triggers when beginning to drag an object?
World.OnHandToolPickup?
World.HandToolGetObjectHeld()?
The simplest solution would be to disable live mode and edit mode dragging for those objects. But that doesn't push an event; it requires clicking an interaction menu and essentially cripples the existing drag-and-drop feature that's way more physically intuitive and fun. It also doesn't allow you to move stuff temporarily, like putting old newspapers on new table slots to make sure they're not obstructing the serving of food you're trying to give out.