- Joined
- Dec 15, 2009
- Messages
- 525
- Reaction score
- 31
- Points
- 28
Here is a basic portal setter macro I wrote.
To use: In GGH when you near the teleportation assistant, then make a hotkey /mac portal Lceanium or /mac portal Deluge etc...will port you and your bots there then!
Enjoy~~!
To use: In GGH when you near the teleportation assistant, then make a hotkey /mac portal Lceanium or /mac portal Deluge etc...will port you and your bots there then!
Enjoy~~!
Code:
|---Written by KingArthur---|
Sub Main
/declare CurrentSub string outer
/declare ZoneName string outer ${Param0}
/declare StoneName string outer
/declare TPGem string outer
/call DefineStonName
/tar id ${Spawn[npc Teleportation assistant].ID}
/if (${Target.Distance}>20 && ${Target.Distance}<=100 && ${Target.LineOfSight}) {
/moveto id ${Target.ID}
/delay 50 ${MoveTo.Stopped}
}
/delay 1s ${Target.ID}==${Spawn[npc Teleportation assistant].ID}&&${Target.Distance}<20
/if (${FindItemCount[=${StoneName}]}) {
/echo We already had a TP stone in the bag!
/goto :alreadyhadstone
}
/if (${Target.ID}==${Spawn[npc Teleportation assistant].ID}&&${Target.Distance}<20) /click right target
/delay 6s ${Window[MerchantWnd].Open}
/echo Waiting merchant list to pop!
/delay 3s
/call buy "${StoneName}" 1
/delay 5s ${FindItemCount[=${StoneName}]}
/if (${Window[MerchantWnd].Open}) /windowstate MerchantWnd close
/delay 2s !${Window[MerchantWnd].Open}
:alreadyhadstone
/call GiveStone "${StoneName}" ${Spawn[npc Teleportation assistant].ID}
/delay 5s !${FindItemCount[=${StoneName}]}
/echo Now move to TP pad!
/bcga //tar id ${Spawn[npc Teleportation device].ID}
/delay 1s ${Target.ID}==${Spawn[npc Teleportation device].ID}
/if (${Target.ID}==${Spawn[npc Teleportation device].ID}&&${Target.Distance}>20 && ${Target.Distance}<=100 && ${Target.LineOfSight}) {
/bcga //moveto id ${Target.ID}
/delay 100 ${MoveTo.Stopped}
}
/if (${Target.Distance}<20&&${Target.ID}==${Spawn[npc Teleportation device].ID}) /echo We are at the Teleport Pad!
/delay 10s ${Window[largedialogwindow].Open}&&${Window[largedialogwindow].Child[LDW_TextBox].Text.Find[${ZoneName}]}
/if (${Window[largedialogwindow].Open}&&${Window[largedialogwindow].Child[LDW_TextBox].Text.Find[${ZoneName}]}) {
/bcg //notify largedialogwindow LDW_YesButton leftmouseup
/delay 2s
:clicktp
/if (${Group.Member[1].ID}) /bct ${Group.Member[1].Name} //notify largedialogwindow LDW_YesButton leftmouseup
/if (${Group.Member[2].ID}) /bct ${Group.Member[2].Name} //notify largedialogwindow LDW_YesButton leftmouseup
/if (${Group.Member[3].ID}) /bct ${Group.Member[3].Name} //notify largedialogwindow LDW_YesButton leftmouseup
/if (${Group.Member[4].ID}) /bct ${Group.Member[4].Name} //notify largedialogwindow LDW_YesButton leftmouseup
/if (${Group.Member[5].ID}) /bct ${Group.Member[5].Name} //notify largedialogwindow LDW_YesButton leftmouseup
/delay 2s
/if (${Group.Member[1].ID} || ${Group.Member[2].ID} || ${Group.Member[3].ID} || ${Group.Member[4].ID} || ${Group.Member[5].ID}) /goto :clicktp
/delay 1s
/echo Everyone zoned to ${ZoneName}, now for me to zone.
:MeClickTP
/notify largedialogwindow LDW_YesButton leftmouseup
/delay 90s ${Zone.ShortName.Equal[${ZoneName}]}
/if (!${Zone.ShortName.Equal[${ZoneName}]}) /goto :MeClickTP
}
/if (${Zone.ShortName.Equal[${ZoneName}]}) /echo We are at ${ZoneName} now!!
/end
Sub Buy(Item ItemToBuy, int amount)
|/echo Buying ${ItemToBuy}!
/declare QTY int Inner
/declare l2 int local
/declare LastItemCount int local
/declare CurrentItemCount int local
/varset LastItemCount ${Window[MerchantWnd].Child[ItemList].Items}
|---SMALL delay to allow the MERCHANT Window to populate
/delay ${Math.Calc[${DelayMult}*2]}s
/varset QTY ${Math.Calc[${amount}-${FindItemCount[=${ItemToBuy}]}]}
:Filling
/delay 1s
/varset CurrentItemCount ${Window[MerchantWnd].Child[ItemList].Items}
/if (${CurrentItemCount}!=${LastItemCount}) {
/varset LastItemCount ${Window[MerchantWnd].Child[ItemList].Items}
/goto :Filling
}
/if (${FindItemCount[=${ItemToBuy}]}>= ${amount}) {
/return
}
/varset l2 ${Window[MerchantWnd].Child[ItemList].List[=${ItemToBuy},2]}
/if (!${l2}) {
/echo Couldn't find ${ItemToBuy}
/end
} else {
/nomodkey /notify MerchantWnd ItemList listselect ${l2}
/delay 2
}
/echo Buying ${ItemToBuy} until I get ${amount}
:Loop
/if (${QTY}>19) {
|/buyitem 20
/call MyBuyItem 20 ${l2} "${ItemToBuy}"
/delay 1s
/doevents
/varset QTY ${Math.Calc[${amount}-${FindItemCount[=${ItemToBuy}]}]}
/delay 1s
/goto :Loop
} else {
/if (${QTY}>0 && ${QTY}<20) {
|/buyitem ${QTY}
/call MyBuyItem ${QTY} ${l2} "${ItemToBuy}"
/delay 1s
}
}
/varset QTY ${Math.Calc[${amount}-${FindItemCount[=${ItemToBuy}]}]}
/if (${QTY}<=0) {
/return
}
/goto :Loop
/return
Sub GiveStone(string GItem, int GTarget)
/varset CurrentSub GiveStone
/echo Gitem is ${GItem}
/varset TPGem ${GItem}
/declare ItemStone int local 0
/if (${Target.ID}!=${GTarget}) {
/target id ${GTarget}
/delay 2s ${Target.ID}==${GTarget}
/if (${Cursor.ID}) /autoinventory
/delay 7 !${Cursor.ID}
}
/if (${Target.Distance}>20 && ${Target.Distance}<=100 && ${Target.LineOfSight}) {
/moveto id ${Target.ID}
/delay 50 ${MoveTo.Stopped}
}
/if (${FindItemCount[=${TPGem}]}>0) {
/shift /itemnotify "${TPGem}" leftmouseup
/delay 20 ${Cursor.ID}
}
:CursorFree
/if (${Cursor.ID}==${FindItem[=${TPGem}].ID}) {
/varset ItemStone 1
/nomodkey /click left target
/delay 20 !${Cursor.ID}
}
|/if (${Cursor.ID}==${FindItem[=${TPGem}].ID}) /goto :CursorFree
/delay 10
/if (${ItemStone}) {
/notify GiveWnd GVW_Give_Button leftmouseup
/echo Giving ${GItem} to ${Target.CleanName}
} else {
/echo Item is NOT the TP Stone canceling trade
/notify GiveWnd GVW_Cancel_Button leftmouseup
}
/delay 200 !${Window[GiveWnd].Open}
/return
Sub DefineStonName
/cecho \ag ZoneName List
/cecho \ay Lceanium
/cecho \ay Deluge
/cecho \ay Ethernere
/cecho \ay Shard
/cecho \ay Agarth
/cecho \ay Feerrott
/cecho \ay Time
/cecho \ay Brell
/cecho \ay Dragonscale
/cecho \ay Guild
/if (${Select[${ZoneName},Lceanium]}) /varset StoneName Fragment of the Combine Spire
/if (${Select[${ZoneName},Deluge]}) /varset StoneName Drowned Katta Castrum Powerstone
/if (${Select[${ZoneName},Ethernere]}) /varset StoneName Stormstone of the West
/if (${Select[${ZoneName},Shard]}) /varset StoneName Stone of the Shard's Fall
/if (${Select[${ZoneName},Argath]}) /varset StoneName Chunk of Argathian Steel
/if (${Select[${ZoneName},Feerrott]}) /varset StoneName Crystallize Dream of the Feerrott
/if (${Select[${ZoneName},Time]}) /varset StoneName Broken Time Stone
/if (${Select[${ZoneName},Brell]}) /varset StoneName Unrefine Brellium Ore
/if (${Select[${ZoneName},Dragonscale]}) /varset StoneName Dragonscale Faycite
/if (${Select[${ZoneName},Guild]}) /varset StoneName Splinter from a guild standard
/return
Sub MyBuyItem(int MyAmount, int MyIndex, string MyItemToBuy)
/declare char string local
/declare InStr string local
/declare loopctr int local
/declare BuyStr string local
/declare QtyStr string local
/declare x int local
/declare IndCost int local
/varset BuyStr ${MyItemToBuy}
|/echo Buying ${MyAmount} ${BuyStr}
/if (!${Window[MerchantWnd].Open}) {
/echo Merchant window is not open!
/return
}
/nomodkey /notify MerchantWnd MW_Buy_Button leftmouseup
/varset QtyStr ${Window[MerchantWnd].Child[ItemList].List[${MyIndex},3]}
/varset IndCost ${Window[MerchantWnd].Child[ItemList].List[${MyIndex},4]}
/if (${IndCost} > ${Me.Platinum}) {
/echo You are out of money!
/beep
/end
}
/if (!${BuyStr.Find[bow staff]}) {
/delay 5 ${Window[QuantityWnd].Open}
}
/if (${Window[QuantityWnd].Open}) {
/nomodkey /notify QuantityWnd QTYW_SliderInput leftmouseup
/nomodkey /keypress right chat
/nomodkey /keypress right chat
/nomodkey /keypress right chat
/nomodkey /keypress backspace chat
/nomodkey /keypress backspace chat
/nomodkey /keypress backspace chat
/delay 5
/varset InStr ${MyAmount}
/for loopctr 1 to ${InStr.Length}
/varset char ${InStr.Mid[${loopctr},1]}
/if (!${char.Length}) {
/nomodkey /keypress Space chat
} else {
/nomodkey /keypress ${char} chat
}
/next loopctr
/delay 5s ${Window[QuantityWnd].Child[QTYW_Accept_Button].Enabled}
/nomodkey /notify QuantityWnd QTYW_Accept_Button leftmouseup
/delay 5s !${Window[QuantityWnd].Open}
/if (${Window[QuantityWnd].Open}) {
/echo Merchant window / quantity window close timeout!
/return
}
}
/return