RPTools.net

Discussion and Support

Skip to content

It is currently Wed Nov 22, 2017 5:24 pm 






Reply to topic  [ 6 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Kobold
 
Joined: Thu Oct 19, 2017 11:36 am
Posts: 22
 Post subject: Hidden Macro and CSS macro within non lib tokens.
PostPosted: Thu Nov 02, 2017 6:54 am 
Hello everyone!

I would have 2 questions about macros:

1/ can you have hidden macros, callable from other macros but without any button ?

2/ can a token macro be a CSS macro ?
I tried to use CSS macros from tokens. I never managed to do it while embedding the CSS macro into the token. The only method that worked for me was using the "myCSS@Lib:Charactersheet" macro from the DnD 5e framework.

Code:
  <link rel='stylesheet' type='text/css' href='myCSS@Lib:CharacterSheet'></link>


is working, but

Code:
  <link rel='stylesheet' type='text/css' href='mySpell@[r: getMacroLocation()]'></link>


Does not work (before you asked, I created a CSS mySpell macro in the token with the same CSS code.

I was reading http://www.lmwcs.com/rptools/wiki/Intro ... and_Frames

Cheers,


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7949
Location: Bay Area
 Post subject: Re: Hidden Macro and CSS macro within non lib tokens.
PostPosted: Thu Nov 02, 2017 7:38 am 
1) Yes, you can use Wiki: evalMacro() to execute a string as a macro. The source of the string can be from anywhere like a hidden property.

2)Not completely sure what you mean by CSS macro, but stylesheets can only be done within a frame or dialog, not the chat. There are some limits in the stylesheet having to do with the format when using {}'s. But I think your problem may be permission related. Make sure the macro has edit by players unchecked.

edit: A note about non-lib tokens, certain function don't work if not run from a lib token macro because of permissions. This prevents players from doing stuff not allowed by the GM.

_________________
Downloads:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Oct 19, 2017 11:36 am
Posts: 22
 Post subject: Re: Hidden Macro and CSS macro within non lib tokens.
PostPosted: Thu Nov 02, 2017 8:56 am 
Thank for the quick answer !

1/ this is great, exactly what I need

2/ A CSS macro is a macro that contain only CSS code and may be used within another macro html code as stylesheet. I'll check those permissions, could be that.

Edith: well I took a look at maptool src code, it seems that CSS macro are searched only in lib tokens. That's more or less enforced by the design.


Code:
void handleLinkTag(MutableAttributeSet attributes) {
  Object href = attributes.getAttribute(HTML.Attribute.HREF);
  String[] vals = href.toString().split("@");
  String cssText = MapTool.getParser().getTokenLibMacro(vals[0], vals[1]);


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7949
Location: Bay Area
 Post subject: Re: Hidden Macro and CSS macro within non lib tokens.
PostPosted: Thu Nov 02, 2017 9:22 am 
There's actually nothing special about the "css macro". You can put code in there as well, but when the stylesheet is read it expects the output to be valid, for example, your style sheet could be this:

Code:
[r: "
   .col1 {text-align:right}
   .col2 {font-weight:bold}
   td {width:100px}
"]

_________________
Downloads:


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7949
Location: Bay Area
 Post subject: Re: Hidden Macro and CSS macro within non lib tokens.
PostPosted: Thu Nov 02, 2017 9:25 am 
If you want to avoid that, you can just put the style tag in your output, but you need to do like I do here: viewtopic.php?f=3&t=25158&p=255111&hilit=stylesheet#p253059

_________________
Downloads:


Top
 Profile  
 
 Offline
Kobold
 
Joined: Thu Oct 19, 2017 11:36 am
Posts: 22
 Post subject: Re: Hidden Macro and CSS macro within non lib tokens.
PostPosted: Thu Nov 02, 2017 10:15 am 
I guess the [r: ] decoration is for escaping {}, that's rather ... unconventional.

Anyway this works great. Thanks a lot.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 6 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman