1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Greetings Guest!!

    In order to combat SPAM on the forums, all users are required to have a minimum of 2 posts before they can submit links in any post or thread.

    Dismiss Notice

[Tech Help] Some serious API docs?

Discussion in 'UO Enhanced Client Discussion' started by pgcd, Sep 12, 2009.

  1. pgcd

    pgcd Guest

    For the third time in as many attempts, I find myself unable to complete my script because I don't know how to do what I need to do - this time it's the DragSlot* functions, last time it was the targeting system etc.
    It's very possible that I'm just too dumb to figure out myself how to do stuff, but I feel that some kind of actual documentation would be nice, especially about all those bits that are not exactly obvious. Would it be too much to ask for?

    A few examples of what I mean:
    - Is there any way of knowing what equipment slot would the currently selected item take?
    - Is there any way of assigning a different target container to DragSlotAutoPickupObject()?
    - Is there any way of invoking a macro from LUA?
    - Is there any way of using an object from LUA?
    - Is there any way of reacting to specific chat window lines?
    etc etc.
     
  2. Gildar

    Gildar Babbling Loonie
    Stratics Veteran

    Joined:
    Apr 22, 2004
    Messages:
    2,354
    Likes Received:
    4
    There is some documentation included in the CustomUIDocumentation zip.
    That's all we have, aside from trial-and-error.

    I would like to add some modder-written API to the Modders Exchange though... perhaps we could start here?

    Let's start with the big question... what kind of format would everybody prefer?
     
  3. pgcd

    pgcd Guest

    The one i have is the Kingdom Reborn one - I hope there was some overwrite issue and it's not the actual, current one?

    As for the docs format, html has my vote.
     
  4. Gildar

    Gildar Babbling Loonie
    Stratics Veteran

    Joined:
    Apr 22, 2004
    Messages:
    2,354
    Likes Received:
    4
    While the CustomUIDocumentation file says Kingdom Reborn, it is actually updated for the Enhanced Client.

    And I didn't mean file format - I meant organization. Do you want it to be like what is in the Custom UI Documentation file? Or more like Javadocs? Or some other kind of style?
     
  5. Gildar

    Gildar Babbling Loonie
    Stratics Veteran

    Joined:
    Apr 22, 2004
    Messages:
    2,354
    Likes Received:
    4
    How would something like this work:
    http://uo.modders-exchange.net/wiki/API_ALL_ROOT

    Obviously, I'd want to add in more pages that narrow in on certain tasks instead of just listing EVERYTHING, but what do you think of the general style?
     
  6. lucitus

    lucitus UOEC Modder
    Stratics Veteran

    Joined:
    May 13, 2008
    Messages:
    1,426
    Likes Received:
    45
    - make a table where you read out all items, if it carried up, the interface knows the source id
    - auto dragging from one to other container, maybe possible, look at the auto loot function
    - invoking macros from lua isnt possible (extra security reasons)
    - using objects from lua is also blocked same reasons
    - yep you can retrieve all chat by using the SystemData.Events.TEXT_ARRIVED event
    and the
    Code:
    	-- Debug.PrintToDebugConsole(L"text arrived "..SystemData.Text)
    	-- Debug.PrintToDebugConsole(L"source id "..SystemData.TextSourceID)
    	-- Debug.PrintToDebugConsole(L"channel id "..SystemData.TextChannelID)
    	-- Debug.PrintToDebugConsole(L"source name "..StringToWString(SystemData.SourceName))
    	-- Debug.PrintToDebugConsole(L"color "..SystemData.TextColor)
    
    tables

    if you want to see what is all stored in the windowdata tables, use the ggmanagertabletostring function, also search in the uokr forum there are many things posted.
     
  7. pgcd

    pgcd Guest

    Sorry, I didn't realize you meant *that* format... That API_ALL_ROOT page you mention is great if you already know what you're looking for, but something with a more task-oriented structure would be more useful, I think. I can't think of any examples off the top of my head right now, though.


    I don't think I understand: what items should I read and from where, and how does the id of the object help me in knowing the equipment slot it would take *before* it's there?
    The objective of this is to allow stuff like before/after comparison for armor pieces: if i'm looking at a gorget on a vendor, I want to see what would my resists be using that instead of the gorget I'm wearing.
    Right now, unless I go crazy and manually enter all the objecttypes => eq_slot pairs (which is not going to happen), I see no way of knowing that a gorget takes that slot and that slot is currently occupied by that other gorget.


    That's exactly what I've done and precisely the reason why I'd like to see some docs for the API, because the autoloot function only sets the object ID, and I'd like to also set the container ID.


    As for not allowing object usage and macros from LUA, it's just silly. It's not as if a certain, unnamable program won't ever work with SA - the unattended macroing problem should be solved with more GM presence etc, not by making it impossible for me to, E.G., invoking one of two different macros depending on some external condition (my current predicament: why do all my weap equip macros have to include a 1.2 sec delay when it's only required when passing from 1H to 2H weapons and viceversa?)
     
  8. Gildar

    Gildar Babbling Loonie
    Stratics Veteran

    Joined:
    Apr 22, 2004
    Messages:
    2,354
    Likes Received:
    4
    Not true.

    Code:
    UserActionUseItem( objectID, true )
    Uses the object specified by objectID. Not sure what the true flag is for, or what happens if you pass false. It follows the same rules as double-clicking an item - you need to have access to it, need to wait between uses, etc.


    And while you might not be able to execute a macro directly... you can execute something in a hotbar slot:
    Code:
    HotbarExecuteItem(hotbarId, itemIndex)
     
  9. Gildar

    Gildar Babbling Loonie
    Stratics Veteran

    Joined:
    Apr 22, 2004
    Messages:
    2,354
    Likes Received:
    4
    Code:
    DragSlotSetObjectMouseClickData(objectID, SystemData.DragSource.SOURCETYPE_CONTAINER)
    DragSlotDropObjectToContainer( containerID, 0 )
    :thumbsup:

    Note: You might need to force a delay in-between those, I tested using script commands.
     
  10. pgcd

    pgcd Guest

    I had found this as well but I feel like the delay is a hack, since the autoloot function doesn't use one...
    Anyway, thanks for the hints and solutions but, still, I think it shouldn't be you being smart and finding stuff, it should be the devs taking a few days (after the well-deserved post-SA holidays, ok) to concoct a full API reference. IMHO, of course.
     
  11. pgcd

    pgcd Guest

    Uhm, after a while, I think this doesn't work, except with script commands. Which brings me back to the original point: can we/I have some help from actual devs about this kind of stuff?
     
  12. pgcd

    pgcd Guest

    Again on this: the only way this half-works is by having the drop happen in UpdatePickupTimer, and I can't make it work like it should (i.e. like AutoPickup) - the item has to be actually dragged a little and then it drops in your bag.

    Since other players are interested, would the very nice BTeng help us out?
     
  13. Gildar

    Gildar Babbling Loonie
    Stratics Veteran

    Joined:
    Apr 22, 2004
    Messages:
    2,354
    Likes Received:
    4
    I can get it to work through scripts... the trick is you need to move the mouse in between the two calls.

    Unfortunately, I can't find anything that moving the mouse might trigger, or a way to pretend the mouse moved.