Does "call" in automacros not support parameters?

All about the macro plugin can be found in this forum. This forum is intended for the macro plugin only.

Moderator: Moderators

iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG

Re: Does "call" in automacros not support parameters?

#11 Post by iMikeLance »

Implemented:

Revision: 8592
Author: marcelofoxes
Date: quarta-feira, 22 de maio de 2013 06:02:27
Message:
* implemented arguments in macro calls (not tested with automacros "call", don't know if it will work)
* arguments parser now supports quoted arguments
----
Modified : /plugins/macro/trunk/Macro/Script.pm
Modified : /plugins/macro/trunk/macro.pl

These macros:

Code: Select all

macro callmemaybe {
	# call this macro two times with these arguments
	call meMaybe 2 --Hey "I just met you" "And" "this is crazy"
}

macro meMaybe {
	[
	$i++
	log This is the $i º time i'll sing for you
	log $.param1
	log $.param2
	log $.param3
	log $.param4
	]
}
Will output this:

Code: Select all

macro callmemaybe
[macro log] This is the 1 º time i'll sing for you
[macro log] Hey
[macro log] I just met you
[macro log] And
[macro log] this is crazy
[macro log] This is the 2 º time i'll sing for you
[macro log] Hey
[macro log] I just met you
[macro log] And
[macro log] this is crazy
Using "macro <name> --<arguments>" in kore's console should work with the same syntax
crasherkie
Noob
Noob
Posts: 7
Joined: 25 Apr 2013, 01:52
Noob?: Yes

Re: Does "call" in automacros not support parameters?

#12 Post by crasherkie »

iMikeLance wrote:Implemented:

Revision: 8592
Author: marcelofoxes
Date: quarta-feira, 22 de maio de 2013 06:02:27
Message:
* implemented arguments in macro calls (not tested with automacros "call", don't know if it will work)
* arguments parser now supports quoted arguments
----
Modified : /plugins/macro/trunk/Macro/Script.pm
Modified : /plugins/macro/trunk/macro.pl

These macros:

Code: Select all

macro callmemaybe {
	# call this macro two times with these arguments
	call meMaybe 2 --Hey "I just met you" "And" "this is crazy"
}

macro meMaybe {
	[
	$i++
	log This is the $i º time i'll sing for you
	log $.param1
	log $.param2
	log $.param3
	log $.param4
	]
}
Will output this:

Code: Select all

macro callmemaybe
[macro log] This is the 1 º time i'll sing for you
[macro log] Hey
[macro log] I just met you
[macro log] And
[macro log] this is crazy
[macro log] This is the 2 º time i'll sing for you
[macro log] Hey
[macro log] I just met you
[macro log] And
[macro log] this is crazy
Using "macro <name> --<arguments>" in kore's console should work with the same syntax
Cool..someone tested this already in an automacro call? ima can't test this right now cause im in cp mode... i want to see result..
Good Job you got there.. nice 8-) :lol:

PS: i just notice this a while back.

Code: Select all

macro callmemaybe {
	# call this macro two times with these arguments
	call meMaybe 2 --Hey "I just met you" "And" "this is crazy"
}
whats the point of putting the number "2" after the macro name? just wanted to know this
iMikeLance
Moderators
Moderators
Posts: 208
Joined: 01 Feb 2010, 17:37
Noob?: No
Location: Brazil - MG

Re: Does "call" in automacros not support parameters?

#13 Post by iMikeLance »

crasherkie wrote: PS: i just notice this a while back.

Code: Select all

macro callmemaybe {
	# call this macro two times with these arguments
	call meMaybe 2 --Hey "I just met you" "And" "this is crazy"
}
whats the point of putting the number "2" after the macro name? just wanted to know this
This number 2 makes the called macro repeat itself 2 times. You can just ignore it and use call macroname --arguments
EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Does "call" in automacros not support parameters?

#14 Post by EternalHarvest »

my @new_params = $cparms =~ /"[^"]+"|\S+/g;
How about Utils::parseArgs?
crasherkie
Noob
Noob
Posts: 7
Joined: 25 Apr 2013, 01:52
Noob?: Yes

Re: Does "call" in automacros not support parameters?

#15 Post by crasherkie »

iMikeLance wrote:
crasherkie wrote: whats the point of putting the number "2" after the macro name? just wanted to know this
This number 2 makes the called macro repeat itself 2 times. You can just ignore it and use call macroname --arguments
thx for the explanation.. forgot about that parameters of macro.. thx for the update...