Page 1 of 13

EQ2Service Scripting Object v.1.2

Posted: February 9th, 2005, 4:54 am
by wyvernx
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.

Code: Register to unlock hidden link

'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.

Posted: February 18th, 2005, 2:05 am
by wyvernx
Fixed quite a few things (including zoning)

Levels, etc. check it out.

Please post new bugs in this thread!.

Also, note the API has drastically changed. Be sure to update your scripts.

The service uses ID's instead of Index's now.

Re: EQ2Service Scripting Object v.1.2

Posted: February 18th, 2005, 4:01 pm
by richyrich
Wyv - here is the version I'm using for MegaBot - changed the XYZ functions to be -99999 as 0 and negatives are valid values for XYZ in EQ. I changed an invalid heading to be -1 since 0 is a valid value too.

Rich

Code: Register to unlock hidden link

'EQ2 Service by WyvernX 
'Version 1.2.0.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 getPlayerAdventurerLevel(ByRef obj) //Returns the Player's Adventurer Level 
'function getPlayerArtisanLevel(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 findMob(ByRef obj, MobName) //Returns the first Mob Index for a given name or -1 if not found 
'function findNextMob(ByRef obj) //Returns the Next Mob Index for a given name or -1 if not found 
'function findNearestMob(ByRef obj, MobName) '//Returns the Nearest Mob ID for a given name or -1 if not found 
'function findNextNearestMob(ByRef obj) '//Returns the Next Nearest Mob ID for a given name or -1 if not found 

'function getMaxIndex(ByRef obj) //Returns the CURRENT maximum index value of the spawn Indexes 

'function getZoneName(ByRef obj) //Returns the Zone 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 TargetIndex")] HRESULT TargetIndex([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


Posted: February 18th, 2005, 4:05 pm
by wyvernx
Thanks, I've updated mine to reflect those changes.

Posted: February 18th, 2005, 4:25 pm
by richyrich
Any luck in find PetHealth & MaxHealth?

Posted: February 18th, 2005, 4:34 pm
by wyvernx
Not yet.

I really havnt looked yet. I gotta make me a pet summoner I guess, hehe..

Posted: February 18th, 2005, 4:56 pm
by richyrich
hehe -yeah :-)

Posted: February 18th, 2005, 5:04 pm
by richyrich
What program do you use to do the memory sniffing?

Posted: February 18th, 2005, 5:18 pm
by wyvernx
I like TSearch and CheatEngine 4.4

Posted: February 18th, 2005, 5:25 pm
by richyrich
Wyv - any idea of when the windows will be working properly in EQ2 w/o putting an EQ2 window behind it to move it?

Posted: February 18th, 2005, 5:43 pm
by richyrich
You changed the names of the Level functions but not the example at the top: Doesn't matter which one you go with, just make em the same :-)

getAdventurerLevel() & getPlayerAdventurerLevel()

Posted: February 18th, 2005, 6:31 pm
by wyvernx
Doh, yea the ones at the bottom (the real functions) are the ones that I'm keeping.

The extra "player" part was added by mistake.

Posted: February 19th, 2005, 1:33 pm
by richyrich
Wyv - have you come up with the logic yet that determines CON level (color) yet so I don't have to invent it from scratch :-)

Thanks,
Rich

Re: EQ2Service Scripting Object v.1.2

Posted: February 19th, 2005, 2:50 pm
by richyrich
Wyv - I must not understand the logic behind the Mob List.
I want to get the entire list of Mobs into my own array to do my own sorting. The code is below, ignore all the specifics about MegaBot and see if my main logic for getting the mobs is flawed. It goes through the list but none ever return a valid SpawnID, thus it never hits the middle loop. This is very similar to what I use to do in DAOC, but doesn't see to ever pull anything here.

Thanks,
Rich

Code: Register to unlock hidden link

Sub LoadMobList()
Dim i, c, n, x, y, z, lvl, maxMobs, LoadTimer, spawnID

	objDebug.Print "** Loading full Mob List **", 0

	Set LoadTimer = New TimerClass
	Call LoadTimer.StartTimer("Load Mob List Timer", 0)

	TotalMobs=0

	on error resume next 
   oEQ2Service.UpdateData 
   maxMobs = oEQ2Service.MaxIndex 
   if Err.Number <> 0 then 
		objDebug.Print "ERROR: Can't get MOB MaxIndex - exiting Sub()", 0
		on error goto 0 
		exit Sub
   end if 
	objDebug.Print "Max Mobs: " & maxMobs, 0

	c=1
	for i = 1 to maxMobs
		spawnID = oEQ2Service.MobID(i) 
		if Err.Number = 0 then 
			n = oEQ2Service.MobName(spawnID) 
			x = oEQ2Service.MobX(spawnID)
			y = oEQ2Service.Moby(spawnID)
			z = oEQ2Service.MobZ(spawnID) 
			lvl = oEQ2Service.MobLevel(spawnID) 
			Call MobList(c).CreateMon(c, n, x, y, z, lvl)
			Call MobList(c).Print(0)
			c = c + 1
			if c > 1000 then
				objDebug.Print "WARNING: Mob list is > 1000, limiting to 1000", 0
				exit for
			end if
		end if
	next
	
	on error goto 0 
	TotalMobs = c-1

	Call LoadTimer.GetTimer()
	set LoadTimer=NOTHING
end Sub


Posted: February 19th, 2005, 4:00 pm
by wyvernx
Yes that is correct, but I had to update the EQ2Service.


The MobID function was left out of the definition file. So you couldnt call it.

I'll have it posted here in just a few minutes.