Calling macros: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
(added some text)
Line 17: Line 17:




==User Define Function==
==User Defined Function==
 
In the forums often encountered as UDF. This is probably the most convenient way when you do complex coding.




See also [[Library Token]], [[onCampaignLoad]] and {{func|defineFunction}} (and {{func|arg}}, {{func|argCount}}).


See also [[Library Token]], [[onCampaignLoad]] and {{func|defineFunction}} (and {{func|arg}}, {{func|argCount}}).
A good read is aliasmask's version of automated UDF-creation: [http://forums.rptools.net/viewtopic.php?f=20&t=19856#p209019m see post]


==Macro Links==  
==Macro Links==  
When you want to call macros on user reaction you can sent out clickable links to the chat or into frames. This way is also to be used if you want to work with html forms or the fancier form-based events.




Line 31: Line 33:


==Evaluate A Macro==
==Evaluate A Macro==
Never used this much.




See also {{func|evalMacro}}, {{func|execMacro}}
See also {{func|evalMacro}}, {{func|execMacro}}

Revision as of 06:54, 23 June 2012


 This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.

Calling macros from a macro

Sometimes you want to call a macro from a macro. When you are a coder you want this really often. It enables you to split your code in small, simple chunks and reuses it over and over again.

This is a handy technique to keep stack size requirement low and to get rid of large code-level-nesting.

There are four ways to do so.


The macro roll option

See also [macro():], macro.return, macro.args.


User Defined Function

In the forums often encountered as UDF. This is probably the most convenient way when you do complex coding.


See also Library Token, onCampaignLoad and defineFunction() (and arg(), argCount()).

A good read is aliasmask's version of automated UDF-creation: see post

Macro Links

When you want to call macros on user reaction you can sent out clickable links to the chat or into frames. This way is also to be used if you want to work with html forms or the fancier form-based events.


See also macroLink(), macroLinkText().


Evaluate A Macro

Never used this much.


See also evalMacro(), execMacro()