1
Scripting Chat / Re: Sorting/ID Script
« on: March 20, 2015, 01:22:24 PM »
I am working on a script right now, and when it runs it will ID the items in the select bag either through a wand, or the skill. The issue is when it goes into Bag Drop. Currently it lifts the item, and drops it back into the back it was originally in. No clue what I am doing wrong.
Code: [Select]
SET %use_wand #TRUE
gosub new_bag
;----------------------
; Bag IDs
;----------------------
SET %mask_bag FGEMWMD
SET %leat YOYSSMD
SET %stud RYKFUMD
SET %gheal YZARQMD
SET %lb IZUFUMD
SET %id DLYVQMD
SET %i_ring ZVFCFND
SET %i_chain BUGFUMD
SET %i_plate QLUVQMD
SET %i_helm QIPQQMD
SET %i_shield ZMMVQMD
SET %f_ring QDCGUMD
SET %f_chain QEVRQMD
SET %f_plate VLAWMD
SET %f_helm WJLTQMD
SET %f_shield RVRLDND
SET %gt YCQWQMD
SET %invis JHROXMD
SET %flect SCLWQMD
SET %tele VLZLDND
SET %s_arch ZVNYYMD
SET %p_arch MUVNAND
SET %v_arch YEJZBND
SET %c_arch QHWTEND
SET %s_fenc MSPUEND
SET %p_fenc MOQFUMD
SET %v_fenc LEFEFND
SET %c_fenc TLJOGND
SET %s_mace XKYYYMD
SET %p_mace JTVDEND
SET %v_mace QOUVMMD
SET %c_mace EEVLYMD
SET %s_sword BRCZYMD
SET %p_sword HRFXEND
SET %v_sword BTYCEND
SET %c_sword JYFBOMD
SET %p_halb VOCTQMD
SET %v_halb WOORHND
;----------------------
;DO NOT EDIT BELOW HERE
;----------------------
; vars
EVENT MACRO 8 1
SET %mask PZH_BZH_NZH_DZH_VSH
SET %wand HFF_QMH_BFF_IFF_CFF
SET %halberd YTH
SET %sword NMH_BPH_YPO_BNF_CPH_INF_FSF_OSF_ASF_FMH_LSF_NSF_ISF_SMH_RMH_CSF_ZRF_MPH_LPH_MSF_BSF_KPO_GUO_KTF_JTF_EPH_ZSF_ATF_JPH_SOH_POH_OMH_LPO_ZTO_XTH_HSF_KSF_NPO_XPO_FUO_JPO_NPF_KPH_FYG_RHM_SFR
SET %fenc XRH_VRH_MTF_SRH_AQF_TSF_BUO_VPO_WPO_WRH_YRH_LTF_OPO_RRH_CUO
SET %mace IFF_OLH_JOH_URH_EMH_WTH_DMH_QMH_CFF_BFF_PMH_ZPF_CQF_FFF_TRH_YSF_XSF_FBG_VTH_AUH_ZTH_UOH_VOH_AUO_MPO_BUH_CUH_DMH_GFF_QOH_HFF_TLH_GBG
SET %arch WOH_TOH_QPO_SPO_WOH_TOH_JSF_USF_LMH_MMH_QPO_SPO_PPO_RPO_JSF_USF_LMH_MMH_PPO_RPO_JSF
SET %leather QKH_OSK_ATK_PKH_KKH_JKH_VKH_NJL_YSK_QSK
SET %studded LLH_SSK_USK_GLH_XKH_ALH_MLH
SET %ring WLH_YLH_BMH_IMH
SET %chain ZOH_APH
SET %plate HSH_MSK_MSH_ISH_NSH_LSH
SET %helmet GSH_DPH_OSH_CSH_ASH_ESH
SET %shield CIK_LIK_AIK_FIK_GIK_NIK_OIK
GOSUB main
;----------------------
; Main Sub
;----------------------
SUB MAIN
FINDITEM %bag_scan G_1
SET #LOBJECTID #FINDID
EVENT MACRO 17 0
WAIT 1S
loop:
FINDITEM * C_ , %bag_scan
SET %temp_count #FINDCNT
EVENT SYSMESSAGE %temp_count
SET %item_temp #FINDID
IF #FINDCNT < 1
gosub new_bag
SET #LTARGETID #FINDID
SET #LTARGETKIND 1
SET %jstart #jindex
IF %use_wand = #TRUE
{
FINDITEM %wand C_ , #CHARID
IF #FINDKIND = #TRUE
{
FINDITEM %wand C_ , #BACKPACKID
IF #FINDCNT < 1
{
SET %use_wand #FAlSE
RETURN
}
SET #LHANDID #FINDID
EVENT MACRO 24 1
WAIT 1s
}
FINDITEM %wand C_ , #CHARID
SET #LOBJECTID #FINDID
EVENT MACRO 17 0
}
IF %use_wand = #FALSE
EVENT MACRO 13 3
TARGET
EVENT MACRO 22 0
WAIT 1s
SET %jend #jindex
FOR %i %jstart %jend
{
SCANJOURNAL %i
;WAIT 1s
EVENT SYSMESSAGE %i
SET %temp_var %i
;----- BIG jumbled mess of sorting
IF %item_temp in %mask
{
SET %bag_drop %mask_bag
GOSUB drop
}
IF ( fortification IN #JOURNAL )
{
if %item_temp in %ring
SET %bag_drop %f_ring
if %item_temp in %chain
SET %bag_drop %f_chain
if %item_temp in %plate
SET %bag_drop %f_plate
if %item_temp in %helmet
SET %bag_drop %f_helm
if %item_temp in %shield
SET %bag_drop %f_shield
gosub drop
}
IF ( invulnerability IN #JOURNAL )
{
if %item_temp in %ring
SET %bag_drop %i_ring
if %item_temp in %chain
SET %bag_drop %i_chain
if %item_temp in %plate
SET %bag_drop %i_plate
if %item_temp in %helmet
SET %bag_drop %i_helm
if %item_temp in %shield
SET %bag_drop %i_shield
if %item_temp in %leather
SET %bag_drop %leat
if %item_temp in %studded
SET %bag_drop %stud
gosub drop
}
IF ( teleporting IN #JOURNAL )
{
SET %bag_drop %tele
GOSUB drop
}
IF ( reflection IN #JOURNAL )
{
SET %bag_drop %flect
GOSUB drop
}
IF ( invisibility IN #JOURNAL )
{
SET %bag_drop %invis
GOSUB drop
}
IF ( reaction IN #JOURNAL )
{
SET %bag_drop #backpackid
GOSUB drop
}
;wands
IF ( Greater in #journal ) && ( %item_temp in %wand )
{
set %bag_drop %gheal
gosub drop
}
IF ( lightning in #journal ) && ( %item_temp in %wand )
{
set %bag_drop %lb
gosub drop
}
IF ( identification IN #JOURNAL )
{
SET %bag_drop %id
GOSUB drop
}
;weapons
IF ( touch in #JOURNAL )
{
SET %bag_drop %touch
GOSUB drop
}
IF ( breath in #JOURNAL ) || ( lightning in #JOURNAL )
{
if %item_temp in %sword
{
SET %bag_drop %c_sword
GOSUB drop
}
if %item_temp in %mace
{
SET %bag_drop %c_mace
GOSUB drop
}
if %item_temp in %arch
{
SET %bag_drop %c_arch
GOSUB drop
}
if %item_temp in %fenc
{
SET %bag_drop %c_fenc
GOSUB drop
}
}
IF ( force in #JOURNAL ) && ( %item_temp = %halberd )
{
SET %bag_drop %p_halb
}
IF ( power in #JOURNAL )
{
if %item_temp in %sword
SET %bag_drop %p_sword
if ( %item_temp in %sword ) && ( %item_temp = %halberd )
SET %bag_drop %p_halb
if %item_temp in %mace
SET %bag_drop %p_mace
if %item_temp in %arch
SET %bag_drop %p_arch
if %item_temp in %mace
SET %bag_drop %p_fenc
gosub drop
}
IF ( vanquishing in #JOURNAL )
{
if %item_temp in %sword
SET %bag_drop %v_sword
if ( %item_temp in %sword ) && ( %item_temp = %halberd )
SET %bag_drop %v_halb
if %item_temp in %mace
SET %bag_drop %v_mace
if %item_temp in %arch
SET %bag_drop %v_arch
if %item_temp in %mace
SET %bag_drop %v_fenc
gosub drop
}
;------
IF ( You_are_not_certain... IN #JOURNAL )
{
WAIT 9S
GOTO loop
}
IF ( This_item_is_out_of_charges. IN #JOURNAL )
{
FINDITEM %wand C_ , #CHARID
IF #FINDKIND = #FALSE
{
SET %x ( #CHARPOSX )
SET %y ( #CHARPOSY )
EXEVENT DRAG #FINDID
WAIT 1S
EXEVENT DROPG %x %y
}
GOTO loop
}
deleteJournal
}
IF %use_wand = #FAlSE
WAIT 9s
;WAIT 1s
IGNOREITEM %item_temp
GOTO loop
RETURN
;---------------------------------
; Function subs
;---------------------------------
SUB drop
FINDITEM %item_temp C_ , %bag_scan
if #findcnt < 1
ignoreitem %item_temp
EXEVENT DRAG #FINDID
WAIT 1S
EXEVENT DROPC %bag_drop
SCANJOURNAL #jindex
IF ( weight IN #JOURNAL ) || ( cannot_hold IN #JOURNAL )
{
DISPLAY %bag_drop is FULL
HALT
}
;EXEVENT DROPC #backpackid
RETURN
sub new_bag
SET #TARGCURS 1
WHILE #TARGCURS = 1
{
WAIT 1s
EVENT SYSMESSAGE Target bag to ID!
}
SET %bag_scan #LTARGETID
return