Need help with a macro you are writing? Ask here!
Moderator: MacroQuest Developers
-
McClicky
- decaying skeleton

- Posts: 8
- Joined: Sun May 02, 2004 2:20 am
Post
by McClicky » Mon May 03, 2004 7:56 pm
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?
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Mon May 03, 2004 8:16 pm
I suggest posting the macro, any one of them, that is giving you the error so we might have something to suggest.
-
McClicky
- decaying skeleton

- Posts: 8
- Joined: Sun May 02, 2004 2:20 am
Post
by McClicky » Mon May 03, 2004 8:24 pm
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
-
magictiger
- a snow griffon

- Posts: 450
- Joined: Sun Mar 21, 2004 2:24 pm
Post
by magictiger » Mon May 03, 2004 8:38 pm
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)
-
McClicky
- decaying skeleton

- Posts: 8
- Joined: Sun May 02, 2004 2:20 am
Post
by McClicky » Mon May 03, 2004 8:43 pm
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.
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Mon May 03, 2004 9:03 pm
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.
-
McClicky
- decaying skeleton

- Posts: 8
- Joined: Sun May 02, 2004 2:20 am
Post
by McClicky » Mon May 03, 2004 9:17 pm
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.
-
magictiger
- a snow griffon

- Posts: 450
- Joined: Sun Mar 21, 2004 2:24 pm
Post
by magictiger » Mon May 03, 2004 9:20 pm
Is the macroquest2.exe that you're running out of the Release directory from your newest compile?
-
McClicky
- decaying skeleton

- Posts: 8
- Joined: Sun May 02, 2004 2:20 am
Post
by McClicky » Mon May 03, 2004 9:24 pm
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.

)
-
Goofmester1
- a hill giant

- Posts: 241
- Joined: Thu Nov 06, 2003 4:26 am
Post
by Goofmester1 » Mon May 03, 2004 11:52 pm
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.
-
McClicky
- decaying skeleton

- Posts: 8
- Joined: Sun May 02, 2004 2:20 am
Post
by McClicky » Tue May 04, 2004 9:32 am
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?
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Tue May 04, 2004 10:43 am
It's not the compiler
-
bob_the_builder
- a hill giant

- Posts: 275
- Joined: Tue Jul 22, 2003 1:22 pm
Post
by bob_the_builder » Tue May 04, 2004 12:12 pm
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
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Tue May 04, 2004 12:25 pm
/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
