Page 1 of 1

Shared functions?

Posted: Fri Jan 08, 2010 2:21 am
by exheusden
Is there some equivalent in Revolution Media of shared functions, as used in SuperCard? Routines that might be useful in different projects, stored at a single place, outside those projects?

For example, I have a routine I use to convert characters in a passed text to HTML entities (perhaps this exists in some other form in RM, but it's just used as an example here) that I call from various places: handy when a change is needed.

(Aaarrgh, I wanted to see if a similar routine already existed in RM and it' went into beachball mode when I clicked on Dictionary. Why does this happen so often?)

Re: Shared functions?

Posted: Fri Jan 08, 2010 7:49 am
by FourthWorld
While Rev has no single shared library like SC's sharedScript, you can make any number of libraries and have them automatically brought into use at startup - see Development->Plugins

This article provides a summary of options for extending the Rev message path:


Extending the Runtime Revolution Message Path:
An introduction to using Libraries, FrontScripts, BackScripts and Behaviors
in Runtime Revolution's RevTalk Programming Language
http://fourthworld.com/embassy/articles ... _path.html

Re: Shared functions?

Posted: Fri Jan 08, 2010 11:34 am
by exheusden
Thank you for the reply. I'm using Revolution Media 4.0 and, although there is a menu Development, there is no men-item Plugins under it. I take it this is only available in the more advanced versions of Revolution.

Re: Shared functions?

Posted: Fri Jan 08, 2010 6:17 pm
by FourthWorld
Ah yes, sorry I missed that this thread is in the RevMedia section.

Not sure why RevMedia doesn't provide a UI for plugins, but you can use any stack as a library and bring it into use by adding this line to the stacks you want to use it in:

start using "MyNiftyTools.rev"

Re: Shared functions?

Posted: Fri Jan 08, 2010 9:48 pm
by exheusden
Okay!

Re: Shared functions?

Posted: Sat Jan 09, 2010 12:36 pm
by exheusden
MyNiftyTools.rev: I've searched RevOnLine and also done a Google search (which only brings up this thread), but can find no other reference to it.

Re: Shared functions?

Posted: Sat Jan 09, 2010 1:06 pm
by bn
Exheusden,

MyNiftyTools.rev was supposed to be a placeholder name for any stack you want. Just create a stack, name it what you want, fill its stack script with the functions and commands you want as a library, then "start using ExheusdenNiftyTools.rev" stack. You might want to look up the message hierarchy in the user guide page 135, and in the dictionary the "start using", "stacksinuse" and the "See also" references for the respective keywords.
regards
Bernd

Re: Shared functions?

Posted: Sat Jan 09, 2010 1:29 pm
by exheusden
Excellent, Bernd. Works a charm. Thank you very much.