Basic Properties question(s)

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. :)
User avatar
JML
Dragon
Posts: 515
Joined: Mon May 31, 2010 7:03 am
Location: Blagnac, France

Re: Basic Properties question(s)

Post by JML »

Sorry Azhrei, but my coding times are a bit behind me now. I've got to get back to it :oops:

So, if I did understand you well, and that seems to make sense to me, getProperty() is waiting for a variable name as first parameter, which means a string.

When you use an unquoted variable, MT evaluates it. If the result is a string, every thing is OK.

In my example, HeureNaissance variable being:

Code: Select all

HeureNaissance (HN):[r: Fatigue = floor((FORCE + AGILITE) / 2)] 
Evaluation of :

Code: Select all

[r: Fatigue = floor((FORCE + AGILITE) / 2)]  
gives no output, thus an empty string in first parameter.

So getProperty() has got no property name to use and returns nothing.

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

Re: Basic Properties question(s)

Post by Azhrei »

Yep, that's it. :)

User avatar
JML
Dragon
Posts: 515
Joined: Mon May 31, 2010 7:03 am
Location: Blagnac, France

Re: Basic Properties question(s)

Post by JML »

JML wrote:When you use an unquoted variable, MT evaluates it.
Am I right thinking MT evaluates whatever is not between quotes? Saying it another way, MT thinks anything out of quotes is Mscript?

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Basic Properties question(s)

Post by wolph42 »

JML wrote:
JML wrote:When you use an unquoted variable, MT evaluates it.
Am I right thinking MT evaluates whatever is not between quotes? Saying it another way, MT thinks anything out of quotes is Mscript?
Yup. Just as the other way round:anything between quotes is viewed as as a string. With the exception of Wiki: strformat() although technically that function 'evaluates' a string just like Wiki: eval() only differently.

User avatar
JML
Dragon
Posts: 515
Joined: Mon May 31, 2010 7:03 am
Location: Blagnac, France

Re: Basic Properties question(s)

Post by JML »

wolph42 wrote:Just as the other way round:anything between quotes is viewed as as a string.
Which brings me to a crazy thought. Given the commenting limitations in MT, that is to say comments are still evaluated, did someone tried to just enclose comment content in a string so it's not being executed ?

Like this:

Code: Select all

<!--"Comment"--> 

chaossdragon
Giant
Posts: 145
Joined: Tue Jul 05, 2011 10:18 pm

Re: Basic Properties question(s)

Post by chaossdragon »

JML wrote:
wolph42 wrote:Just as the other way round:anything between quotes is viewed as as a string.
Which brings me to a crazy thought. Given the commenting limitations in MT, that is to say comments are still evaluated, did someone tried to just enclose comment content in a string so it's not being executed ?

Like this:

Code: Select all

<!--"Comment"--> 
have you tried other comment methods?

Code: Select all

//-- like this --// 
[h: '<!-- or this -->'] 

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Basic Properties question(s)

Post by wolph42 »

The latter is the one I use and which I can recommend. Point is that any other form WILL be ported to the chat (but does not show) and will thus increase stack use.

User avatar
JML
Dragon
Posts: 515
Joined: Mon May 31, 2010 7:03 am
Location: Blagnac, France

Re: Basic Properties question(s)

Post by JML »

OK, thank you guys.

Test done:
The following executes:

Code: Select all

<!-- [r: Strength = 5] -->
<!-- "[r: Strength = 5]" -->
 
The following don't:

Code: Select all

[h: "<!-- [r: Strength = 5] -->"] 
The following just brings an error, as the first "/" is interpreted as introducing a chat command:

Code: Select all

// [r: Strength = 5] //   

Post Reply

Return to “MapTool”