Help with Slash commands, particularly /clr

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Help with Slash commands, particularly /clr

Post by Raoden »

It's pretty simple to make a macro button that contains simply the code "/clr" to clear the Chat panel. In fact, it's one of the few things I've found so far that seem like they should be Global macros. (As a side note, I'm curious what other people use Global for.)

But I'd like to add a link or button to a Frame that clears the chat panel, too, and I can't figure out how.

Any macro I try to call from within a Frame simply outputs the literal text "/clr" to the chat. Which would be awfully handy if I actually wanted to type that without executing the Clear command. :roll:

I've tried calling the "/clr" macro by HTML form, and by macroLink. I've tried changing the called macro to

Code: Select all

[r: execMacro( "/clr" )]

and similar things. None of it works.

I know other slash commands can work in called macros, such as /self or /gm, as long as the slash command is the first thing in the macro's code; so why doesn't /clr work?
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
Mathemagician
Dragon
Posts: 666
Joined: Tue May 22, 2007 2:27 pm

Re: Help with Slash commands, particularly /clr

Post by Mathemagician »

I don't have an answer to your question about /clr, but I can comment on the use of global macros.

I use token macros for all things specific to the player's token (attack rolls, etc).
I use campaign macros for all things that are common to each player, eg, Start Turn / End Turn, a "view my abilities / equipment" button, a "spend healing surge" button (we play 4e), and a "describe a monster" button.

I use global macros for everything DM related, such as damaging / healing HP, applying status effects. These all could be put on a "DM" token, but, I don't want to constantly switching over to impersonate that token just to access macros that I use multiple times during every token's turn.

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: Help with Slash commands, particularly /clr

Post by CoveredInFish »

Slash-commands must be the first characters in the macro. Since [wfunc]macroExec[/wfunc] "includes" the macro in the running macro it wont be the first ...

I would try if deferring the macro execution would help ([wfunc]execLink[/wfunc]).

User avatar
aliasmask
Deity
Posts: 8609
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Help with Slash commands, particularly /clr

Post by aliasmask »

I don't think you can do that. I tried the deferred method and it doesn't work. I think the slash commands are outside of the macro execution and only the first line is checked when running the parser before execution. (that's my guess). Someone will have to come up with a function and add it to MT to get a call from a frame or link to work, [wfunc]clr[/wfunc].

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Help with Slash commands, particularly /clr

Post by Raoden »

Yeah, I forgot to mention it in the OP, but I did try the deferred execLink. Didn't work.

Alias, I don't understand your explanation of why it doesn't work, still. So the parser only checks the first line for slash commands ... fine. But my slash commands are in the first line. :?
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
aliasmask
Deity
Posts: 8609
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Help with Slash commands, particularly /clr

Post by aliasmask »

The first line of a macro isn't always the first line of execution. ie Joe: call Bob; Bob: clear screen. When I call Joe, Bob with try to clear the screen, but can't. Now if I call bob directly, he still can't clear the screen because the act of calling bob is the first executable action. Clicking links is not the same thing as clicking a macro button in the execution process. Basically, I can't call bob. I have to walk over to his house and ask him to clear the screen :). The macro button represents Bob's house.

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Help with Slash commands, particularly /clr

Post by Raoden »

Hmmmm, I didn't think that explanation could be the whole story based on other threads I've read, where people were advised to put slash commands like /self in the first line of some called macros. But I played around with it some more today, and it seems those don't work in called macros either. So apparently slash commands in general only work if the button is actually clicked on.

That's unfortunate, but it makes a little more sense.

I guess now I'd like one of the following features added to MapTool:
  1. Slash commands usable in called macros
  2. macro functions that duplicate the effects of commands like /im and /clr
  3. MetaMacro functions that let you create new Global macro buttons, allowing you to indirectly give a user the option to use slash commands that way
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
Azhrei
Site Admin
Posts: 12058
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Help with Slash commands, particularly /clr

Post by Azhrei »

Raoden wrote:Hmmmm, I didn't think that explanation could be the whole story based on other threads I've read, [...]

I guess now I'd like one of the following features added to MapTool:
  1. Slash commands usable in called macros
  2. macro functions that duplicate the effects of commands like /im and /clr
  3. MetaMacro functions that let you create new Global macro buttons, allowing you to indirectly give a user the option to use slash commands that way

If you've read other threads about it then you've probably already seen these answers:

1. Won't happen.
2. Won't happen (at least for /im, but I suppose /clr is possible)
3. Already done; see the Metamacro category on the wiki

Edit: Looks like #3 only applies to creating macros on the current token. Perhaps the Global and Campaign panels should be parameters? :?

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Help with Slash commands, particularly /clr

Post by Raoden »

Azhrei wrote:1. Won't happen.
2. Won't happen (at least for /im, but I suppose /clr is possible)
3. Already done; see the Metamacro category on the wiki

Edit: Looks like #3 only applies to creating macros on the current token. Perhaps the Global and Campaign panels should be parameters? :?

Sounds good. I know I'm not the first one to mention that it would be nice to be able to write Macros to the Global and Campaign panels (as parameters to the existing metamacro functions); I've seen the request somewhere before. (Biodude's Batch Macro Editing thread, maybe?) I would love to see that happen.

If [wfunc]clr[/wfunc] was added too, that would just be icing on the cake.

Thanks for being so open about feature requests as always, Az!
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

prestidigitator
Dragon
Posts: 317
Joined: Fri Apr 23, 2010 8:17 pm

Re: Help with Slash commands, particularly /clr

Post by prestidigitator »

Umm. Why would you need a macro to create a campaign macro? Doesn't every connected player have access to campaign macros? Set it up once for each campaign, and you should be good. :?:
"He knows not how to know who knows not also how to un-know." --Sir Richard Burton

User avatar
Azhrei
Site Admin
Posts: 12058
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Help with Slash commands, particularly /clr

Post by Azhrei »

Heh, good point. ;)

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Help with Slash commands, particularly /clr

Post by Raoden »

prestidigitator wrote:Umm. Why would you need a macro to create a campaign macro? Doesn't every connected player have access to campaign macros? Set it up once for each campaign, and you should be good. :?:

  1. So you can dynamically change a Campaign macro mid-campaign.
  2. In case the "all players receive campaign macros" server option is turned off.

I'm not sure I'll ever have either of these situations come up ... but it wouldn't hurt to have the option, just in case.
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
Azhrei
Site Admin
Posts: 12058
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: Help with Slash commands, particularly /clr

Post by Azhrei »

Raoden wrote:
prestidigitator wrote:Umm. Why would you need a macro to create a campaign macro? Doesn't every connected player have access to campaign macros? Set it up once for each campaign, and you should be good. :?:

  1. So you can dynamically change a Campaign macro mid-campaign.
  2. In case the "all players receive campaign macros" server option is turned off.
I'm not sure I'll ever have either of these situations come up ... but it wouldn't hurt to have the option, just in case.

Having an option that no one uses is the opposite of "wouldn't hurt" from the programmer's point of view. It represents code that has to be maintained once it's in the code base and if no one is using it...

User avatar
Raoden
Dragon
Posts: 381
Joined: Fri Dec 18, 2009 2:33 am
Location: San Diego

Re: Help with Slash commands, particularly /clr

Post by Raoden »

OK. Well, I do want the Global option. I'm just guessing, and could easily be very wrong, but I'm thinking it's not so much harder to allow the Campaign option if the Global option is already getting added.

And come to think of it, the Biodude (?) thread I mentioned before definitely wanted the Campaign option.
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0

User avatar
biodude
Dragon
Posts: 444
Joined: Sun Jun 15, 2008 2:40 pm
Location: Montréal, QC

Re: Help with Slash commands, particularly /clr

Post by biodude »

prestidigitator wrote:Umm. Why would you need a macro to create a campaign macro? Doesn't every connected player have access to campaign macros? Set it up once for each campaign, and you should be good. :?:


The main reason I wanted it was to facilitate campaign set-up. My Framework has a Lib:Token, which also contains all the 'Interface macros' intended for Campaign Macros (or Token Macros). I wanted an easy way to copy them all over to a destination: copying them to tokens is straightforward, but there is no way to copy them all over to the Campaign (or Global) macros from within a 'set-up' macro.

I currently get around this by exporting the Campaign macros as a 'macro set', which works well enough: I was just hoping to cut out the need for this extra step.

Being able to change Campaign Macros during the campaign would also be handy to people: I've seen others manipulate macros to indicate when they've been used, or other aspects of a macro's 'status'.
"The trouble with communicating is believing you have achieved it"
[ d20 StatBlock Importer ] [ Batch Edit Macros ] [ Canned Speech UI ] [ Lib: Math ]

Post Reply

Return to “Macros”