script uses POF on items with 0 durability in main backpack untill maximum durability is 255. 
extremly usefull in doom
script doesnt undress pg, u have to do it manually.
items for repearing are to be in main backpack. pof may be in any sub-backpack.
	
							
						
					extremly usefull in doom

script doesnt undress pg, u have to do it manually.
items for repearing are to be in main backpack. pof may be in any sub-backpack.
codice:
	
	;name: POFrep
;author: Felix
;purpose: uses pof on items with 0-durability
;version: 0.9
;setup
set %CursorDelay 500 ; maximum time (ms) of appearing target cursor
;end setup
set #lpc 5000
ignoreitem ZVI_UJG_WUF_RGG_IUF_UZF_YZF_IJG_CWH_LWL_ZUF_XUF_YUF_MPF_MZF_SZF_RZF_KZF_FWL_ZBN_JUF_JZF_DWR_QON_FWR_ECR_CWL_YXM_XDI_LKF_ZJF_FOD_KKQ_XXM_FJM
set %nextObjUse #systime - 1
;opening status
while #hits = n/a
{
      event macro 8 2
      set %delay #systime + 2000
      while #hits = n/a && #systime < %delay
      {
            wait 1
      }
}
set %hits #hits - 10
;opening backpack
finditem * C_ , #backpackid
while #findcnt = 0
{
      event macro 8 7
      wait 20
      finditem * C_ , #backpackid
}
;exception
if #CHARGHOST = yes
{
   event exmsg #charid 0 0 dead
   halt
}
;indexing pof
finditem KEG C
if #findkind = -1
{
   event exmsg #charid 0 0 no pof
   halt
}
set %POFQ #findcnt
set %POFI 0
for #findindex #findcnt 1
{
    set %POFI %POFI + 1
    set %POF . %POFI #findid
}
;indexig items to POF
finditem * C_ , #backpackid
set %ItemI 0
set %LowDurStr $Durability , #spc , 0 , #spc , / , #spc
for #findindex 1 #findcnt
{
          repeat
                event property #findid
          until no , #spc , data notin #property
          if %LowDurStr in #property
          {
             set %ItemI %ItemI + 1
             set %Item . %ItemI #findid
          }
}
set %ItemQ %ItemI
if %ItemQ = 0
{
   event exmsg #charid 0 0 nothing to repair
   halt
}
;main
set %POFi 1
set %POF %POF . %POFi
set %FullDurStr #spc , / , #spc , 255$
repeat
    set %status 2
    for %ItemI 1 %ItemQ
    {
        set %Item %Item . %ItemI
        if %Item = done
           continue
        repeat
          event property %Item
        until Durability in #property
        if %FullDurStr in #property
        {
           set %Item . %ItemI done
           continue
        }
        set %status 1
        ;using pof
        usingpof:
        while #systime < %nextObjUse
        {
              sleep 10
        }
        finditem %POF C
        if #findkind = -1
        {
           if %POFi = %POFq
           {
              event exmsg #charid 0 0 pof finished
              halt
           }
           set %POFi %POFi + 1
           set %POF %POF . %POFi
        }
        set %JS #jindex + 1
        set %nextObjUse #systime + 550
        set %finishCursorWait #systime + %CursorDelay
        set #lobjectid %POF
        event macro 17 0
        set %MustWait #false
        set %POFnotfound #false
        while #targcurs <> 1 && %MustWait = #false && %POFnotfound && #hits >= %hits && #systime <= %finishCursorWait
        {
              sleep 10
              if #jindex >= %JS
              {
                 set %JN #jindex
                 for %JI %JS %JN
                 {
                     scanjournal %JI
                     if You_must_wait_to_perform_another_action. in #journal && : notin #journal
                     {
                        set %MustWait #true
                        set %nextObjUse #systime + 150
                        break
                     }
                 }
                 set %JS %JN + 1
              }
              finditem %POF C
              if #findkind = -1
                 set %POFnotfound #true
        }
        if #hits < %hits
        {
           event exmsg #charid 0 0 low hp. pause.
           pause
        }
        if %MustWait || %POFnotfound || #systime > %finishCursorWait && #targcurs <> 1
           goto usingpof
           
        set #ltargetid %item
        set #ltargetkind 1
        event macro 22 0
    }
until %status = 2
event exmsg #charid 0 0 REPEARED
halt

