'bug' or not? [b87]

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
User avatar
wolph42
Deity
Posts: 9779
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

'bug' or not? [b87]

Post by wolph42 »

I was working on my back of tricks and decided to remove the
[h:''] from the [h:'<!-- bla -->'], so you're left with <!-- bla -->, however it turns out that this ports a blank line to the chat. E.g. run this macro

Code: Select all

<!-- Test -->
and you'll notice that a blank line is shown in the chat.

I've been using the [h:] for so long that I don't even know if this is supposed to happen, but obviously this is 'unwanted' behaviour. E.g. in ontokenmove now every time you move a token a blank line is added to the chat...

The main reason to remove the [h:''] is because its significantly faster.

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

Re: 'bug' or not? [b87]

Post by aliasmask »

Yeah, html comments are still sent to output, but you just don't see them. So, if the comment is in onTokenMove, then you should use the [H: ], but if not and it's a called UDF then you should set it to ignore output. I try to keep the onTokenMove hook as small as possible. By default, all my UDFs have ignore output set.

Code: Select all

@@ @onMultipleTokensMove
[H: ids = macro.args]
[
H, if(am.play.doVBLMove(ids)), code: {
   [H: tokens.denyMove = 1]
   [H: am.play.VBLMove(ids)]
};{}]

!!
@@
 @onTokenMove
[H: id = currentToken()]
[
H, if(tokens.moveCount <= 1 && am.play.doVBLMove(id)), code: {
   [H: tokens.denyMove = 1]
   [H: am.play.VBLMove(id)]
};{}]

!!
@@
 @doVBLMove
[H: ids = arg(0)]
[
H: doVBLMove = 0]
[
H: counter = 0]
<!--
 ignore if vision is off for map -->
[
H: mapVisionOn =  if(json.get(getInfo("map"),"vision type") != "off",1,0)]
[
H, if(json.type(ids) == "ARRAY"): ids = json.toList(ids)]
[
H: numIds = listCount(ids)]
[
H, while(! doVBLMove && counter < numIds && mapVisionOn), code: {
   [H: id = listGet(ids,counter)]
   [H: switchToken(id)]
   [H: name = lower(getName())]
   <!-- only need one valid token to use VBLMove macro -->
   [H, if(! startsWith(name,"lib:") && ! startsWith(name,"image:")): doVBLMove = 1]
   [H: counter = counter + 1]
}]
[
H: macro.return = doVBLMove]

!!
 


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

Re: 'bug' or not? [b87]

Post by CoveredInFish »

Yeah, this is expected behaviour. Days ago any macro would cause an output line to appear. Then one lone but knowadays forgotten hero appeared and he mangled some code so that macro creating no output were from now on hindered to cause that line. The hero was wise and great but he couldnt see the difference between output and comments as before the html parser all was one.

Winter
Giant
Posts: 156
Joined: Wed Apr 22, 2009 7:24 pm
Location: Chicago, IL

Re: 'bug' or not? [b87]

Post by Winter »

Thanks much for the information about the blank output line and the caution about the size of onTokenMove calls. It'll help keep my framework clean and responsive.

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

Re: 'bug' or not? [b87]

Post by Azhrei »

CoveredInFish wrote:Then one lone but knowadays forgotten hero appeared [...]

Help us, Obiwan Kenobi. You're our only hope.

Post Reply

Return to “MapTool”