Jump to content

Functions and LUA Statements


bflentje

Recommended Posts

I am a .NET developer by trade and consider myself to be fairly intelligent (in regards to coding). But the whole notion of Functions and LUA statements within Wherigos I am really struggling to understand. I think the root cause of my issue is due to lack of comprehensive and centralized documentation.

 

Does anyone have any sources for integrating Function within cartridges, and LUA statements, and a complete API and syntax model for how to use both?

Link to comment

Wherigo uses an event-driven asynchronous model. Zones have events (e.g. OnEnter). These events are wired up simply by being present within the code. For input dialogs, the method call requires a callback to call when the user finishes inputting text. The Wherigo engine will not wait for an input dialog; it will continue running code, including zone events and timers, while a dialog is displayed.

 

My advice to you--and how we all learned the code necessary for Wherigo--is to look at a cartridge's source code. You can either build a cartridge yourself or you can download the code for any open source cartridge. I recommend my Battleship cartridge because it's fairly well commented. Another is The Fox, Chicken, and Feed. There's a section within all cartridges called "author script" (look for the phrase "Author functions go here"). This is where a lot of the fun custom functions are placed.

 

I think objects in lua are more like "objects" in JavaScript. And all variables are of variant type.

 

There's some API documentation on the Wherigo wiki; see my forum signature for the link.

Link to comment

Wherigo uses an event-driven asynchronous model. Zones have events (e.g. OnEnter). These events are wired up simply by being present within the code. For input dialogs, the method call requires a callback to call when the user finishes inputting text. The Wherigo engine will not wait for an input dialog; it will continue running code, including zone events and timers, while a dialog is displayed.

 

My advice to you--and how we all learned the code necessary for Wherigo--is to look at a cartridge's source code. You can either build a cartridge yourself or you can download the code for any open source cartridge. I recommend my Battleship cartridge because it's fairly well commented. Another is The Fox, Chicken, and Feed. There's a section within all cartridges called "author script" (look for the phrase "Author functions go here"). This is where a lot of the fun custom functions are placed.

 

I think objects in lua are more like "objects" in JavaScript. And all variables are of variant type.

 

There's some API documentation on the Wherigo wiki; see my forum signature for the link.

 

Thanks for the information. The top paragraph puts a lot of perspective on some wrong assumptions I was making about how they work.

 

And thanks for the note about the Battleship cartridge. Just last week I played with the one located in the Seattle area in preparation for our pilgrimage to geocaching mecca. I'll have to take a closer look at them both.

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...