;;================================== 
; Script Name: Ingot Counter ( Another Jebbit Miner Helpper Script ) 
; Author: Jebbit 
; Version: 1.3 
; Client Tested with: 4.0.1b 
; EUO version tested with: V1.40 [Build 005F] 
; Shard OSI / FS: OSI 
; Revision Date: 
; Public Release: 12/16/2003 
; Purpose: Total ingots/types from multiple containers. Click container and it will auto count and display. 
; Click another container and it will continue to count and dispaly total.  
;================================== 
set %contType %contType ,  _KKF_ZTD_cud_hkf ; small crate 
   set %contType %contType ,  _VMF_WMF ; medium crate 
   set %contType %contType ,  _UMF ; large crate 
   set %contType %contType ,  _JIF_KIF_bud ; large chest 
   set %contType %contType ,  _BDE_EDE ; wooden shelf 
   set %contType %contType ,  _BVD_NVD ; armoire (red) 
   set %contType %contType ,  _DVD_EVD_QVD_PVD ; armoire 
   set %contType %contType ,  _JKF ; keg 
   set %contType %contType ,  _ZJF ; backpack 
   set %contType %contType ,  _CKF ; a bag 
   set %contType %contType ,  _LKF ; a pouch 
   set %contType %contType ,  _OKF ; picnic basket 
   set %contType %contType ,  _HIF_IIF ; metal chest 
   set %contType %contType ,  _BKF ; large barrel 
set %fullpars #true
set %more 0
set %www 50
set %hold 1
set %end 5
set %ddd 390
set %delay 1
ignoreitem #backpackid
goround:
gosub open
gosub finditall
gosub menus
goto goround

sub open
search:
finditem %conttype g_4
wait %delay
if #findid = x
finditem %conttype C_
if #findid = x
goto dona
set #lobjectid #findid
event macro 17 0
wait 20
contpos 55 55
ignoreitem #findid
goto search
dona:
ignoreitem reset
return

sub finditall
    mor:
   if %men <> 1
{
menu clear
     menu delete stat1
menu delete stat3
menu delete stat15
      menu window size 130 %www
      menu window color BLACK
      menu font bgcolor BLACK
menu window title Ingots
menu show 3 390
set %men 1
}
FINDITEM ENK C_
IF #FINDID = X 2
MENU HIDE
     gOTO menu
set %sss %sss + 1
menu delete stat15
 menu font color yellow
 menu font style b
menu text stat15 40 0 %SSS
      set #lobjectid #findid
       IGNOREITEM #LOBJECTID
        EVENT PROPERTY #findid
gosub pars
WAIT 5
if ingots in %d0
  set %d2 %d1
    if n/a in %d2
      set %d2 Iron
if %d2 notin %hold && %d2 <> n/a
{
	set %hold %hold , _ , %d2
	set %www %www + 25
	set %ddd %ddd - 25
	set %as %as + 1
	set %mor . %as %mor . %as + #findstack
	set %more . %as %d2
	set %d2 n/a
	goto mor
}
set %ds 0
chang:
if %ds >= %as
  goto mor
    set %ds %ds + 1
      set %results %more . %ds
if %d2 in %results
{
	set %sas %as
	set %as %ds
	set %mor , %as %mor . %as + #findstack
	set %as %sas
	set %d2 n/a
	goto mor
}
goto chang
set %d2 n/a
GOTO MOR
return

sub menus
if %men <> 1
menu clear
menu:
menu delete stat1
menu delete stat3
menu delete stat15
      menu window size 130 %www
      menu window color BLACK
      menu font bgcolor BLACK
menu window title Ingots
menu font align center
      menu font style
  menu font color red
  menu font size 11
menu text stat15 20 0 Ingot Count
    set %aa 0
cnt:
if %as <> n/a
{
set %aa %aa + 1
if %aa > %as
goto outt
set %end %end + 25
menu font size 11
  menu font style b
  menu font color red
set %results %mor . %aa
menu text stat3 70 %end %results
menu font style
  menu font color green
  menu font size 11
gosub chunck
menu text stat 5 %end %gg , #STRRES
goto cnt
outt:
set %end 5
}
     set #menubutton N/A
  menu show 5 %ddd
ignoreitem %first
set %first %first + 1
    pause
return


sub pars
set %l 0
if %test = #true
{
	display msg Target item to be broken down.
	set #targcurs 1
	wait 5
	wait:
	if #targcurs = 1
	goto wait
}
set #lpc 500
set %c 0
set %d part
set %path Assigned , $ ,
set %string Augments , #spc , By , #spc , Number , - , $ ,
SET %a #PROPERTY
topp:
STR POS %a $
set %h #strres
if %fullpars = #true
    {
      STR POS %a #spc
       set %j #strres
        if %h < %j || %j = 0 || ( %l = 0 && #strres = 1 )
         STR POS %a $
if %l = 0
set %l 1
}
if #strres = 0
    {
      if %test = #true
       {
         display msg Total Strings , $ , ( , %c , ) %string
          display Msg %path
           halt
             }
set #lpc 100
             return
              }
if #strres <> 1
{
SET %b #STRRES - 1
   STR LEFT %a %b
      SET %b %b + 1
		set %d . %c #strres
	         set %c %c + 1
	    set %string %string , #spc , ( , %c , ) , #spc , #strres ,
                set %path %path , #spc , % , %d , %c , - , #spc , #strres , #spc ,
           SET %STRING %STRING , $ ,
       SET %PATH %PATH , $ ,
}
    STR DEL %a 1 %b
  set %a #strres
goto topp
return

sub chunck
set #strres %more . %aa
str Left %more . %aa 1
set %gg #strres
str Del %more . %aa 1 1
str lower #strres
return