A forum for the general posts relating to MacroQuest. *DEPRECATED: This forum is no longer in public use, but remains here for your reading pleasure. Enjoy
Moderator: MacroQuest Developers
-
greggor
- orc pawn

- Posts: 28
- Joined: Tue Jun 17, 2003 2:30 pm
Post
by greggor » Sat Oct 04, 2003 2:17 pm
Just figured a guide to converting macros would be a good idea, and a great first step to a macro converting program (if anyone wants to make this :) ) Here is what I've figured out so far... please feel free to add more ideas/steps/suggestions and I will add to this post as needed.
I'm relying heavily on the find/replace of my text editor for this.
1.) replace all #define varname $v with /declare varname global
2.) replace all #define varname $t with /declare varname timer
3.) replace all #define varname $a(x,x) with /declare varname array2
(for two dimensional arrays) or /declare varname array (for 1 dimensional arrays)
4.) replace all $p with @Param (uppercase "P" is important) careful not to replace $pack(x) with @paramack(x)
Greggor
-
MacroFiend
- a grimling bloodguard

- Posts: 662
- Joined: Mon Jul 28, 2003 2:47 am
Post
by MacroFiend » Mon Oct 06, 2003 7:31 pm
5) Locate all $l variables and /declare xxx local them in the sub they are used in.
6) Move all global variable /declare statements from the top of your macro in to Sub Main (before any :loop entries) so they are properly declared at macro start. (This may be a bug)
You can save a little time in the initial conversion process if you leave your variable names the same $v, $l, $t and just do a global search and replace for the $v/$l/$t and replace it with @v/@l/@t.
Then go back after you have it working and rename your variables to something more meaningful and remove the #define VarName $v#
-
Plazmic
- The One

- Posts: 800
- Joined: Fri Jun 14, 2002 12:31 am
-
Contact:
Post
by Plazmic » Mon Oct 06, 2003 9:42 pm
MacroFiend wrote:6) Move all global variable /declare statements from the top of your macro in to Sub Main (before any :loop entries) so they are properly declared at macro start. (This may be a bug)
What part of this would be a bug? You can't declare the same variable mutliple times, and if the /declare is in a loop, that would be declaring it multiple times (each time through the loop)
-
MacroFiend
- a grimling bloodguard

- Posts: 662
- Joined: Mon Jul 28, 2003 2:47 am
Post
by MacroFiend » Mon Oct 06, 2003 10:04 pm
The possible bug was not that you declare them outside of a loop but rather that they are declared inside the sub where the old language you did your defines prior to sub main and having the newly translated /declare statements not working as a drop-in command at the same spot as the old #define
-
Valerian
- a grimling bloodguard

- Posts: 709
- Joined: Sun Jul 28, 2002 3:29 am
Post
by Valerian » Tue Oct 07, 2003 8:31 am
MacroFiend wrote:The possible bug was not that you declare them outside of a loop but rather that they are declared inside the sub where the old language you did your defines prior to sub main and having the newly translated /declare statements not working as a drop-in command at the same spot as the old #define
I agree. Perhaps global type vars could have a #declare line... /declare is also useful though... maybe have both as an option, both options doing the same thing. (just using one or the other for each var -- could have both #declare's and /declare's in the same macro as long as each var is declared only once)
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Tue Oct 07, 2003 9:55 am
Actually it makes sense inside the sub. It makes include files more logical that way, and you should try to /declare locally as much as possible anyway, just like any other programming language.
MQ2: Think of it as Evolution in action.
-
MacroFiend
- a grimling bloodguard

- Posts: 662
- Joined: Mon Jul 28, 2003 2:47 am
Post
by MacroFiend » Tue Oct 07, 2003 1:14 pm
I agree that it makes sense. Having all variables declared inside a sub just wasn't documented as a new requirement (that I remember seeing)
-
Plazmic
- The One

- Posts: 800
- Joined: Fri Jun 14, 2002 12:31 am
-
Contact:
Post
by Plazmic » Tue Oct 07, 2003 10:35 pm
Sorry, I thought it would be assumed that all slash commands were inside subroutines and only hash commands were allowed outside.
-
driftinsupra
- Official loudmouth

- Posts: 212
- Joined: Tue Jan 28, 2003 9:25 pm
Post
by driftinsupra » Fri Oct 10, 2003 7:41 pm
I actually started working on a small program that can do the edits that you guys specified but I am still having a few problems. I am still confused about what needs to be changed in the macros and looking throught the boards I could find anything that was too specific. If someone could give me an extremely detailed list of things that need to be changed I could probably make a program to handle macro changing in the next few days.