Why does "Result" get special rendering in macro editor?

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
Charlweed
Kobold
Posts: 12
Joined: Thu Apr 16, 2015 3:14 pm

Why does "Result" get special rendering in macro editor?

Post by Charlweed »

I'm trying to debug some old macros that my buddy wrote. We have been using 1.4.0.5 for years, and are now upgrading to 1.5.14. I just noticed that the assignments to the variable "Result", are rendered in a bold font, and colored rust, unlike other assignments. In other words (something like):

[h: Result = if (Roll >= 18, Result + "<font color=red>CRITICAL HIT!</font>", Result)]
[h: macro.return = Result]

instead of:

[h: localResult = if (Roll >= 18, localResult + "<font color=red>CRITICAL HIT!</font>", localResult )]
[h: macro.return = localResult]

Why is this?
Attachments
rth_woes_00.txt
(3.08 KiB) Downloaded 21 times

Merudo
Giant
Posts: 228
Joined: Wed Jun 05, 2019 7:06 am

Re: Why does "Result" get special rendering in macro editor?

Post by Merudo »

Result is a key word, used to only display the result of a roll. It is often abbreviated as "r".

Example:
[1 + 1]
displays "« 1 + 1 = 1 + 1 = 2 »", but
[result: 1 + 1]
displays 2.

Charlweed
Kobold
Posts: 12
Joined: Thu Apr 16, 2015 3:14 pm

Re: Why does "Result" get special rendering in macro editor?

Post by Charlweed »

Thanks!

That makes me infer that "Result" is a poor choice as a variable identifier. Are there known issues with using key words as identifiers?

User avatar
metatheurgist
Dragon
Posts: 364
Joined: Mon Oct 26, 2009 5:51 am

Re: Why does "Result" get special rendering in macro editor?

Post by metatheurgist »

Are there known issues with using key words as identifiers?
Yes, don't do it.

Charlweed
Kobold
Posts: 12
Joined: Thu Apr 16, 2015 3:14 pm

Re: Why does "Result" get special rendering in macro editor?

Post by Charlweed »

Got it!
TY!

Post Reply

Return to “MapTool”