when I do runscript wait4rez it bombs out, complaining about while "${result}" being an illegal statement outside function definition.
The original condition was while "${Math.Calc[{loottotal} - ${t}]}" so it stops looping when it reaches 0.
Any help would be grand.
wait4rez.iss
Code: Select all
; --------------
; -- Main Sub --
; --------------
function main()
{
declare t int script 1
declare result int script 0
declare loottotal int script
declare lootslot int script
declare lootleft int script 0
; if "${Param0.Equal["now"]}" {
; /goto :zonein
; }else{
; /echo $Param0
; }
; if "!${Defined[Param0]}" {
; /echo Defaulting to leaving ${lootleft} item/s on corpse
; } else {
; varset lootleft ${Param0}
; }
; echo Wait4rez.mac activated. Now consenting guild, raid, and group.
; --------------
; -- Consents --
; --------------
EQExecute /consent guild
wait 30
EQExecute /consent raid
wait 30
EQExecute /consent group
echo Awaiting rez: will auto-accept, then loot leaving ${lootleft} items on corpse
Call grab
if "${Window[ConfirmationDialogBox].Open}"
{
notify ConfirmationDialogBox Yes_Button leftmouseup
}
else
{
call waitforrez
}
call WaitToZone
if "${Target.CleanName.Equal[${Me}'s corpse]}"
{
call LootSequence
}
else
{
call WaitToZone
}
call DoubleCheck
endscript wait4rez
}
; ----------------------------------------------
; -- Wait until fully zoned in before looting --
; ----------------------------------------------
function WaitToZone()
{
do
{
EQExecute /target ${Me}'s
wait 10
}while "${Target.CleanName.NotEqual[${Me}'s corpse]}"
}
; ---------------------
; -- Auto-accept Rez --
; ---------------------
function grab()
{
do
{
wait 1s ${Window[ConfirmationDialogBox].Open}
}while "!${Window[ConfirmationDialogBox].Open}"
}
; ---------------------
; -- Loot Corpse --
; ---------------------
function LootSequence()
{
if "${Target.CleanName.Equal[${Me}'s corpse]}"
{
call PullCorpse
}
if "${Target.CleanName.Equal[${Me}'s corpse]}"
{
call OpenCorpse
}
if "${Me.State.Equal[BIND]}"
{
call LootCount
}
else
{
echo Not ready to Loot
}
call LootItems
return
}
; -----------------------
; -- Pull corpse close --
; -----------------------
function PullCorpse()
{
wait 30
EQExecute /corpse
wait 10 ${Target.Distance}<20
if "${Target.Distance}>20"
{
echo Corpse is too far away
endscript wait4rez
}
}
; ---------------------
; -- Open the corpse --
; ---------------------
function Opencorpse()
{
if "${Target.CleanName.Equal[${Me}'s corpse]}"
{
EQExecute /loot
}
else
{
echo where did my corpse go?
endscript wait4rez
}
do
{
wait 30
}while "${Me.State.NotEqual[BIND]}"
varset loottotal 0
}
; -----------------
; -- Count items --
; -----------------
function LootCount()
{
do
{
varset loottotal ${Corpse.Items}
wait 10
}while "${loottotal}!=${Corpse.Items}"
if "${loottotal}<=${lootleft}"
{
echo Looting aborted. Error in number items to be left on corpse.
notify LootWnd DoneButton leftmouseup
endscript wait4rez
}
varset loottotal ${Math.Calc[${Corpse.Items}-${lootleft}]}
}
; ---------------------
; -- Loot the corpse --
; ---------------------
function LootItems()
{
echo Looting all but ${lootleft} item(s)
varset t 1
do
{
do
{ itemnotify loot${lootslot} rightmouseup
wait 5 !${Corpse.Item[${lootslot}].ID}
}while "${Corpse.Item[${lootslot}].ID}"
varset t ${Math.Calc[${t}+1]}
varset result ${Math.Calc[${loottotal}-${t}]}
}while "${result}"
}
; -----------------
; -- Doublecheck --
; -----------------
function DoubleCheck()
{
if "${Math.Calc[${Corpse.Items}-${lootleft}]}"
{
call LootSequence
}
notify LootWnd DoneButton leftmouseup
echo Done looting. ${lootleft} Item(s) left on your corpse.
return
}


