The Cartooners Posted August 17, 2008 Share Posted August 17, 2008 I have a function within the Author section of the lua file. How do I call it from an event? Thanks in advance. Quote Link to comment
Ranger Fox Posted August 17, 2008 Share Posted August 17, 2008 Call it the same as you would any other function. There isn't anything different or isolated about the sections in the lua file. It looks that way because it's well organized. Take care that the Builder doesn't modify the line of code that calls your author function. To prevent this, I usually move the entire event to the Author Functions section. Assuming the Builder doesn't overwrite the method call, here's an example: In the Author Functions section: function SayHi() Wherigo.MessageBox{Text="Hi"} end In the Wherigo event section (or somewhere else in my Author Functions section): function zoneMyZone:OnEnter() -- #GroupDescription=My Zone -- -- #Comment=My Zone Comment -- SayHi() end Quote Link to comment
The Cartooners Posted August 17, 2008 Author Share Posted August 17, 2008 Call it the same as you would any other function. There isn't anything different or isolated about the sections in the lua file. It looks that way because it's well organized. Take care that the Builder doesn't modify the line of code that calls your author function. To prevent this, I usually move the entire event to the Author Functions section. Assuming the Builder doesn't overwrite the method call, here's an example: In the Author Functions section: function SayHi() Wherigo.MessageBox{Text="Hi"} end In the Wherigo event section (or somewhere else in my Author Functions section): function zoneMyZone:OnEnter() -- #GroupDescription=My Zone -- -- #Comment=My Zone Comment -- SayHi() end Thanks for the reply. Is there a way of doing this through the builder or does it have to be hand cranked. Quote Link to comment
Ranger Fox Posted August 18, 2008 Share Posted August 18, 2008 Text editor time! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.