Page 1 of 4

Fishing

Posted: Thu Jun 29, 2006 2:10 pm
by kellewic
Fishing script with XML config


fishing.iss

Code: Select all

#include Packs.inc

#macro ProcessQueue()
   while ${QueuedCommands}
      ExecuteQueued
#endmac

variable string xmlSettingsFile = ${LavishScript.HomeDirectory}/Scripts/fishing/fishing.xml
variable collection:int items
variable collection:int maxItemsToKeep
variable collection:int poles
variable collection:int itemsCaught
variable bool doDisplayStats = TRUE
variable Inventory inventory
variable int poleSlot = 0

; Statistics variables
variable int landSharks = 0
variable int timesCast = 0
variable int timesNoCatch = 0
variable int timesCatch = 0
variable int timesDestroyed = 0
variable int timesKept = 0
variable int abilityIncreases = 0
variable int spilledBeer = 0
variable int lostBait = 0


function main()
{
	ext -require ISXEQ

	echo Let's go fishin'!!!
	call init

	if (${Me.Ability[Fishing]} == 0)
	{
		echo Fishing is not created as an ability button
		call StopMe
	}

	call checkPole

	while (TRUE)
	{
		if (${Me.AbilityReady[Fishing]})
		{
			EQExecute /doability ${Me.Ability[Fishing]}
		}

		ProcessQueue()
		waitframe
	}
}

function init()
{
	SettingXML[${xmlSettingsFile}]:Unload

	variable string globalSet = SettingXML[${xmlSettingsFile}].Set["Global"]
	variable string zoneSet = SettingXML[${xmlSettingsFile}].Set["Zones"]
	variable string poleSet = SettingXML[${xmlSettingsFile}].Set["Fishing Poles"]
	variable byte x = 0
	variable string myZone
	variable string myPole
	variable string tempString
	variable int tempCount = 0

	/* Load up global items */
	while (${x:Inc} <= ${${globalSet}.Keys})
	{
		tempString:Set[${${globalSet}.GetString[${${globalSet}.Key[${x}]}]}]
		tempCount:Set[${tempString.Count[:]}]

		if (${tempCount} != 0)
		{
			maxItemsToKeep:Set[${${globalSet}.Key[${x}]}, ${tempString.Token[2,:]}]
		}

		items:Set[${${globalSet}.Key[${x}]}, ${${globalSet}.GetInt[${${globalSet}.Key[${x}]}]}]
	}

	/* Load up specific zone items */
	x:Set[0]
	while (${x:Inc} <= ${${zoneSet}.Sets})
	{
		myZone:Set[${${zoneSet}.Set[${x}]}]

		if (${myZone.Equal[${Zone}]})
		{
			echo Found fishing data for <${myZone}>
			x:Set[0]

			while (${x:Inc} <= ${${zoneSet}.Set[${myZone}].Keys})
			{
				items:Erase[${${zoneSet}.Set[${myZone}].Key[${x}]}]

				tempString:Set[${${zoneSet}.Set[${myZone}].GetString[${${zoneSet}.Set[${myZone}].Key[${x}]}]}]
				tempCount:Set[${tempString.Count[:]}]

				if (${tempCount} != 0)
				{
					maxItemsToKeep:Erase[${${zoneSet}.Set[${myZone}].Key[${x}]}]
					maxItemsToKeep:Set[${${zoneSet}.Set[${myZone}].Key[${x}]}, ${tempString.Token[2,:]}]
				}

				items:Set[${${zoneSet}.Set[${myZone}].Key[${x}]}, ${${zoneSet}.Set[${myZone}].GetInt[${${zoneSet}.Set[${myZone}].Key[${x}]}]}]
			}

			Break
		}
	}

	/* DEBUG CODE
	if (${maxItemsToKeep.FirstKey(exists)})
	{
		do
		{
			echo ${maxItemsToKeep.CurrentKey}, ${maxItemsToKeep.CurrentValue}
		}
		while (${maxItemsToKeep.NextKey(exists)})
	}

	echo -------------------------------------------

	if (${items.FirstKey(exists)})
	{
		do
		{
			echo ${items.CurrentKey}, ${items.CurrentValue}
		}
		while (${items.NextKey(exists)})
	}
	END DEBUG CODE */

	/* Gather up all fishing pole data */
	x:Set[0]
	while (${x:Inc} <= ${${poleSet}.Keys})
	{
		poles:Set[${${poleSet}.Key[${x}]}, ${x}]
	}

	call addTriggers
}

function addTriggers()
{
	AddTrigger Event_EquipPole "You need to put your fishing pole in your primary hand."
	AddTrigger Event_AttackIsOn "You can't start fishing while attacking!"
	AddTrigger Event_CaughtItem "You caught @OBJECT@!"
	AddTrigger Event_CaughtSomething "You caught, something@*@"
	AddTrigger Event_CaughtNothing "You didn't catch anything."
	AddTrigger Event_CastLine "You cast your line."
	AddTrigger Event_SkillUp "You have become better at @TRADE@! (@LVL@)"
	AddTrigger Event_LandSharks "Trying to catch land sharks perhaps?"
	AddTrigger Event_SpillBeer "You spill your beer@*@"
	AddTrigger Event_NoBait "You can't fish without fishing bait@*@"
	AddTrigger Event_LostBait "You lost your bait!"
	AddTrigger Event_PoleBroke "Your fishing pole broke!"
	AddTrigger Event_AlreadyFishing "You are already fishing!"
	AddTrigger Event_HoldingSomething "You can't fish while holding something."
}

function checkPole()
{
	if (!${inventory.MainHand.Item.Type(exists)} || ${inventory.MainHand.Item.Type.NotEqual[Fishing Pole]})
	{
		if (${poles.FirstKey(exists)})
		{
			do
			{
				poleSlot:Set[${inventory.FindItem[${poles.CurrentKey}]}]

				if (${poleSlot} > 0)
				{
					call inventory.Swap ${poleSlot} ${inventory.MainHand.ID}
					Break
				}
			}
			while (${poles.NextKey(exists)})
		}
	}

	if (${inventory.MainHand.Item.Type.NotEqual[Fishing Pole]})
	{
		call StopMe
	}
}

function StopMe()
{
	call inventory.Swap ${poleSlot} ${inventory.MainHand.ID}
	endscript fishing
}

function atexit()
{
	SettingXML[${xmlSettingsFile}]:Unload

	RemoveTrigger Event_EquipPole
	RemoveTrigger Event_AttackIsOn
	RemoveTrigger Event_CaughtItem
	RemoveTrigger Event_CaughtSomething
	RemoveTrigger Event_CaughtNothing
	RemoveTrigger Event_CastLine
	RemoveTrigger Event_SkillUp
	RemoveTrigger Event_LandSharks
	RemoveTrigger Event_SpillBeer
	RemoveTrigger Event_NoBait
	RemoveTrigger Event_LostBait
	RemoveTrigger Event_PoleBroke
	RemoveTrigger Event_AlreadyFishing
	RemoveTrigger Event_HoldingSomething

	echo Fishing trip over
	echo on
	echo on

	if (${doDisplayStats})
	{
		call displayStats
	}
}

function displayStats()
{
	variable float caughtPercent
	variable float noCaughtPercent
	variable float spilledBeerPercent
	variable float lostBaitPercent
	variable float keptPercent
	variable float destroyedPercent

	if (${timesCast} > 0)
	{
		caughtPercent:Set[${Math.Calc[(${timesCatch}/${timesCast})*100]}]
		noCaughtPercent:Set[${Math.Calc[(${timesNoCatch}/${timesCast})*100]}]
		spilledBeerPercent:Set[${Math.Calc[(${spilledBeer}/${timesCast})*100]}]
		lostBaitPercent:Set[${Math.Calc[(${lostBait}/${timesCast})*100]}]
	}

	if (${timesCatch} > 0)
	{
		keptPercent:Set[${Math.Calc[(${timesKept}/${timesCatch})*100]}]
		destroyedPercent:Set[${Math.Calc[(${timesDestroyed}/${timesCatch})*100]}]
	}

	echo --------------- FISHING STATISTICS ---------------
	echo Ability Ups........................ ${abilityIncreases}
	echo Cast............................... ${timesCast} (100%)
	echo Caught............................. ${timesCatch} (${caughtPercent}%)
	echo   Kept................................. ${timesKept} (${keptPercent}%)
	echo   Destroyed............................ ${timesDestroyed} (${destroyedPercent}%)
	echo No Caught.......................... ${timesNoCatch} (${noCaughtPercent}%)
	echo Land Sharks........................ ${landSharks}
	echo Spilled Beer....................... ${spilledBeer} (${spilledBeerPercent}%)
	echo Lost Bait.......................... ${lostBait} (${lostBaitPercent}%)

	if (${timesCatch} > 0 && ${itemsCaught.FirstKey(exists)})
	{
		variable float temp = 0.0
		echo -------
		echo DETAILS
		echo -------

		do
		{
			temp:Set[${Math.Calc[(${itemsCaught.CurrentValue}/${timesCatch})*100]}]
			echo ${itemsCaught.CurrentKey}........................ ${itemsCaught.CurrentValue} (${temp}%)
		}
		while (${itemsCaught.NextKey(exists)})
	}
}

function handleCursor()
{
	timesCatch:Inc

	if (${itemsCaught.Element[${Cursor.Name}](exists)})
	{
		itemsCaught.Element[${Cursor.Name}]:Inc
	}
	else
	{
		itemsCaught:Set[${Cursor.Name}, 1]
	}

	if (${maxItemsToKeep[${Cursor.Name}](exists)})
	{
		if (${itemsCaught.Element[${Cursor.Name}]} > ${maxItemsToKeep.Element[${Cursor.Name}]})
		{
			items:Erase[${Cursor.Name}]
			maxItemsToKeep:Erase[${Cursor.Name}]
		}
	}

	if (${items.Element[${Cursor.Name}]} == 0)
	{
		timesDestroyed:Inc
		echo Destroying ${Cursor.Name}
		destroy
	}
	else
	{
		timesKept:Inc
		echo Keeping ${Cursor.Name}
		EQExecute /autoinventory
	}
}

function Event_AlreadyFishing()
{
}

function Event_HoldingSomething()
{
	EQExecute /autoinventory
}

function Event_EquipPole()
{
	call checkPole
}

function Event_CaughtItem(Line, Object)
{
	wait 4
	while (${Cursor.Name.NotEqual[NULL]})
	{
		call handleCursor
	}
}

function Event_CaughtSomething()
{
	wait 4
	while (${Cursor.Name.NotEqual[NULL]})
	{
		call handleCursor
	}
}

function Event_SkillUp(Line, Trade, Lvl)
{
	abilityIncreases:Inc
	echo ${Trade} is at ${Lvl}
}

function Event_PoleBroke()
{
	call checkPole
}

function Event_NoBait()
{
	echo You need bait to fish!
	call StopMe
}

function Event_AttackIsOn()
{
	EQExecute /attack off
}

function Event_LostBait()
{
	lostBait:Inc
}

function Event_LandSharks()
{
	landSharks:Inc

	if (${landSharks} >= 3)
	{
		echo Got too many land sharks... exiting
		call StopMe
	}
}

function Event_CastLine()
{
	timesCast:Inc
}

function Event_SpillBeer()
{
	spilledBeer:Inc
}

function Event_CaughtNothing()
{
	timesNoCatch:Inc
}

fishing.xml (This goes in the directory Scripts/fishing)

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<InnerSpaceSettings>
	<!-- Items are destroyed by default so you only need to add
		 items you want to keep -->


	<!-- These settings affect all zones. They are loaded
		 first and then zone data will overwrite them -->
	<Set name="Global">
		<Setting name="Fresh Fish">1:4</Setting>
		<Setting name="Fish Scales">1:2</Setting>
	</Set>

	<Set name="Zones">
		<!-- Settings for this section override the Global settings by zone -->
		<Set name="The Plane of Knowledge">
			<!--<Setting name="Fresh Fish">0</Setting>-->
		</Set>
	</Set>

	<Set name="Fishing Poles">
		<!-- Settings in this section indicate the possible fishing
			 poles one might have around. The order of these determines
			 which will be used first if found -->
		<Setting name="Collapsible Fishing Pole"></Setting>
		<Setting name="Blessed Fishing Rod"></Setting>
		<Setting name="Brell's Fishing Pole"></Setting>
		<Setting name="Ancient Fishing Pole"></Setting>
		<Setting name="Uliorn's Fishing Pole"></Setting>
		<Setting name="Agilthin's Fishing Pole"></Setting>
		<Setting name="Hintol's Fishing Pole"></Setting>
		<Setting name="Fishing Pole"></Setting>
	</Set>
</InnerSpaceSettings>

Packs.inc is in the next post.

Fishing cont

Posted: Thu Jun 29, 2006 2:11 pm
by kellewic
Packs.inc

Code: Select all

function:bool ClearCursor()
{
	variable byte x = 5

	; Remove items off cursor. Accounts for 5 items
	while (${Cursor.ID} != 0 && ${x} > 0)
	{
		EQExecute /autoinventory
		x:Dec
	}

	if (!${Cursor.ID})
	{
		return TRUE
	}

	return FALSE
}


objectdef ItemSlot
{
	variable int slot
	variable int minSlot
	variable int maxSlot

	method Initialize(int min, int max, int slot)
	{
		if (${min} != 0 && ${max} == 0)
		{
			This.minSlot:Set[${min}]
			This.maxSlot:Set[${min}]
			This.slot:Set[${min}]
		}
		else
		{
			This.minSlot:Set[${min}]
			This.maxSlot:Set[${max}]
			This.slot:Set[${slot}]
		}
	}

	method PickUp(int qty)
	{
		variable string mod

		call ClearCursor

		if (${Return})
		{
			if (${qty} == 0)
			{
				if (${This.isStackable})
				{
					mod:Set[shift]
				}
				else
				{
					mod:Set[ctrl]
				}
			}
			elseif (${qty} == 1)
			{
				mod:Set[ctrl]
			}

			if (${mod.Length} > 0)
			{
				Execute "${mod} EQitemnotify ${This.GetIndex} leftmouseup"
			}
			else
			{
				nomodkey EQitemnotify ${This.GetIndex} leftmouseup

				if (${This.isStackable})
				{
					Keyboard:Press[backspace]
					Keyboard:Press[backspace]
					Keyboard:Press[backspace]
					Keyboard:Type[${qty}]
					Keyboard:Press[enter]
				}
			}

		}
	}

	method PutDown(int destSlot)
	{
		if (${Cursor.ID})
		{
			; Are we trying to place an item in a worn slot and can it be put there
			if (${This.isWornSlot} && ${Cursor.WornSlot[${This}]})
			{
				nomodkey EQitemnotify ${This} leftmouseup

				if (!${destSlot})
				{
					EQExecute /autoinventory
				}
				else
				{
					nomodkey EQitemnotify ${destSlot} leftmouseup

					if (${Cursor.ID})
					{
						EQExecute /autoinventory
					}
				}
			}
			else
			{
				if (${Cursor.Size} <= ${This.Pack.Item.SizeCapacity})
				{
					nomodkey EQitemnotify ${This} leftmouseup
				}
			}
		}
	}

	member ToText()
	{
		if (${This.IsSlotValid})
		{
			return ${This.Name}
		}

		return NONE
	}

	member:bool IsSlotValid()
	{
		if (${This.slot} >= ${This.minSlot} && ${This.slot} <= ${This.maxSlot})
		{
			return TRUE
		}

		return FALSE
	}

	member GetIndex=${slot}
	member ID=${slot}
	member Item=${InvSlot[${slot}].Item}
	member Pack=${InvSlot[${slot}].Pack}

	member:int Slot()
	{
		variable int itemSlot = ${InvSlot[${This.GetIndex}].Slot}

		if (${itemSlot} == 0)
		{
			itemSlot:Set[${This.GetIndex}]
		}

		return ${itemSlot}
	}

	member:string Name()
	{
		variable string name = ${InvSlot[${This.GetIndex}].Name}

		if (${name.Equal[NULL]})
		{
			name:Set[${This.GetIndex}]
		}

		return ${name}
	}

	/* These members deal with whatever item is in the slot */
	member BuyPrice=${InvSlot[${slot}].Item.BuyPrice}
	member CastTime=${InvSlot[${slot}].Item.CastTime}
	member Charges=${InvSlot[${slot}].Item.Charges}

	member:string Class(byte n)
	{
		return ${InvSlot[${slot}].Item.Class[${n}]}
	}

	member Classes=${InvSlot[${slot}].Item.Classes}

	member:string Deity(byte n)
	{
		return ${InvSlot[${slot}].Item.Deity[${n}]}
	}

	member Deities=${InvSlot[${slot}].Item.Deities}
	member DMGBonus=${InvSlot[${slot}].Item.DMGBonus}
	member EffectType=${InvSlot[${slot}].Item.EffectType}
	member FreeStack=${InvSlot[${slot}].Item.FreeStack}

	member:bool isInPack()
	{
		variable int packNumber = ${This.Pack}

		if (${packNumber} == 0)
		{
			return FALSE;
		}

		return TRUE;
	}

	member isLore=${InvSlot[${slot}].Item.Lore}
	member isMagic=${InvSlot[${slot}].Item.Magic}
	member isNoDrop=${InvSlot[${slot}].Item.NoDrop}
	member isNoRent=${InvSlot[${slot}].Item.NoRent}
	member isStackable=${InvSlot[${slot}].Item.Stackable}

	member:bool isWornSlot()
	{
		if (${This.GetIndex} >= 0 && ${This.GetIndex} <= 21)
		{
			return TRUE;
		}

		return FALSE
	}

	member ItemID=${InvSlot[${slot}].Item.ID}
	member ItemName=${InvSlot[${slot}].Item.Name}
	member ItemDelay=${InvSlot[${slot}].Item.ItemDelay}
	member LDONTheme=${InvSlot[${slot}].Item.LDONTheme}

	member:string Race(byte n)
	{
		return ${InvSlot[${slot}].Item.Race[${n}]}
	}

	member Races=${InvSlot[${slot}].Item.Races}
	member RequiredLevel=${InvSlot[${slot}].Item.RequiredLevel}
	member SellPrice=${InvSlot[${slot}].Item.SellPrice}
	member Size=${InvSlot[${slot}].Item.Size}
	member Spell=${InvSlot[${slot}].Item.Spell}
	member StackCount=${InvSlot[${slot}].Item.Stack}
	member StackSize=${InvSlot[${slot}].Item.StackSize}
	member Timer=${InvSlot[${slot}].Item.Timer}
	member Tribute=${InvSlot[${slot}].Item.Tribute}
	member Type=${InvSlot[${slot}].Item.Type}
	member Value=${InvSlot[${slot}].Item.Value}
	member Weight=${InvSlot[${slot}].Item.Weight}
}


objectdef PackItem inherits ItemSlot
{
	variable index:ItemSlot items

	method Initialize(int slot)
	{
		variable int actualSlot = ${slot}
		variable byte x

		if (${slot} >= 1 && ${slot} <= 8)
		{
			actualSlot:Set[${Math.Calc[${slot} + 21].Int}]
		}

		This[parent]:Initialize[22, 29, ${actualSlot}]

		; Load up all the possible slots for this pack
		while (${x} < 10)
		{
			noop ${items.Insert[${Math.Calc[${Math.Calc[(${actualSlot} * 10) + 31].Int} + ${x}].Int}]}
			x:Inc
		}
	}

	method Open()
	{
		if (${This.IsSlotValid} && !${This.isOpen})
		{
			nomodkey EQitemnotify ${This.slot} rightmouseup
		}
	}

	method Close()
	{
		if (${This.IsSlotValid} && ${This.isOpen})
		{
			nomodkey EQitemnotify ${This.slot} rightmouseup
		}
	}

	method Toggle()
	{
		if (${This.IsSlotValid})
		{
			nomodkey EQitemnotify ${This.slot} rightmouseup
		}
	}

	member:bool isOpen()
	{
		return ${Window[${This}].Open}
	}

	member:string GetIndex(int ID)
	{
		if (${This.IsSlotValid} && ${ID} >= 1 && ${ID} <= ${InvSlot[${This.slot}].Item.Container})
		{
			return ${InvSlot[${This.ToText}].Item.Item[${ID}]}
		}

		return NULL
	}

	member:bool IsSlotValid()
	{
		if (${This[parent].IsSlotValid} && ${InvSlot[${This.slot}].Item.Container} > 0)
		{
			return TRUE
		}

		return FALSE
	}

	member SizeCapacity=${InvSlot[${slot}].Item.SizeCapacity}
	member Slots=${InvSlot[${slot}].Item.Container}
	member Items=${InvSlot[${slot}].Item.Items}
}


objectdef WornItem inherits ItemSlot
{
	method Initialize(int slot)
	{
		This[parent]:Initialize[0, 21, ${slot}]
	}

	member:bool WornSlot(string name)
	{
		return ${This.Item.WornSlot[${name}]}
	}

	member Slots=${InvSlot[${slot}].Item.WornSlots}
}


objectdef Inventory
{
	variable WornItem Charm			= 0
	variable WornItem LeftEar		= 1
	variable WornItem Head			= 2
	variable WornItem Face			= 3
	variable WornItem RightEar		= 4
	variable WornItem Neck			= 5
	variable WornItem Shooulder		= 6
	variable WornItem Arms			= 7
	variable WornItem Back			= 8
	variable WornItem LeftWrist		= 9
	variable WornItem RightWrist	= 10
	variable WornItem Ranged		= 11
	variable WornItem Hands			= 12
	variable WornItem MainHand		= 13
	variable WornItem OffHand		= 14
	variable WornItem LeftFinger	= 15
	variable WornItem RightFinger	= 16
	variable WornItem Chest			= 17
	variable WornItem Legs			= 18
	variable WornItem Feet			= 19
	variable WornItem Waist			= 20
	variable WornItem Ammo			= 21

	variable PackItem Pack1 = 1
	variable PackItem Pack2 = 2
	variable PackItem Pack3 = 3
	variable PackItem Pack4 = 4
	variable PackItem Pack5 = 5
	variable PackItem Pack6 = 6
	variable PackItem Pack7 = 7
	variable PackItem Pack8 = 8

	method OpenPacks()
	{
		variable byte slot = 0
		variable string p

		while (${slot:Inc} <= 8)
		{
			p:Set[Pack${slot}]
			${p}:Open
		}
	}

	method ClosePacks()
	{
		variable byte slot = 0
		variable string p

		while (${slot:Inc} <= 8)
		{
			p:Set[Pack${slot}]
			${p}:Close
		}
	}

	member:int StackCount(string item)
	{
		variable ItemSlot target = ${This.FindItem[${item}]}

		if (${target} == -1)
		{
			; Item doesn't exist in inventory
			return 0
		}
		else
		{
			variable int itemCount = ${InvSlot[${target}].Item.StackCount}

			if (${itemCount} == 0)
			{
				/*
					For non-stackable items, it returns 0, but there really is 1 item
					even if the item isn't technically part of a stack
				*/
				itemCount:Set[1]
			}

			return ${itemCount}
		}
	}

	/*
		This member will accept the name of an item, or the slot of an item.
		It first tries an exact match on the item, then tries a 'fuzzy' match,
		and finally determines if a slot number was passed in, or the item really
		isn't found. The slot number for the item is returned. If we are passed a
		slot number, we simply return it back even if it's invalid (i.e. 60000)
	*/
	member:int FindItem(string item)
	{
		; Try exact match
		variable int itemSlot = ${FindItem[=${item}].InvSlot}

		if (${itemSlot} == 0)
		{
			; Try 'fuzzy' match
			itemSlot:Set[${FindItem[${item}].InvSlot}]

			if (${itemSlot} == 0)
			{
				; Was '0' (i.e. charm slot) passed in?
				if (${item.Equal[0]})
				{
					; Charm slot was passed in
					itemSlot:Set[0]
				}
				else
				{
					/*
						Determine if some other slot was passed in i.e. 262 - Second pack, 2nd slot
						We just assign item to an int and get a sort of atoi function
					*/
					variable int temp = ${item}

					if (${temp} == 0)
					{
						; Item really doesn't exist
						itemSlot:Set[-1]
					}
					else
					{
						; We were passed some slot number
						itemSlot:Set[${temp}]
					}
				}
			}
		}

		return ${itemSlot}
	}

	/*
		Return the first pack that has the item in it
	*/
	member:byte WhichPack(string item)
	{
		return ${InvSlot[${This.FindItem[${item}]}].Pack}
	}

	/*
		Swap an item from one inventory slot to another
	*/
	function Swap(string itemA, string itemB)
	{
		variable ItemSlot itemASlot = ${This.FindItem[${itemA}]}
		variable ItemSlot itemBSlot = ${This.FindItem[${itemB}]}
		variable PackItem itemAPack = ${itemASlot.Pack}
		variable PackItem itemBPack = ${itemBSlot.Pack}
		variable bool closePackA = FALSE
		variable bool closePackB = FALSE

		call ClearCursor

		if (${Return})
		{
			; Determine if we need to open up some packs to do the exchange
			if (${itemASlot.isInPack})
			{
				if (!${itemAPack.isOpen})
				{
					itemAPack:Open
					closePackA:Set[TRUE]
				}
			}

			if (${itemBSlot.isInPack})
			{
				if (!${itemBPack.isOpen})
				{
					itemBPack:Open
					closePackB:Set[TRUE]
				}
			}

			wait 1

			itemASlot:PickUp
			wait 1

			itemBSlot:PutDown[${itemASlot.ID}]
			wait 1

			if (${Cursor.ID})
			{
				;; NOT TESTED
				; We couldn't swap item for some reason, put it back
				itemASlot:PutDown
				wait 1
			}

			; Close packs if they were not already open
			if (${closePackA})
			{
				itemAPack:Close
			}

			if (${closePackB})
			{
				itemBPack:Close
			}
		}
	}
}

Posted: Thu Aug 03, 2006 11:08 pm
by Kroak
Would be nice if this was set to auto-keep and add to the XML if something wasn't in it. Auto-destroy only if you already have the amount in XML. Have to be really careful as is I picked up some Summoned: Beer and it was destroyed before I could even start to get my necro drunk. :)

Gotta get em drunk if yer fishin. :p
Maybe auto-drink on catching something if you have Brell's Fishin' Pole would be good to see added also.

P.S. - I'm kinda at a loss as to why the XML needs more than one arugment. Could set values to -1 for keep all, 0 to destroy, and 1+ for whatever # you want to keep.. destroy if ${FindItemCount[${ItemName}]} says you have that many.
Just a suggestion...

Re: Fishing

Posted: Thu Jul 17, 2025 6:31 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 6:32 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 6:33 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 6:34 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 6:35 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 7:12 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 7:13 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 7:14 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 7:16 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 7:17 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 7:18 pm
by xyilla

Re: Fishing

Posted: Thu Jul 17, 2025 7:19 pm
by xyilla