Page 1 of 1

Subroutine Main not found.

Posted: Mon May 03, 2004 7:56 pm
by McClicky
Couldn't find this topic anywhere else doing a search...

I'm getting the error: "Subroutine Main not found", when trying to execute my macros. Yeah, I'm a noob, but I've RTFM over and over, reinstalled, recompiled, did a clean build, rebuild, triple checked my copy/paste jobs, done everything I could think of to do...

This happens when I try to run pretty much any macro, including the included macros with MQ2, all except Hero.mac, which leads me further down the path of unexplainable frustration. Everything else runs without a problem. Any suggestions?

Posted: Mon May 03, 2004 8:16 pm
by Preocts
I suggest posting the macro, any one of them, that is giving you the error so we might have something to suggest.

Posted: Mon May 03, 2004 8:24 pm
by McClicky
Roger...sorry 'bout that. :)

I didn't post any code originally because the macros already in MQ2 were unaltered, as is this, bob the builder's original castgem.mac. This is the actual macro I'm trying to run, but others, such as Follow.mac, RandFollow.mac, and Inventory.mac are doing the same thing, with Hero.mac being the only one I can get to see past the Main sub.

Code: Select all

| castgem.mac 
| /macro castgem <gem #> 
| For instance: 
| /macro castgem 8 
| Use for skill up 
| Use for making items 
| Bob_the_builder 
| 4/29/04 

#include spellcast.inc 
#event NoComponents "You are missing some required components." 

Subroutine Main
	/declare SpellName
	/varset SpellName ${Me.Gem[${Param0}]}
	/if (${Me.State.Equal[SIT]}) /stand

	:CheckMana
	/if (${Me.PctMana}<20) /goto :SitDown

	:CheckCursor
	/if (${Cursor.ID}) {
	/autoinv
	/goto :CheckCursor
	}

	:CastSpell
	/call cast "${SpellName}"
	/doevents
	/goto :CheckMana

	:SitDown
	/if (${Me.State.Equal[STAND]}) /sit on

	:HowMuchMana
	/if (${Me.PctMana}<98) /goto :HowMuchMana
	/goto :CheckMana
/endmacro

Sub Event_NoComponents
	/popup No More Items to Make
/endmacro
/return

Posted: Mon May 03, 2004 8:38 pm
by magictiger
Wait... should just be "Sub Main" not "Subroutine Main" shouldn't it?

Was that one of your troubleshooting attempts, or did you copy/paste it like that (no, you didn't, because I just checked the original macro)

Posted: Mon May 03, 2004 8:38 pm
by Raging_Goblin

Code: Select all

...
Subroutine main
...
tried changing it to sub main?

Posted: Mon May 03, 2004 8:43 pm
by McClicky
Yeah, that was one of the fixes I tried. Originally it was Sub Main. The only thing I can think of is maybe a problem with my compiler... I use Visual Studio.net 2003, the C++ to compile. I'm not getting any errors, 13, 0, 0, but at this point I'm accepting any possibility.

Posted: Mon May 03, 2004 9:03 pm
by Preocts
Make Subroutine Main: Sub Main and take that silly /endmacro out at the end. /return would be the proper way to end any macro, handing control back to it's parent.

Posted: Mon May 03, 2004 9:17 pm
by McClicky
Thanks, Preocts. Unfortunately, still nada. Tried it just changing Sub Main back (as that would be it's true original form) and also changing the /endmacro to /return....still the same error.

Posted: Mon May 03, 2004 9:20 pm
by magictiger
Is the macroquest2.exe that you're running out of the Release directory from your newest compile?

Posted: Mon May 03, 2004 9:24 pm
by McClicky
yeah, it's under release. I can see all the macros with /listmacros, I even got hero.mac to open up the tradeskill window (I had no water flasks, as Lax so gently reminded me. :wink: )

Posted: Mon May 03, 2004 11:52 pm
by Goofmester1
I assume you have spellcast.inc but double check that it is in your macro folder.

Make sure you have done the update for VC6++ that is stickied.

Posted: Tue May 04, 2004 9:32 am
by McClicky
I do have spellcast.inc in there. The update might possibily be my problem, not sure, though. I went to the link provided in the VC6++ sticky, downloaded it, and got "did not complete successfully" when I tried to run it. That's all it's saying, so kinda hard to troubleshoot what went wrong. I tried patch 6 and patch 5, same thing. I downloaded the whole shebang as opposed to individuals. My only guess is that I might not be getting the right file. Could someone please post a link to Visual Studio.Net 2003 patch update so I can make sure I'm getting the right one. If it's the same as the sticky, don't worry about it, I just wanna make sure. Also, would downloading the files individually increase my chances of getting a successful install?

Posted: Tue May 04, 2004 10:43 am
by Lax
It's not the compiler

Posted: Tue May 04, 2004 12:12 pm
by bob_the_builder
take that silly /endmacro out at the end. /return would be the proper way to end any macro, handing control back to it's parent
I was just going by how the manual has the sub main listed.



Subroutines
Every macro has a Sub Main that defines the macro's entry point.

Sub Main
.
<code>
.
/endmacro


All of the examples use sub main and /endmacro as well....

Bob_rtfm

Posted: Tue May 04, 2004 12:25 pm
by Lax
/endmacro is just as correct as /return to return from sub main.

in fact, the code in the /return command checks if it's main and does /endmacro if it is. If you're looking to save some cpu cycles /endmacro will save you one or two out of the millions you process every second over /return. It doesnt matter which is used, as I said both are correct

carry on ;)