• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - Proper coding within a macro

Joined
Oct 21, 2013
RedCents
517¢
For you macro wizards or those that know,

I'm attempting to tweak a macro I have seen that want to modify, but I'm running into syntax errors or just general formating error and can use some assistance.

In the macro I'm editting for my needs it declares a macro and then later uses /bc to launch it but I am getting errors.

Here is the snippet:

/declare Macro1 string outer MACRONAME

Sub nametobedetermined
/bct ${mycharname} //mac ${Macro1}
/return

If I plugin "kissassist" (without quotes) for MACRONAME everything works fine, my issues is when I attempt to do this for my tank, pullertank and I want to pass "kissassist tank" or "kissassist pullertank". How should I declare the macro when it has a space it in it? I have tried putting the macro and arguement in quotes but it doesn't appear to work.
 
I'm no expert by any means but the macro is called kissassist, the tank or pullertank part is a second bit of info telling the macro what to do and not calling up a different macro. The way you are doing it the program would look for a macro with that specific name, you would have to call the macro first and then in a separate step tell the macro how you want it to run.
 
I'm no expert by any means but the macro is called kissassist, the tank or pullertank part is a second bit of info telling the macro what to do and not calling up a different macro. The way you are doing it the program would look for a macro with that specific name, you would have to call the macro first and then in a separate step tell the macro how you want it to run.

Heh Infinite Monkey,

I understand the logic of the code I posted, but I'm having a specific problem with how to assign the declared Macro1 with the wording of the macro I will use with possible arguement with it.

I guess I might not have explained myself well enough.... forget I even put in kissassist as the values, it could be any other macro out there and I'm attempting to call, but that macro allows arguements much like KA does (tank, pullertank, etc). I am just wanting to know how to properly format the actual text that would replace MACRONAME when I know the macro I am calling can accept arguements. Do I encapsulate it in double quotes, single quotes, brackets, etc? Or does it not need to be encapsulated?

Hope I made myself a little bit clearing. I do thank you for your response though!
 
A second variable might prove useful so that you can modularly pass arguments to the macro you are calling:

Rich (BB code):
/bct ${mycharname} //mac ${Macro1} ${Arg1} ${Arg2}

and then just define the arguments appropriately. If you don't need that kind of sophistication, then just put all the arguments after the outer without quotes.

Rich (BB code):
/declare Macro1 string outer MACRONAME MACROARG
 
as alluded to, you have to include quotation marks "" if your string has spaces in it or it uses each word individually. /declare Macro1 string outer "kissassist tank"
 
A second variable might prove useful so that you can modularly pass arguments to the macro you are calling:

Rich (BB code):
/bct ${mycharname} //mac ${Macro1} ${Arg1} ${Arg2}

and then just define the arguments appropriately. If you don't need that kind of sophistication, then just put all the arguments after the outer without quotes.

Rich (BB code):
/declare Macro1 string outer MACRONAME MACROARG

dannuic,

Thanks! I just wasn't sure if I did a declare for the string and it wasn't encapsulated that it would only capture the first portion of the string.

- - - Updated - - -

as alluded to, you have to include quotation marks "" if your string has spaces in it or it uses each word individually. /declare Macro1 string outer "kissassist tank"

LOL, okay I just responded to dannuic in thinking that I could pass both strings without encapsulating them. Well I was having issues putting the string in double quotes. I think I will probably just go with what dannuic proposed something along the lines of passing a declared argument to the line in questions:
${Macro1} ${Arg1}


Thank you all again for responding..... now when I get time in the next few days hopefully I can try out some new code.
 
Personally, I would use the " " over the different variables in your case only because different macros will have different parameters passed to them and you dont want to send NULL for no reason, depending on how you set it up. In general, youd end up coding around more than you need to. KISS!
 
When declaring a variable you don't need "" quotation marks.

Rich (BB code):
/declare MyVar string outer This is my variable
/echo $(MyVar)

Result: MQ2 This is my variable

When you are passing information to a subroutine with /call command and the info has spaces then use quotation marks "' otherwise MQ2 assumes the info ends at the first space

Rich (BB code):
/call PrintVar This is my variable

Sub PrintVar(printthis)
    /echo $(printthis)
/return
Result: MQ2 This

With "" quotation marks

Rich (BB code):
/call PrintVar "This is my variable"

Sub PrintVar(printthis)
    /echo $(printthis)
/return

Result: MQ2 This is my variable

Passing info to a macro from a hotkey or bct command follows the same rule per variable passed along. Mq2 thinks each space is a new var unless enclosed by quotation marks

Rich (BB code):
/mac KissAssist Assist Pretty Pony 90

= var1=Assist var2=Pretty var3=Pony var4=90

Kiss thinks assist pretty at pony ERROR

With quotation marks
Rich (BB code):
/mac KissAssist Assist "Pretty Pony" 90

= var1=Pretty var2=Pretty Pony var3=90

Kiss thinks assist pretty pony at 90% correct

hope that helps
 
Maskoi,

Perfect! Thanks for the explanation. I'm an old school Pascal/Basic from the 80's so I have an idea for flow. I know each language has it particulars and you explained it in the way I needed to know. I'm guessing I might not have phrased my question well enough from the start.

- - - Updated - - -

Okay, on a different note.... I wanted to click a thanks for your response Maskoi, but I do not see the thanks link on this post, or any post for that matter.

Something I have done now that doesn't allow me to thank users?
 
PM redbot on the thanks thing. You can only thanks like several times a day too.
 
Question - Proper coding within a macro

Users who are viewing this thread

Back
Top
Cart