wait4rez.iss

Moderator: MacroQuest Developers

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

wait4rez.iss

Post by Red-One » Thu May 05, 2005 11:16 pm

Forgive me but this was done in notepad, heh. :o
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
}
Last edited by Red-One on Fri May 06, 2005 8:08 pm, edited 1 time in total.

onetimehero
a ghoul
a ghoul
Posts: 105
Joined: Fri Sep 05, 2003 2:42 pm

variable scope

Post by onetimehero » Fri May 06, 2005 12:42 am

Variable scope declarations are different in LS. There are three: function local variables, script variables, and global variables.

Code: Select all

   declare t int outer 1 
   declare result int outer 0 
   declare loottotal int outer 
   declare lootslot int outer 
   declare lootleft int outer 0 
could become

Code: Select all

   declare t int script 1 
   declare result int script 0 
   declare loottotal int script 
   declare lootslot int script 
   declare lootleft int script 0 

delay 3s becomes

Code: Select all

wait 30
Hmm. That's odd.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Fri May 06, 2005 12:56 am

Well, theyre exactly the same, just that the MQ2 "outer" is called "script" in LavishScript :)

What he said though.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

...

Post by Red-One » Fri May 06, 2005 1:06 am

I gotta goto bed so I can't really do much more tonight. I fixed the "${result}" error by making 1 space between the } and while. I do however get an error when it hits the first "call wait4rez". It says function could not be found. Thanks for the replies. :o


-Red

CheckinThingsOut
a ghoul
a ghoul
Posts: 81
Joined: Wed Jun 30, 2004 3:11 pm

Post by CheckinThingsOut » Fri May 06, 2005 4:16 pm

I believe that there needs to be a space between the function name and the ():

Code: Select all

function wait4rez() 
should be

Code: Select all

function wait4rez () 
You might want to take a look at this one too:

Code: Select all

function LootSequence()
should be

Code: Select all

function LootSequence ()

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Fri May 06, 2005 4:34 pm

incorrect. I would consider it bad form to put a space between the function name and the (). It *may* work, but if it does it's just a coincidence -- i would actually expect it to not work ;)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

Post by Red-One » Fri May 06, 2005 5:20 pm

Well, back to doing 20k's in pok again. :o .


-Red

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

HEPL!

Post by Red-One » Fri May 06, 2005 8:10 pm

I have looked over things multiple times, and I cannot see why it says "cannot find function call grab". Lax, HEPL MEH!

(I edit'd the code per the delcare post above and some other small changes)



-Red

onetimehero
a ghoul
a ghoul
Posts: 105
Joined: Fri Sep 05, 2003 2:42 pm

Post by onetimehero » Fri May 06, 2005 8:18 pm

function names are case-sensitive, just like variable names.
Hmm. That's odd.

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

..at it again

Post by Red-One » Fri Jul 01, 2005 11:58 am

I'm going to try to finish this, and convert a lot of my others stuff to *.iss

-Red

theduck
orc pawn
orc pawn
Posts: 26
Joined: Mon Dec 15, 2003 4:24 am

Post by theduck » Thu Sep 22, 2005 2:16 pm

Notify and ItemNotify from MQ2 are implemented as EQNotify and EQItemNotify in ISXEQ.

Hell if I know if they work or not, but had started to convert this and realized they were there so was looking at the code to see if I could convert them.
*QUACK*