Page 1 of 8
New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 12:04 am
by GSH
I've explored adding some new exe -> DLL callbacks, where the DLL can be notified of things. Right now, I've added messages to the DLL on snipes and also ordnance hitting a gameobject. Any other requests? Be reasonable, or the request might be ignored.
-- GSH
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 12:37 am
by General BlackDragon
being able to see explosions maybe?
More specific entries for GetNearest* objects. Maybe a GetNearestClasslabel("CLASS_BLAH", teamfilter, distance);
I had noticed a while back that getNearestPowerup did not include classlabel camerapod.
Currently AudioMessage("blah.wav"); plays sounds in order. Is there a way to make a sound happen instantly? like giving it a higher priority? When several audioMessages are called, sometimes they may delay a more important audio message. I've tried the purge as true and false, it has no effect on this behavior, though i'm not entirely sure what it's supposed to do.
For the animations, there is only Set, Start, and getframe. Can there be a StopAnimation(Handle h, Name n); where it pauses the animation, or stops it once it ends/reaches beginning of loop?
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 2:23 am
by Nielk1
When an order is given with priority 0, leaving the user in control, the unit acts as if the player gave the order, resulting in the voice over being played. There is a squelch on/off, but it is only designed to force the voice overs to play when priorities over 0 are used. Some method to squelch this on priority zero without breaking the existing missions using the stock command (so I guess a new command) would be appreciated. It was the one think preventing me from having a working hunt.
The ability to check the current orders of a factory or constructor down to what it is building. I have not tested the existing functions with constructors, but I know that trying to check the current orders on a factory or recycler building gives no useful values. Knowing what is being built and when can be quite helpful, at least knowing when building is starting and stopping (by checking a state value per execute or a callback) would allow for triggering of custom animations in the factory while it builds (for example, BZ1's animations).
On the note of the above, if it was a callback, the ability to intercept and deny a build request would be neat. It would allow for custom resources to be done without a complex system of provides or using only scrap and power, but it might be against the way the system is designed.
Some form of filtered (or even unfiltered) finding does sound useful, though I can't give any suggestions on how to implement it. The ability to "find in sphere" or some such and getting an array of handles would be nifty, as currently we have to track every object that can be effected and globally check the entire list we have stored for its distance. Other find shapes like cones and boxes would be cool but any sort of find would allow us to create our own result culling after it has run.
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 2:28 am
by General BlackDragon
OH yeah, that reminds me. All of the GetNearest commands only find things in 2d space within the maxDist, not 3d space. Would be useful to have a way to check within 3d, vs 2d.
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 4:51 am
by Red Devil
maybe DLL callbacks converted to Lua functions?
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 4:58 am
by Nielk1
Red Devil wrote:maybe DLL callbacks converted to Lua functions?
GSH already said that someone needs to make the ScriptUtils Lua bindings. I tried but I got lost in the stack since the LUA functions require manual popping and pushing onto the stack to make it work. I was never sure if I was leaving crap on the stack or not since it was unclear what was done automatically by returning from a bound function and what was not. Since, GSH has changed to a different LUA IIRC (unless he is still using stock lua5.1 bindings) what I did wouldn't be that useful anyway. Unless he hasn't, in which case, ick. I've got to talk to Ken again some time about how he did his LUA for BZ1, maybe you could talk to him RD and then do the bindings how he describes? Once the process of binding is known, it is just lots and lots of busy work.
If GSH wanted to bind a few functions as an example and pass it off I am sure we could get it done.
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 3:00 pm
by General BlackDragon
Ooo, I know two that would be VERY useful.
Goto(Handle me, Vector Pos, int priority = 1);
GiveWeapon(Handle me, Name weapon, int weaponIndex);
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 9:53 pm
by Nielk1
Some method to know for sure that a unit has dropped an item from a dispenser would be nice. It was noted when the getOwner function was added that it may not do what is expected as it is not absolute.
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 10:01 pm
by Red Devil
i, too, tried and quickly got lost trying to do the lua bindings. show us the way and i will do the grunt work.
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 10:06 pm
by General BlackDragon
Thought of another good one,
FireAt(Handle me, Handle him = 0, bool doAim = false, int WeaponIndex);
Re: New DLL callbacks - any requests?
Posted: Mon Jun 24, 2013 10:19 pm
by GSH
Lua bindings could theoretically be done in a DLL, mapping calls to ScriptUtils.h calls.
Things like goto/fire at are much harder to do than expected. All AI is managed thru the *Process interfaces, and overriding them at the drop of a hat is a lot of work.
-- GSH
Re: New DLL callbacks - any requests?
Posted: Tue Jun 25, 2013 2:40 am
by General BlackDragon
Darn, I was hoping a Goto that takes a vector position would be easy to do
Re: New DLL callbacks - any requests?
Posted: Tue Jun 25, 2013 8:42 pm
by Nielk1
Yea for Lua my hope is to have a bindings for script utils that the AIP can use and have a mission DLL that has all the core callbacks implemented and ones for my custom data-channel too. I haven't touched the DLLs in a long time though, probably since I tried to do the Lua the first time. I wonder if Ken knows of an auto-bindings that I could try.
Re: New DLL callbacks - any requests?
Posted: Wed Jun 26, 2013 12:48 am
by General BlackDragon
Currently, there is no way to tell which pilot odf is inside of a ship.
DLLEXPORT void DLLAPI SetPilotClass(Handle obj, char* odf);
This sets the pilot class, Would it be easy to add the following that returns the pilot config odf for the pilot inside a ship?:
DLLEXPORT char DLLAPI GetPilotClass(Handle obj);
Re: New DLL callbacks - any requests?
Posted: Wed Jun 26, 2013 2:12 am
by GSH
GiveWeapon(Handle me, Name weapon, int weaponIndex);
There's already GiveWeapon(Handle me, Name weapon) -- like above, but no index. That existing function just subcontracts out to the same code as the powerup pickup logic -- checking whether the ship has hardpoints that match weapon types, etc.
-- GSH