EQ2Service Scripting Object v.1.2
Posted: February 9th, 2005, 4:54 am
This is the OLD thread. Please see the one in the Confirmed EQ2 Programs/Scripts forum.
!!!
April 21, 2005
Added InstanceName
Added MobDifficulty
Fixed Several Broken Memory Offsets
Fixed Bad Target Drawing on the radar (would overlap and was hard to read)
Added PC types, so the Draw PC, DrawNPC should now work correctly...
April 6, 2005
Fixed the EQ2 Service for today's update.
Also, fixed the Map so that it is oriented correctly
Also added a partial name match for FindMob and FindNearestMob
April 4, 2005
Pached for a few memory locs that were not working anymore.
February 17, 2005
Ouch, I totally redid the way mobs are handled. So all of the API's changed from Index to
SpawnID's. Please be sure to update your sources. I am sorry this had to happen, but I would
rather do it now than try and handle it later.
Added several new functions and fixed quite a few bugs.
Most notable, are mob levels, player levels, etc. All working!
Current Functions (See .vbs for actual function calls).
These are the shortcuts listed in the vbs file:
'EQ2 Service by WyvernX
'Version 1.2.1.0
'Grab it from the downloads section and install it in XUnleashed.
Attached is a file you can import into your scripts to use EQ2 functions above.
You still have to install the EQ2Service however. The attached file is just a reference file on how to use the EQ2Service API.
!!!
April 21, 2005
Added InstanceName
Added MobDifficulty
Fixed Several Broken Memory Offsets
Fixed Bad Target Drawing on the radar (would overlap and was hard to read)
Added PC types, so the Draw PC, DrawNPC should now work correctly...
April 6, 2005
Fixed the EQ2 Service for today's update.
Also, fixed the Map so that it is oriented correctly
Also added a partial name match for FindMob and FindNearestMob
April 4, 2005
Pached for a few memory locs that were not working anymore.
February 17, 2005
Ouch, I totally redid the way mobs are handled. So all of the API's changed from Index to
SpawnID's. Please be sure to update your sources. I am sorry this had to happen, but I would
rather do it now than try and handle it later.
Added several new functions and fixed quite a few bugs.
Most notable, are mob levels, player levels, etc. All working!
Current Functions (See .vbs for actual function calls).
These are the shortcuts listed in the vbs file:
'EQ2 Service by WyvernX
'Version 1.2.1.0
'Grab it from the downloads section and install it in XUnleashed.
Code: Select all
'EQ2 Service by WyvernX
'Version 1.2.1.0
'You can either IMPORT this script into your own, or you can edit this file directly and use the sample code below.
'If you IMPORT this script use this syntax:
'Example on how to Import this script to just have access to the functions.
'================================================
'0. Save the EQ2Service.vbs file to your scripts folder.
'1. Create a file with note pad and save it as YourScriptName.vbs
'2. Add the following lines:
'XUScriptPlugin.staStatus.Text = "Loading library... (EQ2Service)"
'XUScriptHost.ImportScript("EQ2Service.vbs")
'3. Now you can add the rest below:
'Example on how to Declare and Use the EQ2 Service Object
'================================================
'Dim oEQ2Service
'on error resume next
'set oEQ2Service= XUScriptPlugin.GetService("EQ2Service.Service")
'if Err.number <> 0 then
' ' EQ2Service didn't load
' XUScriptPlugin.staStatus.Text = "EQ2Service failed to load"
'else
' on error goto 0
' Dim playerName
' playerName = getPlayerName(oEQ2Service)
' XUScriptPlugin.staStatus.Text = "Player's Name is: " & playerName
'end if
'Sleep 5000
'set oEQ2Service = Nothing
'Currently Implemented Functions:
'================================================
'function getPlayerName(ByRef obj) //Returns the Player's Name
'function getPlayerHeading(ByRef obj) //Returns the Player's Heading
'function getPlayerZ(ByRef obj) //Returns the Player's Z Coordinage
'function getPlayerY(ByRef obj) //Returns the Player's Y Coordinage
'function getPlayerX(ByRef obj) //Returns the Player's X Coordinage
'function getPlayerHealth(ByRef obj) //Returns the Player's Health
'function getPlayerMaxHealth(ByRef obj) //Returns the Player's Max Health
'function getPlayerPower(ByRef obj) //Returns the Player's Power
'function getPlayerMaxPower(ByRef obj) //Returns the Player's Max Power
'function getAdventurerLevel(ByRef obj) //Returns the Player's Adventurer Level
'function getArtisanLevel(ByRef obj) //Returns the Player's Artisan Level
'function getTargetID(ByRef obj) //Returns the Target SpawnID
'function getMobIndex(ByRef obj, SpawnID) '//Returns the Mob Index for a given ID
'function getMobID(ByRef obj, Index) //Returns the Mob ID for a given Index
'function getMobName(ByRef obj, SpawnID) //Returns the Mob Name for a given SpawnID
'function getMobX(ByRef obj, SpawnID) //Returns the Mob X for a given SpawnID
'function getMobY(ByRef obj, SpawnID) //Returns the Mob Y for a given SpawnID
'function getMobZ(ByRef obj, SpawnID) //Returns the Mob Z for a given SpawnID
'function getMobLevel(ByRef obj, SpawnID) '//Returns the Mob Level for a given SpawnID
'function mobIsAttacking(ByRef obj, Index) '//Returns the true/false if mob is attacking something for a given SpawnID
'function getMobHealth(ByRef obj, SpawnID) '//Returns the Mob Index for a given ID
'function getMobPower(ByRef obj, SpawnID) '//Returns the Mob Index for a given ID
'function getMobDifficulty(ByRef obj, SpawnID) '//Returns the Mob Difficulty Rating (-1 = easy, 0 = normal, 8 = ^, 9 = ^^ etc.)
'function findMob(ByRef obj, MobName) //Returns the first Mob Index for a given name or -1 if not found (partial match ok)
'function findNextMob(ByRef obj) //Returns the Next Mob Index for a given name or -1 if not found (partial match ok)
'function findNearestMob(ByRef obj, MobName) '//Returns the Nearest Mob ID for a given name or -1 if not found (partial match ok)
'function findNextNearestMob(ByRef obj) '//Returns the Next Nearest Mob ID for a given name or -1 if not found (partial match ok)
'function getMaxIndex(ByRef obj) //Returns the CURRENT maximum index value of the spawn Indexes
'function getZoneName(ByRef obj) //Returns the Zone Name
'function getInstanceName(ByRef obj) //Returns the Zone Instance (short) Name
'[helpstring("method UpdateData")] HRESULT UpdateData(void);
'This does not need to be directly called, because it is called in the functions below.
'[propget, id(16), helpstring("property PlayerName")] HRESULT PlayerName([out, retval] BSTR* pVal);
function getPlayerName(ByRef obj)
on error resume next
obj.UpdateData
if Err.Number = 0 then
getPlayerName = obj.PlayerName
else
getPlayerName = "<INVALID>"
end if
on error goto 0
end function
'[propget, id(1), helpstring("property PlayerHeading")] HRESULT PlayerHeading([out, retval] FLOAT* pVal);
function getPlayerHeading(ByRef obj)
on error resume next
obj.UpdateData
if Err.Number = 0 then
getPlayerHeading = obj.PlayerHeading
else
getPlayerHeading = -1
end if
on error goto 0
end function
'[propget, helpstring("property PlayerZ")] HRESULT PlayerZ([out, retval] FLOAT* pVal);
function getPlayerZ(ByRef obj)
on error resume next
obj.UpdateData
if Err.Number = 0 then
getPlayerZ = obj.PlayerZ
else
getPlayerZ = -99999
end if
on error goto 0
end function
'[propget, helpstring("property PlayerY")] HRESULT PlayerY([out, retval] FLOAT* pVal);
function getPlayerY(ByRef obj)
on error resume next
obj.UpdateData
if Err.Number = 0 then
getPlayerY = obj.PlayerY
else
getPlayerY = -99999
end if
on error goto 0
end function
'[propget, helpstring("property PlayerX")] HRESULT PlayerX([out, retval] FLOAT* pVal);
function getPlayerX(ByRef obj)
on error resume next
obj.UpdateData
if Err.Number = 0 then
getPlayerX = obj.PlayerX
else
getPlayerX = -99999
end if
on error goto 0
end function
'[propget, id(13), helpstring("property PlayerHealth")] HRESULT PlayerHealth([out, retval] LONG* pVal);
function getPlayerHealth(ByRef obj)
on error resume next
obj.UpdateData
getPlayerHealth = obj.PlayerHealth
if Err.Number <> 0 then
getPlayerHealth = -1
end if
on error goto 0
end function
'[propget, id(15), helpstring("property PlayerMaxHealth")] HRESULT PlayerMaxHealth([out, retval] LONG* pVal);
function getPlayerMaxHealth(ByRef obj)
on error resume next
obj.UpdateData
getPlayerMaxHealth = obj.PlayerMaxHealth
if Err.Number <> 0 then
getPlayerMaxHealth = -1
end if
on error goto 0
end function
'[propget, id(14), helpstring("property PlayerPower")] HRESULT PlayerPower([out, retval] LONG* pVal);
function getPlayerPower(ByRef obj)
on error resume next
obj.UpdateData
getPlayerPower = obj.PlayerPower
if Err.Number <> 0 then
getPlayerPower = -1
end if
on error goto 0
end function
'[propget, id(16), helpstring("property PlayerMaxPower")] HRESULT PlayerMaxPower([out, retval] LONG* pVal);
function getPlayerMaxPower(ByRef obj)
on error resume next
obj.UpdateData
getPlayerMaxPower = obj.PlayerMaxPower
if Err.Number <> 0 then
getPlayerMaxPower = -1
end if
on error goto 0
end function
'[propget, id(20), helpstring("property AdventurerLevel")] HRESULT AdventurerLevel([out, retval] LONG* pVal);
function getAdventurerLevel(ByRef obj) '//Returns the Player's Adventurer Level
on error resume next
obj.UpdateData
getAdventurerLevel = obj.AdventurerLevel
if Err.Number <> 0 then
getAdventurerLevel = -1
end if
on error goto 0
end function
'[propget, id(21), helpstring("property ArtisanLevel")] HRESULT ArtisanLevel([out, retval] LONG* pVal);
function getArtisanLevel(ByRef obj) '//Returns the Player's Artisan Level
on error resume next
obj.UpdateData
getArtisanLevel = obj.ArtisanLevel
if Err.Number <> 0 then
getArtisanLevel = -1
end if
on error goto 0
end function
'[propget, id(19), helpstring("property TargetID")] HRESULT TargetID([out, retval] LONG* pVal);
function getTargetID(ByRef obj) '//Returns the Target SpawnID
on error resume next
obj.UpdateData
getTargetID = obj.TargetID
if Err.Number <> 0 then
getTargetID = -1
end if
on error goto 0
end function
'[propget, id(3), helpstring("property MobID")] HRESULT MobID([in] LONG Index, [out, retval] LONG* pVal);
function getMobID(ByRef obj, Index) '//Returns the Mob ID for a given Index
on error resume next
obj.UpdateData
getMobID = obj.MobID (Index)
if Err.Number <> 0 then
getMobID = -1
end if
on error goto 0
end function
'[propget, id(8), helpstring("property MobName")] HRESULT MobName([in] LONG SpawnID, [out, retval] BSTR* pVal);
function getMobName(ByRef obj, SpawnID) '//Returns the Mob Name for a given SpawnID
on error resume next
obj.UpdateData
getMobName = obj.MobName (SpawnID)
if Err.Number <> 0 then
getMobName = "<INVALID>"
end if
on error goto 0
end function
'[propget, id(4), helpstring("property MobX")] HRESULT MobX([in] LONG SpawnID, [out, retval] FLOAT* pVal);
function getMobX(ByRef obj, SpawnID) '//Returns the Mob X for a given SpawnID
on error resume next
obj.UpdateData
getMobX = obj.MobX (SpawnID)
if Err.Number <> 0 then
getMobX = -99999
end if
on error goto 0
end function
'[propget, id(5), helpstring("property MobY")] HRESULT MobY([in] LONG SpawnID, [out, retval] FLOAT* pVal);
function getMobY(ByRef obj, SpawnID) '//Returns the Mob Y for a given SpawnID
on error resume next
obj.UpdateData
getMobY = obj.MobY (SpawnID)
if Err.Number <> 0 then
getMobY = -99999
end if
on error goto 0
end function
'[propget, id(6), helpstring("property MobZ")] HRESULT MobZ([in] LONG SpawnID, [out, retval] FLOAT* pVal);
function getMobZ(ByRef obj, SpawnID) '//Returns the Mob Z for a given SpawnID
on error resume next
obj.UpdateData
getMobZ = obj.MobZ (SpawnID)
if Err.Number <> 0 then
getMobZ = -99999
end if
on error goto 0
end function
'[id(12), helpstring("method FindMob")] HRESULT FindMob([in] BSTR Name, [out,retval] LONG* Index);
function findMob(ByRef obj, MobName) '//Returns the first Mob SpawnID for a given name or -1 if not found
on error resume next
obj.UpdateData
findMob = obj.FindMob (MobName)
if Err.Number <> 0 then
findMob = -1
end if
on error goto 0
end function
'[id(23), helpstring("method FindNextMob")] HRESULT FindNextMob([out,retval] LONG* Index);
function findNextMob(ByRef obj) '//Returns the Next Mob SpawnID for a given name or -1 if not found
on error resume next
obj.UpdateData
findNextMob = obj.FindNextMob
if Err.Number <> 0 then
findNextMob = -1
end if
on error goto 0
end function
'[propget, id(22), helpstring("property MaxIndex")] HRESULT MaxIndex([out, retval] LONG* pVal);
function getMaxIndex(ByRef obj) '//Returns the CURRENT maximum index value of the spawn Indexes
on error resume next
obj.UpdateData
getMaxIndex = obj.MaxIndex
if Err.Number <> 0 then
getMaxIndex = -1
end if
on error goto 0
end function
'[propget, id(24), helpstring("property ZoneName")] HRESULT ZoneName([out, retval] BSTR* pVal);
function getZoneName(ByRef obj)
on error resume next
obj.UpdateData
if Err.Number = 0 then
getZoneName = obj.ZoneName
else
getZoneName = "<INVALID>"
end if
on error goto 0
end function
'[propget, id(25), helpstring("property MobLevel")] HRESULT MobLevel([in] LONG Index, [out, retval] LONG* pVal);
function getMobLevel(ByRef obj, SpawnID) '//Returns the Mob Level for a given Index
on error resume next
obj.UpdateData
getMobLevel = obj.MobLevel (SpawnID)
if Err.Number <> 0 then
getMobLevel = -1
end if
on error goto 0
end function
'[propget, id(26), helpstring("property IsAttacking")] HRESULT IsAttacking([in] LONG Index, [out, retval] VARIANT_BOOL* pVal);
function mobIsAttacking(ByRef obj, SpawnID) '//Returns the true/false if mob is attacking something for a given Index
on error resume next
obj.UpdateData
mobIsAttacking = obj.IsAttacking (SpawnID)
if Err.Number <> 0 then
mobIsAttacking = false
end if
on error goto 0
end function
'[propget, id(29), helpstring("property MobIndex")] HRESULT MobIndex([in] LONG SpawnID, [out, retval] LONG* pVal);
function getMobIndex(ByRef obj, SpawnID) '//Returns the Mob Index for a given ID
on error resume next
obj.UpdateData
getMobIndex = obj.MobIndex (SpawnID)
if Err.Number <> 0 then
getMobIndex = -1
end if
on error goto 0
end function
'[id(30), helpstring("method FindNearestMob")] HRESULT FindNearestMob([in] BSTR Name, [out,retval] LONG* SpawnID);
function findNearestMob(ByRef obj, MobName) '//Returns the Nearest Mob ID for a given name or -1 if not found
on error resume next
obj.UpdateData
findNearestMob = obj.FindNearestMob (MobName)
if Err.Number <> 0 then
findNearestMob = -1
end if
on error goto 0
end function
'[id(31), helpstring("method FindNextNearestMob")] HRESULT FindNextNearestMob([out,retval] LONG* SpawnID);
function findNextNearestMob(ByRef obj) '//Returns the Next Nearest Mob ID for a given name or -1 if not found
on error resume next
obj.UpdateData
findNextNearestMob = obj.FindNextNearestMob
if Err.Number <> 0 then
findNextNearestMob = -1
end if
on error goto 0
end function
'[propget, id(27), helpstring("property MobHealth")] HRESULT MobHealth([in] LONG SpawnID, [out, retval] LONG* pVal);
function getMobHealth(ByRef obj, SpawnID) '//Returns the Mob Index for a given ID
on error resume next
obj.UpdateData
getMobHealth = obj.MobHealth (SpawnID)
if Err.Number <> 0 then
getMobHealth = -1
end if
on error goto 0
end function
'[propget, id(28), helpstring("property MobPower")] HRESULT MobPower([in] LONG SpawnID, [out, retval] LONG* pVal);
function getMobPower(ByRef obj, SpawnID) '//Returns the Mob Index for a given ID
on error resume next
obj.UpdateData
getMobPower = obj.MobPower (SpawnID)
if Err.Number <> 0 then
getMobPower = -1
end if
on error goto 0
end function
'[propget, id(32), helpstring("property InstanceName")] HRESULT InstanceName([out, retval] BSTR* pVal);
function getInstanceName(ByRef obj)
on error resume next
obj.UpdateData
if Err.Number = 0 then
getInstanceName = obj.InstanceName
else
getInstanceName = "<INVALID>"
end if
on error goto 0
end function
'[propget, id(33), helpstring("property MobDifficulty")] HRESULT MobDifficulty([in] LONG SpawnID, [out, retval] LONG* pVal);
function getMobDifficulty(ByRef obj, SpawnID) '//Returns the Mob Difficulty rating for a given ID
on error resume next
obj.UpdateData
getMobDifficulty = obj.MobPower (SpawnID)
if Err.Number <> 0 then
getMobDifficulty = -5 'Defaults to -5 which is Items, -4 = Players, 0 = normal mobs, 8 = ^, 9= ^^ etc)
end if
on error goto 0
end function
Attached is a file you can import into your scripts to use EQ2 functions above.
You still have to install the EQ2Service however. The attached file is just a reference file on how to use the EQ2Service API.