Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Really Simple Question About Rules (Read 7202 times)
Joshua Brown
Full Member
*
Offline



Posts: 25
Eugene, Oregon
Really Simple Question About Rules
Jan 02nd, 2010, 9:09am
 
Hi Everyone,

I have a really simple question, can one store a rule in a note?  If so, how do you call the rule? If not, what does everyone do about long rules?

Thanks!

Josh
Back to top
 
 
joshuawesleybrown jwbatscu   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Really Simple Question About Rules
Reply #1 - Jan 2nd, 2010, 10:07am
 
There are a whole host of unstated assumtions in your questions, which I   guess are based on things you tried that didn't work.

A rule is a special context for action code - it is a snippet of action code that each note appliees to itself.  It is the the \'note's "Rule" attribute, in code referred to a $Rule. To make it easy for less code-centric folk to write rules, you will find a Rule input box in the create/rename dialog for Notes, Agents and Adornments.

In action code, Note A can refer to Note B's Rule thus: $Rule(Note B). notice that you simply add the other note's name - without quotes - either as just a name or as a path (should the name alone be ambiguous).

If the problem is that your code is too long to all fit in a dialog input box see this article on using long sections of code.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Joshua Brown
Full Member
*
Offline



Posts: 25
Eugene, Oregon
Re: Really Simple Question About Rules
Reply #2 - Jan 2nd, 2010, 10:12am
 
Thank you Mark, the article was exactly what I was looking for!

Josh
Back to top
 
 
joshuawesleybrown jwbatscu   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Really Simple Question About Rules
Reply #3 - Jan 2nd, 2010, 10:15am
 
Good!  I find the 'long code' trick of using another note's $Text as a storage place really helps when developing complex code, e.g. with lots of nested if(){} calls.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Joshua Brown
Full Member
*
Offline



Posts: 25
Eugene, Oregon
Re: Really Simple Question About Rules
Reply #4 - Jan 2nd, 2010, 10:44am
 
Mark,

One last question in the same vein Smiley There's not a comment syntax for action code is there?  My search of the wiki and atbref have come up empty.  Thanks for all your help!

Josh
Back to top
 
 
joshuawesleybrown jwbatscu   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Really Simple Question About Rules
Reply #5 - Jan 2nd, 2010, 11:07am
 
How about ^comment^?
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Joshua Brown
Full Member
*
Offline



Posts: 25
Eugene, Oregon
Re: Really Simple Question About Rules
Reply #6 - Jan 2nd, 2010, 1:21pm
 
Mark,

That seems to work per my simple tests. Thank you for all your help.  Just a note, the vast majority of examples I had come across used that in the context of HTML exports.  As a consequence, I had assumed that it was only a syntax for HTML exports and not for action script in general.  

I know you do a lot with the wiki and atbref, it would be great if you could clarify that ^comment^ can be used as a general comment syntax... that'd just be awesome!  If I can edit that in some way I will too.

Josh
Back to top
 
 
joshuawesleybrown jwbatscu   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Really Simple Question About Rules
Reply #7 - Jan 2nd, 2010, 2:55pm
 
Good point, when I read my notes for ^comment^ - probably a few years old I wasn't sure myself.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Really Simple Question About Rules
Reply #8 - Jan 2nd, 2010, 7:28pm
 
Well, I re-tested and ^comment(This is a comment)^ exports as an HTML comment:
  <!-- This is a comment -->
I've updated aTbRef accordingly.

So, I think if you want to comment your action code, you'll need to keep a separate annotated copy in a different note or attribute.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Joshua Brown
Full Member
*
Offline



Posts: 25
Eugene, Oregon
Re: Really Simple Question About Rules
Reply #9 - Jan 2nd, 2010, 8:35pm
 
Thanks for the extra testing Mark!  

In that case let me put in a feature request:  Comment syntax for action script!

Josh
Back to top
 
 
joshuawesleybrown jwbatscu   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Really Simple Question About Rules
Reply #10 - Jan 3rd, 2010, 1:09am
 
Before committing to implementation, I'd like to see an example of some Tinderbox actions where the comment makes the action clearer.

This might very well be useful, but some convincing examples would be welcome. Feel free to email bernstein@eastgate.com, or leave them here.
Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print