Results 1 to 3 of 3

Thread: Some Guild Wars Scripts for Cons and Summons

  1. #1
    Retired savsuds's Avatar
    Join Date
    Apr 2013
    Location
    'Murica
    Posts
    1,246

    Some Guild Wars Scripts for Cons and Summons

    I owe Ralle1976 a big Thanks for helping me how to add things to bots. gigi a huge shout out for posting examples around here that Ralle1976 shared with me. I had to figure out a few little things, but most of what I did was collect, ID and data entry. Tormiasz is the man for his Botdeveloper tool. Of course none of this could have happened without the hard work from Miracle444 and TAP for GWA2.
    /end Oscar speech

    Everything in here is mainly for single use. I don't know anything about timers, effect reading or anything like that. You want your bot to go to a zone and use something here. He will do it. You want the bot to reapply when the effect wears off, so sorry.

    * If it is in a bag, it will scan and use it. If you don't want to use something don't put it in a bag.

    **Bots crash when you have more than one type of summon stones in the inventory and multiple set to True. I confirmed it. But, I did not DC, lucky me.

    Code:
    ;==================================================================================================
    Global $pconsArmor_slot[2]
    Global $pconsEssence_slot[2]
    Global $pconsGrail_slot[2]
    Global $pconsApple_slot[2]
    Global $pconsCupcake_slot[2]
    Global $pconsSalad_slot[2]
    Global $pconsCorn_slot[2]
    Global $pconsEgg_slot[2]
    Global $pconsRedRock_slot[2]
    Global $pconsBlueRock_slot[2]
    Global $pconsGreenRock_slot[2]
    Global $pconsPie_slot[2]
    Global $pconsSupplies_slot[2]
    Global $pconsSoup_slot[2]
    Global $pconsKabob_slot[2]
    Global $AmberSummon_slot[2]
    Global $ArticSummon_slot[2]
    Global $AutomatonSummon_slot[2]
    Global $CelestialSummon_slot[2]
    Global $ChitinousSummon_slot[2]
    Global $DemonicSummon_slot[2]
    Global $FossilizedSummon_slot[2]
    Global $FrostySummon_slot[2]
    Global $GelatinousSummon_slot[2]
    Global $GhastlySummon_slot[2]
    Global $ImperialGuardSummon_slot[2]
    Global $JadeiteSummon_slot[2]
    Global $MerchantSummon_slot[2]
    Global $MischievousSummon_slot[2]
    Global $MysteriousSummon_slot[2]
    Global $MysticalSummon_slot[2]
    Global $ShiningBladeSummon_slot[2]
    Global $TenguSummon_slot[2]
    Global $ZaishenSummon_slot[2]
    ;==================================================================================================
    Global $useArmor = False ; set it on true and he use it
    Global $useEssence = False ; set it on true and he use it
    Global $useGrail = False ; set it on true and he use it
    Global $useApple = False ; set it on true and he use it
    Global $useCupcake = False ; set it on true and he use it
    Global $useSalad = False ; set it on true and he use it
    Global $useCorn = False ; set it on true and he use it
    Global $useEgg = False ; set it on true and he use it
    Global $useRedRock = False ; set it on true and he use it
    Global $useBlueRock = False ; set it on true and he use it
    Global $useGreenRock = False ; set it on true and he use it
    Global $usePie = False ; set it on true and he use it
    Global $useSupplies = False ; set it on true and he use it
    Global $useSoup = False ; set it on true and he use it
    Global $useKabob = False ; set it on true and he use it
    Global $useAmberSummon = False ; set to true and he use it *only one summon used at a time
    Global $useArticSummon = False ; set to true and he use it *only one summon used at a time
    Global $useAutomatonSummon = False ; set to true and he use it *only one summon used at a time
    Global $useCelestialSummon = False ; set to true and he use it *only one summon used at a time
    Global $useChitinousSummon = False ; set to true and he use it *only one summon used at a time
    Global $useDemonicSummon = False ; set to true and he use it *only one summon used at a time
    Global $useFossilizedSummon = False ; set to true and he use it *only one summon used at a time
    Global $useFrostySummon = False ; set to true and he use it *only one summon used at a time
    Global $useGelatinousSummon = False ; set to true and he use it *only one summon used at a time
    Global $useGhastlySummon = False ; set to true and he use it *only one summon used at a time
    Global $useImperialGuardSummon = False ; set to true and he use it *only one summon used at a time
    Global $useJadeiteSummon = False ; set to true and he use it *only one summon used at a time
    Global $useMerchantSummon = False ; set to true and he use it *only one summon used at a time
    Global $useMischievousSummon = False ; set to true and he use it *only one summon used at a time
    Global $useMysteriousSummon = False ; set to true and he use it *only one summon used at a time
    Global $useMysticalSummon = False ; set to true and he use it *only one summon used at a time
    Global $useShiningBladeSummon = False ; set to true and he use it *only one summon used at a time
    Global $useTenguSummon = False ; set to true and he use it *only one summon used at a time
    Global $useZaishenSummon = False ; set to true and he use it *only one summon used at a time
    ;==================================================================================================
    Global Const $ITEM_ID_Armor = 24860 ; Armor of Salvation
    Global Const $ITEM_ID_Essence = 24859 ; BUs
    Global Const $ITEM_ID_Grail = 24861 ; Grail of Might
    Global Const $ITEM_ID_Apple = 28431 ; Candy Apple
    Global Const $ITEM_ID_Cupcake = 22269 ; Birthday Cupcake
    Global Const $ITEM_ID_Salad = 17062 ; Pahnai Salad
    Global Const $ITEM_ID_Corn = 28432 ; Candy Corn
    Global Const $ITEM_ID_Egg = 22752 ; Golden Egg
    Global Const $ITEM_ID_RedRock = 31153 ; Red Rock Candy
    Global Const $ITEM_ID_BlueRock = 31151 ; Blue Rock Candy
    Global Const $ITEM_ID_GreenRock = 31152 ; Green Rock Candy
    Global Const $ITEM_ID_Pie = 28436 ; Pumpkin Pie
    Global Const $ITEM_ID_Supplies = 35121 ; War Supplies
    Global Const $ITEM_ID_Soup = 17061 ; Skalefin Soup
    Global Const $ITEM_ID_Kabob = 17060 ; Drake Kabob
    Global Const $Item_ID_AmberSummon = 30961 ; Amber summoning stones
    Global Const $Item_ID_ArticSummon = 30962 ; Artic summoning stones
    Global Const $Item_ID_AutomatonSummon = 30846 ; Automaton summoning stones
    Global Const $Item_ID_CelestialSummon = 34176 ; Celestial summoning stones
    Global Const $Item_ID_ChitinousSummon = 30959 ; Chitinous summoning stones
    Global Const $Item_ID_DemonicSummon = 30963 ; Demonic summoning stones
    Global Const $Item_ID_FossilizedSummon = 30965 ; Fossilized summoning stones
    Global Const $Item_ID_FrostySummon = 31023 ; Frosty summoning stones
    Global Const $Item_ID_GelatinousSummon = 30964 ; Gelatinous summoning stones
    Global Const $Item_ID_GhastlySummon = 32557 ; Ghastly summoning stones
    Global Const $Item_ID_ImperialGuardSummon = 30210 ; Imperial Guard summoning stones
    Global Const $Item_ID_JadeiteSummon = 30966 ; Jadeite summoning stones
    Global Const $Item_ID_MerchantSummon = 31154 ; Merchant summoning stones
    Global Const $Item_ID_MischievousSummon = 31022 ; Mischievous summoning stones
    Global Const $Item_ID_MysteriousSummon = 31155 ; Mysterious summoning stones
    Global Const $Item_ID_MysticalSummon = 30960 ; Mystical summoning stones
    Global Const $Item_ID_ShiningBladeSummon = 35126 ; Shining Blade summoning stones
    Global Const $Item_ID_TenguSummon = 30209 ; Tengu summoning stones
    Global Const $Item_ID_ZaishenSummon = 31156 ; Zaishen summoning stones
    ;==================================================================================================
    ;==================================================================================================
    ; Group Cons Func Section
    ;==================================================================================================
    Func UseArmor()
    	If $useArmor Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsArmor_slot[0] > 0 And $pconsArmor_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsEssence_slot[0], $pconsEssence_slot[1]), "ModelID") == $ITEM_ID_Armor Then
    					UseItemBySlot($pconsArmor_slot[0], $pconsArmor_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseEssence()
    	If $useEssence Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsEssence_slot[0] > 0 And $pconsEssence_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsEssence_slot[0], $pconsEssence_slot[1]), "ModelID") == $ITEM_ID_Essence Then
    					UseItemBySlot($pconsEssence_slot[0], $pconsEssence_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseGrail()
    	If $useGrail Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsGrail_slot[0] > 0 And $pconsGrail_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsGrail_slot[0], $pconsGrail_slot[1]), "ModelID") == $ITEM_ID_Grail Then
    					UseItemBySlot($pconsGrail_slot[0], $pconsGrail_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    ;==================================================================================================
    ; Personal Cons Func Section
    ;==================================================================================================
    Func UseApple()
    	If $useApple Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsApple_slot[0] > 0 And $pconsApple_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsApple_slot[0], $pconsApple_slot[1]), "ModelID") == $ITEM_ID_Apple Then
    					UseItemBySlot($pconsApple_slot[0], $pconsApple_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseCupcake()
    	If $useCupcake Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsCupcake_slot[0] > 0 And $pconsCupcake_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsCupcake_slot[0], $pconsCupcake_slot[1]), "ModelID") == $ITEM_ID_Cupcake Then
    					UseItemBySlot($pconsCupcake_slot[0], $pconsCupcake_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseSalad()
    	If $useSalad Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsSalad_slot[0] > 0 And $pconsSalad_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsSalad_slot[0], $pconsSalad_slot[1]), "ModelID") == $ITEM_ID_Salad Then
    					UseItemBySlot($pconsSalad_slot[0], $pconsSalad_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseCorn()
    	If $useCorn Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsCorn_slot[0] > 0 And $pconsCorn_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsCorn_slot[0], $pconsCorn_slot[1]), "ModelID") == $ITEM_ID_Corn Then
    					UseItemBySlot($pconsCorn_slot[0], $pconsCorn_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseEgg()
    	If $useEgg Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsEgg_slot[0] > 0 And $pconsEgg_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsEgg_slot[0], $pconsEgg_slot[1]), "ModelID") == $ITEM_ID_Egg Then
    					UseItemBySlot($pconsEgg_slot[0], $pconsEgg_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseRedRock()
    	If $useRedRock Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsRedRock_slot[0] > 0 And $pconsRedRock_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsRedRock_slot[0], $pconsRedRock_slot[1]), "ModelID") == $ITEM_ID_RedRock Then
    					UseItemBySlot($pconsRedRock_slot[0], $pconsRedRock_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseBlueRock()
    	If $useBlueRock Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsBlueRock_slot[0] > 0 And $pconsBlueRock_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsBlueRock_slot[0], $pconsBlueRock_slot[1]), "ModelID") == $ITEM_ID_BlueRock Then
    					UseItemBySlot($pconsBlueRock_slot[0], $pconsBlueRock_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseGreenRock()
    	If $useGreenRock Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsGreenRock_slot[0] > 0 And $pconsGreenRock_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsGreenRock_slot[0], $pconsGreenRock_slot[1]), "ModelID") == $ITEM_ID_GreenRock Then
    					UseItemBySlot($pconsGreenRock_slot[0], $pconsGreenRock_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UsePie()
    	If $usePie Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsPie_slot[0] > 0 And $pconsPie_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsPie_slot[0], $pconsPie_slot[1]), "ModelID") == $ITEM_ID_Pie Then
    					UseItemBySlot($pconsPie_slot[0], $pconsPie_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseSupplies()
    	If $useSupplies Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsSupplies_slot[0] > 0 And $pconsSupplies_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsSupplies_slot[0], $pconsSupplies_slot[1]), "ModelID") == $ITEM_ID_Supplies Then
    					UseItemBySlot($pconsSupplies_slot[0], $pconsSupplies_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseSoup()
    	If $useSoup Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsSoup_slot[0] > 0 And $pconsSoup_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsSoup_slot[0], $pconsSoup_slot[1]), "ModelID") == $ITEM_ID_Soup Then
    					UseItemBySlot($pconsSoup_slot[0], $pconsSoup_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseKabob()
    	If $useKabob Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $pconsKabob_slot[0] > 0 And $pconsKabob_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($pconsKabob_slot[0], $pconsKabob_slot[1]), "ModelID") == $ITEM_ID_Kabob Then
    					UseItemBySlot($pconsKabob_slot[0], $pconsKabob_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    ;==================================================================================================
    ; Summon Stone Func Section
    ;==================================================================================================
    Func UseAmberSummon()
    	If $useAmberSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $AmberSummon_slot[0] > 0 And $AmberSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($AmberSummon_slot[0], $AmberSummon_slot[1]), "ModelID") == $Item_ID_AmberSummon Then
    					UseItemBySlot($AmberSummon_slot[0], $AmberSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseArticSummon()
    	If $useArticSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $ArticSummon_slot[0] > 0 And $ArticSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($ArticSummon_slot[0], $ArticSummon_slot[1]), "ModelID") == $Item_ID_ArticSummon Then
    					UseItemBySlot($ArticSummon_slot[0], $ArticSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseAutomatonSummon()
    	If $useAutomatonSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $AutomatonSummon_slot[0] > 0 And $AutomatonSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($AutomatonSummon_slot[0], $AutomatonSummon_slot[1]), "ModelID") == $Item_ID_AutomatonSummon Then
    					UseItemBySlot($AutomatonSummon_slot[0], $AutomatonSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseCelestialSummon()
    	If $useCelestialSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $CelestialSummon_slot[0] > 0 And $CelestialSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($CelestialSummon_slot[0], $CelestialSummon_slot[1]), "ModelID") == $Item_ID_CelestialSummon Then
    					UseItemBySlot($CelestialSummon_slot[0], $CelestialSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseChitinousSummon()
    	If $useChitinousSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $ChitinousSummon_slot[0] > 0 And $ChitinousSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($ChitinousSummon_slot[0], $ChitinousSummon_slot[1]), "ModelID") == $Item_ID_ChitinousSummon Then
    					UseItemBySlot($ChitinousSummon_slot[0], $ChitinousSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseDemonicSummon()
    	If $useDemonicSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $DemonicSummon_slot[0] > 0 And $DemonicSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($DemonicSummon_slot[0], $DemonicSummon_slot[1]), "ModelID") == $Item_ID_DemonicSummon Then
    					UseItemBySlot($DemonicSummon_slot[0], $DemonicSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseFossilizedSummon()
    	If $useFossilizedSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $FossilizedSummon_slot[0] > 0 And $FossilizedSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($FossilizedSummon_slot[0], $FossilizedSummon_slot[1]), "ModelID") == $Item_ID_FossilizedSummon Then
    					UseItemBySlot($FossilizedSummon_slot[0], $FossilizedSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseFrostySummon()
    	If $useFrostySummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $FrostySummon_slot[0] > 0 And $FrostySummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($FrostySummon_slot[0], $FrostySummon_slot[1]), "ModelID") == $Item_ID_FrostySummon Then
    					UseItemBySlot($FrostySummon_slot[0], $FrostySummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseGelatinousSummon()
    	If $useGelatinousSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $GelatinousSummon_slot[0] > 0 And $GelatinousSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($GelatinousSummon_slot[0], $GelatinousSummon_slot[1]), "ModelID") == $Item_ID_GelatinousSummon Then
    					UseItemBySlot($GelatinousSummon_slot[0], $GelatinousSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseGhastlySummon()
    	If $useGhastlySummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $GhastlySummon_slot[0] > 0 And $GhastlySummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($GhastlySummon_slot[0], $GhastlySummon_slot[1]), "ModelID") == $Item_ID_GhastlySummon Then
    					UseItemBySlot($GhastlySummon_slot[0], $GhastlySummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseImperialGuardSummon()
    	If $useImperialGuardSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $ImperialGuardSummon_slot[0] > 0 And $ImperialGuardSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($ImperialGuardSummon_slot[0], $ImperialGuardSummon_slot[1]), "ModelID") == $Item_ID_ImperialGuardSummon Then
    					UseItemBySlot($ImperialGuardSummon_slot[0], $ImperialGuardSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseJadeiteSummon()
    	If $useJadeiteSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $JadeiteSummon_slot[0] > 0 And $JadeiteSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($JadeiteSummon_slot[0], $JadeiteSummon_slot[1]), "ModelID") == $Item_ID_JadeiteSummon Then
    					UseItemBySlot($JadeiteSummon_slot[0], $JadeiteSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseMerchantSummon()
    	If $useMerchantSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $MerchantSummon_slot[0] > 0 And $MerchantSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($MerchantSummon_slot[0], $MerchantSummon_slot[1]), "ModelID") == $Item_ID_MerchantSummon Then
    					UseItemBySlot($MerchantSummon_slot[0], $MerchantSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseMischievousSummon()
    	If $useMischievousSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $MischievousSummon_slot[0] > 0 And $MischievousSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($MischievousSummon_slot[0], $MischievousSummon_slot[1]), "ModelID") == $Item_ID_MischievousSummon Then
    					UseItemBySlot($MischievousSummon_slot[0], $MischievousSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseMysteriousSummon()
    	If $useMysteriousSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $MysteriousSummon_slot[0] > 0 And $MysteriousSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($MysteriousSummon_slot[0], $MysteriousSummon_slot[1]), "ModelID") == $Item_ID_MysteriousSummon Then
    					UseItemBySlot($MysteriousSummon_slot[0], $MysteriousSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseMysticalSummon()
    	If $useMysticalSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $MysticalSummon_slot[0] > 0 And $MysticalSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($MysticalSummon_slot[0], $MysticalSummon_slot[1]), "ModelID") == $Item_ID_MysticalSummon Then
    					UseItemBySlot($MysticalSummon_slot[0], $MysticalSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseShiningBladeSummon()
    	If $useShiningBladeSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $ShiningBladeSummon_slot[0] > 0 And $ShiningBladeSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($ShiningBladeSummon_slot[0], $ShiningBladeSummon_slot[1]), "ModelID") == $Item_ID_ShiningBladeSummon Then
    					UseItemBySlot($ShiningBladeSummon_slot[0], $ShiningBladeSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseTenguSummon()
    	If $useTenguSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $TenguSummon_slot[0] > 0 And $TenguSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($TenguSummon_slot[0], $TenguSummon_slot[1]), "ModelID") == $Item_ID_TenguSummon Then
    					UseItemBySlot($TenguSummon_slot[0], $TenguSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    Func UseZaishenSummon()
    	If $useZaishenSummon Then
    		If (GetMapLoading() == 1) And (GetIsDead(-2) == False) Then
    			If $ZaishenSummon_slot[0] > 0 And $ZaishenSummon_slot[1] > 0 Then
    				If DllStructGetData(GetItemBySlot($ZaishenSummon_slot[0], $ZaishenSummon_slot[1]), "ModelID") == $ITEM_ID_ZaishenSummon Then
    					UseItemBySlot($ZaishenSummon_slot[0], $ZaishenSummon_slot[1])
    				EndIf
    			EndIf
    		EndIf
    	EndIf
    EndFunc
    ;==================================================================================================
    ; Scanning Bags for the stuff you wanna use
    ;==================================================================================================
    Func pconsScanInventory()
    	Local $bag
    	Local $size
    	Local $slot
    	Local $item
    	Local $ModelID
    	$pconsArmor_slot[0] = $pconsArmor_slot[1] = 0
    	$pconsEssence_slot[0] = $pconsEssence_slot[1] = 0
    	$pconsGrail_slot[0] = $pconsGrail_slot[1] = 0
    	$pconsApple_slot[0] = $pconsApple_slot[1] = 0
    	$pconsCupcake_slot[0] = $pconsCupcake_slot[1] = 0
    	$pconsSalad_slot[0] = $pconsSalad_slot[1] = 0
    	$pconsCorn_slot[0] = $pconsCorn_slot[1] = 0
    	$pconsEgg_slot[0] = $pconsEgg_slot[1] = 0
    	$pconsRedRock_slot[0] = $pconsRedRock_slot[1] = 0
    	$pconsBlueRock_slot[0] = $pconsBlueRock_slot[1] = 0
    	$pconsGreenRock_slot[0] = $pconsGreenRock_slot[1] = 0
    	$pconsPie_slot[0] = $pconsPie_slot[1] = 0
    	$pconsSupplies_slot[0] = $pconsSupplies_slot[1] = 0
    	$pconsSoup_slot[0] = $pconsSoup_slot[1] = 0
    	$pconsKabob_slot[0] = $pconsKabob_slot[1] = 0
    	$AmberSummon_slot[0] = $AmberSummon_slot[1] = 0
    	$ArticSummon_slot[0] = $ArticSummon_slot[1] = 0
    	$AutomatonSummon_slot[0] = $AutomatonSummon_slot[1] = 0
    	$CelestialSummon_slot[0] = $CelestialSummon_slot[1] = 0
    	$ChitinousSummon_slot[0] = $ChitinousSummon_slot[1] = 0
    	$DemonicSummon_slot[0] = $DemonicSummon_slot[1] = 0
    	$FossilizedSummon_slot[0] = $FossilizedSummon_slot[1] = 0
    	$FrostySummon_slot[0] = $FrostySummon_slot[1] = 0
    	$GelatinousSummon_slot[0] = $GelatinousSummon_slot[1] = 0
    	$GhastlySummon_slot[0] = $GhastlySummon_slot[1] = 0
    	$ImperialGuardSummon_slot[0] =	$ImperialGuardSummon_slot[1] = 0
    	$JadeiteSummon_slot[0] = $JadeiteSummon_slot[1] = 0
    	$MerchantSummon_slot[0] = $MerchantSummon_slot[1] = 0
    	$MischievousSummon_slot[0] = $MischievousSummon_slot[1] = 0
    	$MysteriousSummon_slot[0] = $MysteriousSummon_slot[1] = 0
    	$MysticalSummon_slot[0] = $MysticalSummon_slot[1] = 0
    	$ShiningBladeSummon_slot[0] = $ShiningBladeSummon_slot[1] = 0
    	$TenguSummon_slot[0] =	$TenguSummon_slot[1] = 0
    	$ZaishenSummon_slot[0] = $ZaishenSummon_slot[1] = 0
    	For $bag = 1 To 4 Step 1
    		If $bag == 1 Then $size = 20
    		If $bag == 2 Then $size = 5
    		If $bag == 3 Then $size = 10
    		If $bag == 4 Then $size = 10
    		For $slot = 1 To $size Step 1
    			$item = GetItemBySlot($bag, $slot)
    			$ModelID = DllStructGetData($item, "ModelID")
    			Switch $ModelID
    				Case 0
    					ContinueLoop
    				Case $ITEM_ID_Armor
    					$pconsArmor_slot[0] = $bag
    					$pconsArmor_slot[1] = $slot
    				Case $ITEM_ID_Essence
    					$pconsEssence_slot[0] = $bag
    					$pconsEssence_slot[1] = $slot
    				Case $ITEM_ID_Grail
    					$pconsGrail_slot[0] = $bag
    					$pconsGrail_slot[1] = $slot
    				Case $ITEM_ID_Apple
    					$pconsApple_slot[0] = $bag
    					$pconsApple_slot[1] = $slot
    				Case $ITEM_ID_Cupcake
    					$pconsCupcake_slot[0] = $bag
    					$pconsCupcake_slot[1] = $slot
    				Case $ITEM_ID_Salad
    					$pconsSalad_slot[0] = $bag
    					$pconsSalad_slot[1] = $slot
    				Case $ITEM_ID_Corn
    					$pconsCorn_slot[0] = $bag
    					$pconsCorn_slot[1] = $slot
    				Case $ITEM_ID_Egg
    					$pconsEgg_slot[0] = $bag
    					$pconsEgg_slot[1] = $slot
    				Case $ITEM_ID_RedRock
    					$pconsRedRock_slot[0] = $bag
    					$pconsRedRock_slot[1] = $slot
    				Case $ITEM_ID_BlueRock
    					$pconsBlueRock_slot[0] = $bag
    					$pconsBlueRock_slot[1] = $slot
    				Case $ITEM_ID_GreenRock
    					$pconsGreenRock_slot[0] = $bag
    					$pconsGreenRock_slot[1] = $slot
    				Case $ITEM_ID_Pie
    					$pconsPie_slot[0] = $bag
    					$pconsPie_slot[1] = $slot
    				Case $ITEM_ID_Supplies
    					$pconsSupplies_slot[0] = $bag
    					$pconsSupplies_slot[1] = $slot
    				Case $ITEM_ID_Soup
    					$pconsSoup_slot[0] = $bag
    					$pconsSoup_slot[1] = $slot
    				Case $ITEM_ID_Kabob
    					$pconsKabob_slot[0] = $bag
    					$pconsKabob_slot[1] = $slot
    				Case $Item_ID_AmberSummon
    					$AmberSummon_slot[0] = $bag
    					$AmberSummon_slot[1] = $slot
    				Case $Item_ID_ArticSummon
    					$ArticSummon_slot[0] = $bag
    					$ArticSummon_slot[1] = $slot
    				Case $Item_ID_AutomatonSummon
    					$AutomatonSummon_slot[0] = $bag
    					$AutomatonSummon_slot[1] = $slot
    				Case $Item_ID_CelestialSummon
    					$CelestialSummon_slot[0] = $bag
    					$CelestialSummon_slot[1] = $slot
    				Case $Item_ID_ChitinousSummon
    					$ChitinousSummon_slot[0] = $bag
    					$ChitinousSummon_slot[1] = $slot
    				Case $Item_ID_DemonicSummon
    					$DemonicSummon_slot[0] = $bag
    					$DemonicSummon_slot[1] = $slot
    				Case $Item_ID_FossilizedSummon
    					$FossilizedSummon_slot[0] = $bag
    					$FossilizedSummon_slot[1] = $slot
    				Case $Item_ID_FrostySummon
    					$FrostySummon_slot[0] = $bag
    					$FrostySummon_slot[1] = $slot
    				Case $Item_ID_GelatinousSummon
    					$GelatinousSummon_slot[0] = $bag
    					$GelatinousSummon_slot[1] = $slot
    				Case $Item_ID_GhastlySummon
    					$GhastlySummon_slot[0] = $bag
    					$GhastlySummon_slot[1] = $slot
    				Case $Item_ID_ImperialGuardSummon
    					$ImperialGuardSummon_slot[0] = $bag
    					$ImperialGuardSummon_slot[1] = $slot
    				Case $Item_ID_JadeiteSummon
    					$JadeiteSummon_slot[0] = $bag
    					$JadeiteSummon_slot[1] = $slot
    				Case $Item_ID_MerchantSummon
    					$MerchantSummon_slot[0] = $bag
    					$MerchantSummon_slot[1] = $slot
    				Case $Item_ID_MischievousSummon
    					$MischievousSummon_slot[0] = $bag
    					$MischievousSummon_slot[1] = $slot
    				Case $Item_ID_MysteriousSummon
    					$MysteriousSummon_slot[0] = $bag
    					$MysteriousSummon_slot[1] = $slot
    				Case $Item_ID_MysticalSummon
    					$MysticalSummon_slot[0] = $bag
    					$MysticalSummon_slot[1] = $slot
    				Case $Item_ID_ShiningBladeSummon
    					$ShiningBladeSummon_slot[0] = $bag
    					$ShiningBladeSummon_slot[1] = $slot
    				Case $Item_ID_TenguSummon
    					$TenguSummon_slot[0] = $bag
    					$TenguSummon_slot[1] = $slot
    				Case $ITEM_ID_ZaishenSummon
    					$ZaishenSummon_slot[0] = $bag
    					$ZaishenSummon_slot[1] = $slot
    				;.....
    				;Cas ........
    				; and so on .......
    			EndSwitch
    		Next
    	Next
    EndFunc   ;==>pconsScanInventory
    ;==================================================================================================
    Func UseItemBySlot($aBag, $aSlot)
    	Local $item = GetItemBySlot($aBag, $aSlot)
    	SENDPACKET(8, 119, DllStructGetData($item, "ID"))
    EndFunc   ;==>UseItemBySlot
    ;==================================================================================================
    Func arrayContains($array, $item)
    	For $i = 1 To $array[0]
    		If $array[$i] == $item Then
    			Return True
    		EndIf
    	Next
    	Return False
    EndFunc   ;==>arrayContains
    ;==================================================================================================
    Func inExplorableArea()
    	Return GetMapLoading() == 1
    EndFunc   ;==>inExplorableArea
    
    
    	pconsScanInventory()
    	UseArmor()
    	UseEssence()
    	UseGrail()
    	UseApple()
    	UseCupcake()
    	UseSalad()
    	UseCorn()
    	UseEgg()
    	UseRedRock()
    	UseBlueRock()
    	UseGreenRock()
    	UsePie()
    	UseSupplies()
    	UseSoup()
    	UseKabob()
    	UseAmberSummon()
    	UseArticSummon()
    	UseAutomatonSummon()
    	UseCelestialSummon()
    	UseChitinousSummon()
    	UseDemonicSummon()
    	UseFossilizedSummon()
    	UseFrostySummon()
    	UseGelatinousSummon()
    	UseGhastlySummon()
    	UseImperialGuardSummon()
    	UseJadeiteSummon()
    	UseMerchantSummon()
    	UseMischievousSummon()
    	UseMysteriousSummon()
    	UseMysticalSummon()
    	UseShiningBladeSummon()
    	UseTenguSummon()
    	UseZaishenSummon()
    Last edited by savsuds; 05-20-2013 at 10:32 PM. Reason: Credits and notes

  2. #2
    Senior Member
    Join Date
    Apr 2010
    Posts
    160
    Quote Originally Posted by savsuds View Post
    gigi a huge shout out for posting examples around here
    Thanks

    Quote Originally Posted by savsuds View Post
    I don't know anything about timers, effect reading or anything like that
    But i do (my whole work on cons usage was for this: http://www.gamerevision.com/showthre...-WTS-GWToolbox), and i'd like to give you a few hints.

    That code looks really similar to GWToolbox 1.3, since thats where i took the core, made into a semi-standalone script for developers, and gave away.
    Since then, i made huge improvements.

    The whole thing of doing "scan inventory" and then saving the positions of objects is nice, but is it worth it? No.
    I initially made it to save some computing power and speed up the script at the cost of memory, but i then figured out that the difference is minimal. What i do now is to use things by modelID, basically i have a UseItemByModelId function that checks every item in the inventory and once it finds the right ID it uses it. Returns true if successful or false if not. This is a little slower, but it's not noticeable since the loop only occurs when you actually use the item.

    The real issue of the consumables usage is to be able to keep them up, and to be able to check efficently if it should use or not. For this you would need to repeatedly use GetEffect or GetEffects to check if you have an effect already. Issues are mostly 3:
    1- you are doing that often, it should be a quick function, but it's not. (example: look at GetEffect: it loops through ALL effects, meaning that if you call GetEffect n times for n consumables it will repeat the same loop n times: horrible.)
    2- Don't blindly use a library, look at the source, GWA2 is amazing but it was not written with speed in mind.
    3- GetEffect or GetEffects fail, meaning that it could say that you don't have an effect although you have it, causing you to use that consumable again.

    Solutions:
    1- Do it less often. Don't check "do i have the effect" but check "is the effect about to end?"
    2- Change the source. Make your own functions. Change GWA2 in order to fit your needs. I managed to make some GWA2 functions 10 times faster (like from 50ms to 5ms, that's very noticeable in a tight loop).
    3- Unfortunately i don't know what causes this, but it's for sure a timing issue. My solution is to check all the effects twice before doing anything.

    That said, i appreciate your work, i always wanted to get into the stones thing but never had time for that.

    Sorry if i sound like i am doing criticism: i am not, i just appreciate your interest and want to give you hints on improvement.

    Last but not least: i will not provide a full consumable library, mostly because i don't have the time to extract that from toolbox, but i'll be happy to reply to any specific question

    gigi

  3. #3
    Retired savsuds's Avatar
    Join Date
    Apr 2013
    Location
    'Murica
    Posts
    1,246
    My original intention was to add summon stones and BUs to the Luxon VQ for Mount Qinkai when I put this together. I have it working just as I would like. I don't run pcons, since they are wasted on that VQ farm. I used to have an opening Champ boxes addiction. It resulted in a 1000 or so Zaishen Summon stones. I found a great way to use them all up, slowly. But, most farms that require pcons are not that interesting to me. I no longer play the game, I prefer to bot the game. The costs for pcons and the rewards via botting using them are not that great. The profit margin is lower. The summons may speed a VQ by 1-5 minutes or even more in some areas and with some Summons (looking at those Tengu, Shining Blade, and Imperial summons).

    But, my compulsive nature thought that the pcons themselves would be nice for someone wanting to make their own pcon user/monitor like your version. For the most part, I don't plan to pursue this project any further. I stopped at just the normal pcons. I purposefully skipped DP removals and lunars, since the cost for lunars is quite high. I am a firm believer in the cost of farm to be profitable. Most pcons are not profitable to me.

    I do appreciate your inputs. It all makes sense, which is something I could not say 1-2 months ago.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •