Need help with a macro you are writing? Ask here!
Moderator: MacroQuest Developers
-
gimp
- a grimling bloodguard

- Posts: 584
- Joined: Fri Oct 29, 2004 9:28 am
- Location: internet
Post
by gimp » Fri Oct 29, 2004 9:32 am
Look at this code:
Code: Select all
sub test(parameter)
/echo I recieved this parameter: ${parameter}
/return
sub Main
/declare str local string
/varset str I am a string with spaces
/call test ${str}
/return
I expected this output:
Code: Select all
I recieved this parameter: I am a string with spaces
But, instead I get this:
What am I doing wrong? This seems completley illogical to me.
-
fearless
- Not a Psychic
- Posts: 2684
- Joined: Wed Mar 10, 2004 3:52 pm
Post
by fearless » Fri Oct 29, 2004 9:39 am
MQ considers spaces as a delimiter, so for you to solve this, you need to use "".
For example, /mac monkystuff "flying kick", which would pass "flying kick" to param0.
Reading . . . it's not just for me.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]
-
Chill
- Contributing Member

- Posts: 435
- Joined: Fri May 07, 2004 5:06 pm
- Location: Erie, PA
Post
by Chill » Fri Oct 29, 2004 9:51 am
You can, however, usually get away with setting variables to multi-word srtings as default values when you declare them. This would probably work:
Code: Select all
sub test(parameter)
/echo I recieved this parameter: ${parameter}
/return
sub Main
/declare str string local I am a string with spaces
/call test ${str}
/return
I am at work or I would test it real quick, but I'm pretty sure I have done this before and had it work.
-
gimp
- a grimling bloodguard

- Posts: 584
- Joined: Fri Oct 29, 2004 9:28 am
- Location: internet
Post
by gimp » Fri Oct 29, 2004 10:04 am
thanks a million for the quick responses! using "" did the trick for me :-) now back to scripting =) (just discovered this mq thing =)
-
A_Druid_00
- Macro Maker Extraordinaire
- Posts: 2378
- Joined: Tue Jul 13, 2004 12:45 pm
- Location: Rolling on the Lawn Farting
Post
by A_Druid_00 » Fri Oct 29, 2004 11:09 am
You're off to a better start than 90% of the first day posters.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]
-
fearless
- Not a Psychic
- Posts: 2684
- Joined: Wed Mar 10, 2004 3:52 pm
Post
by fearless » Fri Oct 29, 2004 11:16 am
90% might be a bit conservitive, 98% might be more in line. :)
Reading . . . it's not just for me.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]
-
A_Druid_00
- Macro Maker Extraordinaire
- Posts: 2378
- Joined: Tue Jul 13, 2004 12:45 pm
- Location: Rolling on the Lawn Farting
Post
by A_Druid_00 » Fri Oct 29, 2004 11:25 am
The other 8% of my 90% figure are the ones that are dumb enough to ask stupid questions, but smart enough not to post them on these boards.
You'd be surprised the number of odd PMs I get, considering how little I actually know about MQ. I guess I put on a good front or something.
[quote]<DigitalMocking> man, A_Druid_00 really does love those long ass if statements
<dont_know_at_all> i don't use his macro because i'm frightened of it[/quote]
[quote][12:45] <dont_know_at_all> never use a macro when you can really fuck up things with a plugin[/quote]
-
fearless
- Not a Psychic
- Posts: 2684
- Joined: Wed Mar 10, 2004 3:52 pm
Post
by fearless » Fri Oct 29, 2004 11:34 am
Very good point.
Reading . . . it's not just for me.
[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]
-
dont_know_at_all
- Developer

- Posts: 5450
- Joined: Sun Dec 01, 2002 4:15 am
- Location: Florida, USA
-
Contact:
Post
by dont_know_at_all » Fri Oct 29, 2004 5:00 pm
A_Druid_00 wrote:You'd be surprised the number of odd PMs I get, considering how little I actually know about MQ. I guess I put on a good front or something.
If you rend a noob limb from limb in front of the other noobs, they tend to fall in line.