Gathering Information from Item Links

Amadeus

The Maestro
Staff member
ISXVG now makes it easier to acquire information about items via item "links" (ie, the item examine popup window). The methodology for this is actually quite easy.

I. Activating an item link
An 'item examine window' can be activated by using the Vanguard command "/itemlinkrequest <LinkString>" (ie: "vgexecute /itemlinkrequest ${Me.Inventory[item name].Link}"). To acquire the "LinkString", one need only have the item in your inventory and use:
Code:
echo ${Me.Inventory[item name].Link}
Once you have the "LinkString", then you can store it in a database and use it at your leisure.



II. Getting Information from the Examine Item Window (popup)
Each time that you click on a link (or use the /itemlinkrequest command), an event will fire within ISXVG called VG_onClickItemLink. Unlike most events, VG_onClickItemLink does not have arguments; however, it does come with a contextual LSObject!

Rather than explain it, I'm going to simply give you a sample (simple) script. This script simply runs forever until you end it or unload ISXVG. When you click on a link (or use the /itemlinkrequest command), it will echo information to the console.

Code:
atom(script) VG_onClickItemLink()
{
    ; The Item being linked (as an 'item' datatype object) is sent as ${Context}
    echo Item Link Clicked:: ${Context.Name} (${Context.Description}) 
}
 
 
function main()
{
    ; If ISXVG isn't loaded, then no reason to run this script.
    if (!${ISXVG(exists)})
        return
 
    ;Initialize/Attach the event Atom that we defined previously
    Event[VG_onClickItemLink]:AttachAtom[VG_onClickItemLink]
 
    do 
    {
        waitframe
    }
    while ${ISXVG(exists)}
 
    ;We're done with the script, so let's detach all of the event atoms
    Event[VG_onClickItemLink]:DetachAtom[VG_onClickItemLink]
}
 

Amadeus

The Maestro
Staff member
And, as a side note, if you wanted to convert an item back to a clickable link, then you would use the "ToLink" member of the item datatype. For example, you could have the atom above do something like:
Code:
echo ${Context.ToLink}
Or.....if you want to create the link Manually, it would be something like this:

Code:
echo <item=${Context.Link}>${Context.Name}</link>
...and so on and so forth. In other words, you should have all the tools necessary to create a very functional and high quality item database / retrieval bot.
 

rootkit

Active Member
Ok, this works quite nice so far.
But, after a while my screen is full of popup item windows. Any chance for a functionality to close those popup windows per script?
 

Malstrom

Active Member
Is there anything else available besides .name and .description?
I'd like to capture more information about items.

Thanks!
 
Top Bottom