Jump to content

Wherigo Ideas


PoppCulture

Recommended Posts

As a newer cacher, I just got started building wherigos, and I am kind of stuck deciding what to make. I have made two so far, Including one that shows exactly how far away the planets would be if the sun was 6 inches in diameter. Any ideas for a cartridge/cache with Wherigo? I could also use some ideas for practice projects that would get me some more experience with wherigos in general and Urwigo, the builder I'm using. One idea I had was to make a big zone in a parking lot that shows a geocache in it somewhere, and you have to wander around the parking lot until it says you're close. Then you log the find!

Link to comment

Some ideas:

 

Come up with a small story like in an RPG.  At one point, the player has an option to visit one of three NPCs to retrieve one of their items.  The number of additional stops in the story is affected by the item the player chooses.  Perhaps a player could start off by choosing a sword, wand, or bag.  Based on their choice, the story changes a little.  The sword might require four zones, wand three, and bag five.  It's different.  But doing this will let you practice NPCs, items, and keeping track of where someone is in a story.

 

Perhaps a memory match game.  Players are presented with a 5 x 4 grid of zones.  You go to one and pick up the card.  You then have to go to other zones until you find the matching card.  It could be memory matching if you get one chance before the card returns to its original zone.  This would let you practice items and zone positioning.

 

Some sort of comedy story?  You visit five or six NPCs and choose a punchline to their story from one of three.  You're presented with a score at the end.  If you score high enough (you're funny enough), you get the cache.  This would let you practice NPCs, realizing you should only have around 16 characters for an input's answer, and keeping track of variables.

 

--------

 

Really, though, what I tend to do is visit an area and see what's there.  I fashion a story based on what I see.

Link to comment

Ha, ha!  Yeah, I made that one because someone wanted to see how I'd implement some author script in a simple cartridge.

 

I did, by the way, include an Easter egg.  To test for a game failure condition, we have this function:

--I do not normally make odd function names, but I *AM* having fun here.  Thus, you get an Easter egg.
function DoesRangerFoxEatTonight(zone)

	if zone:Contains(zitemChicken) and zone:Contains(zitemFox) then
		Wherigo.MessageBox{Text=[[Ranger Fox ate your geochicken.  Thank you for the food!]],}
		zitemChicken:MoveTo(nil)
		zitemBones:MoveTo(zone)
	elseif zone:Contains(zitemChicken) and zone:Contains(zitemFeed) then
		Wherigo.MessageBox{Text=[[The chicken ate your feed.  To punish it, feed it to Ranger Fox.]],}
		zitemFeed:MoveTo(nil)
	end

end

 

The reference to a "geochicken" is a direct reference to a cacher of the same name (and casing) in my area.  I thought it a fun nod to him, though I don't remember the last time I saw him at an event.  I more knew of the name than the person.  The rest of the Easter egg is self-explanatory.  The rest of the code is serious.  Unlike my Battleship and Cacher Pursuit cartridges, this one didn't include any comments.

 

As is the case, I had this cartridge sitting around after I created it for the forum.  The statewide geocaching organization was going to have an event in a nearby park that year, so I put out a couple Wherigo geocaches for people to enjoy, this being one of them since I had it.  As far as I can tell, the statewide geocaching organization is now defunct.  Most geocaching organizations in my area are defunct.  We don't see too much new blood, and the number of caches published each year keeps declining.  In another two years, I might have trouble continuing to do a cache a day.  Entropy.

 

Enjoy!

Link to comment

Unfortunately, Urwigo does not have a function to tell if a zone contains an item (that I found), so I made separate variables telling where it was and changed them when I ran the commands to pick up or drop off items. The fun part about making it was that it seemed easy, but as I put it together, it got harder and harder. It was a very fun cartridge to build! 

 

...By the way, do you mind if I use it in my area? It's around Tulsa, OK. 

Link to comment

Here's one: 

A Wherigo version of the board game clue where players travel around to different zones picking up clues on their turn. 

A slightly harder one: A Wherigo version of Uno.

(Anyone can use these ideas)

 

By the way, what do you mean by your projects are open source? Where can I find the code? I kind of want to compare the one I made with yours.

 

Link to comment

Open source:

You can download the source code of any of my Wherigo.com-hosted cartridges from the cartridge's page.  For example, for Battleship, look at the last link in the first column on the page: "Download Source".  Battleship is a good cartridge to look at the source because it's very well documented in the author script section.  Anything I make these days will be well-documented for people to learn from.

 

Clue:

Interesting idea.  The who, what, and where could be randomized when the cartridge starts.  The author could choose where they want the zones and how many, considering I'd say the "where" would always be the zone occupied by the player.  I'd need to review the board game's rules more.  To prevent people from leaving a zone and reentering to make another guess until the cartridge tells them only the zone is wrong (the player would continue to see the only the zone as the wrong guess), I'd force a player to visit another zone prior to making another guess.

 

Let's see...  I'm going to type out my thoughts as I'm thinking of them.  Perhaps it'll be helpful to see my thought process.

  • I want authors to be able to influence the number of zones used in the game.  I can have the cartridge gather all zones upon startup, excluding a specially-named zone.  I could instead create a table of zones by name upon startup.  I think I'll go with the first option because that would require less work from people making their own derived versions.
  • I should handle save states this time.  I typically don't worry about save states, but let's make things more complicated.  I'd need only to save the game's status (in progress or completed) and the solution (who, what, where).  Oh, and so people can't get around the requirement of visiting another zone to make another guess, I'll need to store something about the last zone visited.  These would need to eventually be mapped to string variables for saving.  Restoring would need to reverse the process, converting the string back into the objects (technically, they're lua tables, but I'll call them objects here).
  • I guess I can make the who and what editable for derived versions.  The who can be all NPCs (zCharacter) that exist in the cartridge and what can be all items (zItem) in the cartridge.  Doing things this way will make it easy for authors to create derived cartridges and affect the number of each.  Thus, the who, what, and where will never be known by the code.  The only thing I'll need is a reference to the zone with the cache because this must be excluded from the location list.
  • All messages the cartridge shows must be isolated and configurable so authors making derived works can translate them.  So, again, no hard-coded messages.  When I need to show a name of something, I can either use "{0}" or "@zone" to indicate where I'll insert text.  When I'm making the cartridge, if I'm thinking in a C# mood, I'll use "{0}" due to thinking about String.Replace.  If I'm thinking about Razor, I'll use "@zone" or something.  At the moment, I'm leaning towards "@zone" because that makes it evident with what the text will be replaced.  (I can't say "what the text will be replaced with" because I believe that's a dangling preposition, which is a grammatical error.  If you've wondered why I phrase some things the way I do, it's to avoid errors in grammar.)
  • I could be fancy and have an item that is like the Clue guess sheet.  It would cross off things you've guessed.  I'll be lazy and expect the player to do this.  Supporting this would introduce additional complexity.  I believe I'd handle this by creating one string that would store either a zero or one for what has been guessed.  When saving or restoring state, I could sort all objects alphabetically.  The zeros and ones would align based on the alphabetical order.  Let's not do this.
  • When someone enters a zone, I guess I'll automatically ask for the who and what.  I believe the Garmin Oregon has that fifteen or sixteen character limit with multiple-choice inputs.  I should truncate all who and what names to this maximum safe length.
  • I guess that's about it.

Making something like this might be a nice Christmas present to this community.  The local cachers would hate on me if I were to put one out locally, so I might do so just to mess with them.  They don't know how blessed they are at having so many creative and unusual cartridges in their area.

 

 

Uno:

I'll decline this.  As it's a multiplayer game involving strategy against other players, I'm not sure this would make a good game in Wherigo.  If you could come up with a way to adapt it so it's fun in Wherigo, please outline it.  You can see how I outlined Clue above.

Link to comment

I got through some of the Clue cartridge tonight.  If you're interested in seeing what one of my works in progress looks like, you can see it here.  This is where I'm working on it on my NAS.

https://nas.rangerfox.com/d/s/wO3YQneZGMxKYsazcLYBbLwiF9fsQDP6/_TLg7KRgpKPR8fXryoxsoFJBrOeDQna_-O7egzKMf-Ao

 

The clue.lua file is the cartridge as it currently exists.  The v01.zip and other files like it represent what the cartridge looked like at a certain point in time, for your curiosity.

  • v01.zip = The cartridge as I set it up in the builder, prior to adding any author script
  • v02.zip = Where I am when I posted this.  I have a lot of the major functions created and especially a good deal around guessing a solution.  I have not loaded the cartridge into the emulator at this point because nothing but the zones will be shown.  I don't have zone events wired up.  Most functions have comments about where I need to put things.  I tend to write a function name and then write overall actions that should be taken as comments, then go back and transform them into code.  Doing so allows me to keep my mind on current thoughts.

I might also note that prior to starting to work on this, I had to fix enough of Groundspeak's Builder so I could run it on my Windows 11 laptop.  I still use it to make objects quickly.  Every so often, I reopen the cartridge file in it.  If it opens the cartridge, it means my code syntax is correct and I continue working on the cartridge.  If it shows and error, I'd have to correct something in my code.  That's pretty much what I use the Builder for, then I'll use Webwigo for testing the cartridge.

 

Oh, and I don't live where the coordinates are.  I just put in something somewhat local.

 

I don't know when I'll be able to continue working on this, but we'll see.  I stayed up way too late on a work night, but I'm well-rested anyway, so I'll be fine when I wake in five hours.

Link to comment

I also am working on my own version using Urwigo, so we'll see how that goes. So far I have all the zones and items and I'm working on mixing up the items to create the combination that the player Is trying to figure out. It would be very helpful if Urwigo had list support. I might also try to create other NPCs that play the game along with the player. It will definitely take some time to do that though. 

 

Another of my projects right now is to learn Lua. If anybody else wants to, I recommend Codecademy's free Lua course.

Link to comment

I have the basic game running.  The zones, characters, and items are all fluid and can be changed in a builder.  I'm working on adding text and instructions.  I'll wire these to cartridge variables so someone can change their value directly in a builder.  Perhaps I'll be able to complete this and make it where you can change the content entirely in a builder.

 

You can download and play through the current version if you'd like.  I still haven't added embellishments such as graphics.  That'll be last.  I still have to comment the mess out of the code when I'm done.

 

I'm testing using Webwigo.  One of the suspects is a cacher with the handle "david&diana".  If you select her name, Webwigo returns "david&diana", so I needed to translate that back into regular characters.  I'm not going to make that translation function full-featured.  It'll work for my case.

 

I'm not sure about the concept of NPCs that play alongside the player, what that would look like.

Link to comment

I'll stop here tonight.  Everything but the images seems to be in place.  If you add media to a zone, character, or item, it'll be shown when the incorrect answer is displayed.  Saving and resuming have not yet been implemented.

 

And I made a deviation from the original game, mostly to make it a little more challenging with only one player.  Instead of telling you which of your three guesses is incorrect, it'll just show a random incorrect object.  This prevents someone walking between two zones and methodically trying the next item on the list.

 

You can download the clue.lua file and load it into Webwigo.  The cartridge will print the solution in the log, which is in the bottom-left corner.

 

Let me know what you think and if there should be any modifications to the gameplay.  Once I have feedback, I'll start adding pictures.

 

Yes, I take the role of Mr. Body.  If I place a Wherigo geocache in my own area, I might as well make the game enjoyable by playing into some of the locals' fantasies.

Link to comment

I see you used math.random() and tested for decimals.

 

You can also use math.random(min, max) to return an integer.  Try it out.

 

The way I implemented the random solution is a little interesting:

--Comes up with a random solution
function CreateSolution(game)

    game.Solution.Who = game.Whos[math.random(1, #game.Whos)]
    game.Solution.What = game.Whats[math.random(1, #game.Whats)]
    game.Solution.Where = game.Wheres[math.random(1, #game.Wheres)]

end

 

I have a GameSate object in which I have a table called "Solution".  I also have tables called "Whos", "Whats", and "Wheres", filled with the appropriate objects.  I'm pulling a random value from those tables (#game.Whos will return the number of suspects in that table).

 

As far as initializing the game's state, I did this:

--Creates the game object, containing all zones, characters, etc.
function Init()

    FinalCacheZone.Active = false

    --The entirety of the game object.  The rest of this function will create it.
    local game = { Solution = { Who = nil, What = nil, Where = nil }, Whos = {}, Whats = {}, Wheres = {}, LastZoneVisited = nil, GeocacheZone = nil }

    --Easy to add
    game.Whos = cartClue:GetAllOfType('ZCharacter')
    game.Whats = cartClue:GetAllOfType('ZItem')

    local allZones = cartClue:GetAllOfType('Zone')
    
    for _,zone in ipairs(allZones) do
        if zone ~= FinalCacheZone then
            table.insert(game.Wheres, zone)

            --Resetting things about the zones, just in case
            zone.Active = false
            zone.DistanceRange = Distance(-1, "feet")
            zone.Visible = true
            zone.Active = true

            --Add the zone proximity event
            zone.OnProximity = function(zone)
                GuessSolution_OnZoneEntry(zone)
            end
        end
    end

    --Make the solution to the game
    CreateSolution(game)
    print([[Solution = ]] .. game.Solution.Who.Name .. [[, ]] .. game.Solution.What.Name .. [[, ]] .. game.Solution.Where.Name)

    return game

end

 

Since I'm not using other characters and items, the lookup is easy.  But I have to exclude the final cache's zone from the list, and I want to add the same proximity event to each zone.

 

After the game state is set up, I create a random solution, then return the game state to the caller, which puts it into global scope.

 

I'm doing this lookup because I won't know how many suspects, weapons, or locations might be in the cartridge since anyone who uses the cartridge can alter the quantity of anything as well as the names.

 

I should find some supper now.

Link to comment

I might also "deal" or give starting clues that make it a little less time-consuming to do and to make it more like the real game. I'll keep working on this and see what crazy things I come up with. 

 

Quick note: the syntax you're reading is Urwigo compiling code for me, although I will use this when I start coding it myself.

Quick question: What code editor do you use? I like VS Code because it's free and has lots of extensions. (like one for support for Lua)

Link to comment

I started with knowledge of C#, Visual Basic, Java, and JavaScript.  To learn lua, I made a cartridge using Groundspeak's Builder and looked at the source.  For the rest, I looked at the lua documentation.  Since I had programming knowledge at the outset, I only needed to know lua's syntax, how lua differed from the other languages I knew, and the Wherigo cartridge format.  I knew of closure from using it in JavaScript, and what I call "anonymous methods" in that and C#.  I wondered if I could accomplish the same thing in lua, so I tried it out.  If the first couple attempts failed, I'd eventually get the syntax right--or I'd look it up.  If I need to do something I've done before, I look up how I did it in prior cartridges.  If I can make a generic utility function, I do so because I can later copy it from one cartridge to another if I need to do something like that again.

 

As for the editor, let's take this cartridge for example.  My primary intent is to create a cartridge that other people can modify and use in their own areas.  Because of this, I need to create the cartridge using the lowest common denominator so people can import it into their favorite builder application.  Thus, I continued to use Groundspeak's Builder since you can import Builder-created cartridges into Urwigo, but not the other way.  Since I was too lazy to walk downstairs to turn on my old desktop, I fixed enough of the Builder's source code so I could get it working on my Windows 11 laptop.  I popped that open and created a cartridge with the zones, characters, and items I wanted.  I opened the lua file in notepad and began editing.  I kept going back to the Builder to open the cartridge to check that the syntax was correct.  The next night, I wanted a split window, so I opened the lua file in VS Code and used that.  I don't have a preference for which text editor I use since I can't do a test compile and run in either.

 

I might note that I don't have Urwigo installed on my laptop.  I'd have to run my desktop for that.

Link to comment

Uh, yeah...  Good luck with the logic there.  And if you wanted to add an extra suspect, weapon, or location, your eyes will glaze over and you'll want to defer it to another day.  Sheesh.  Though it's a mess, the visual representation makes it look fairly organized.

 

I added media to my cartridge.  (You can grab the GWC from my share location.)  It took a while for me to create the cards of different cachers.  I then created a switch in the code so I can choose (precompile) whether I want to run the game where one of the wrong guesses is revealed or whether just any item not in the solution is revealed.  I did that because, as I was testing this, I realized it's really difficult to play the game if it just shows any random item for an incorrect guess versus one of the three you guessed.

 

As for the logic I use to determine which clue to show, this is the pseudocode (only showing the logic if we want to show one of the guesses that's wrong):

  1. If the suspect is incorrect, add it to the incorrect items array (table)
  2. If the weapon is incorrect, add it to the incorrect items array
  3. If the location is incorrect, add it to the incorrect items array
  4. If the incorrect items array is empty, return nil
  5. Return a random object in the incorrect items array

The calling code will receive the output from above.  If the output is nil, it calls the game won function.  If not, it'll show the incorrect guess message.  The message's media will be set to that of the output from above, same with the name in the message.

 

I guess I'm done with it.  I'm not as interested in embellishment.  The fun of making the code is over.  I'll just need to find a location to put the cartridge in the wild and come up with a splash page for it.

Link to comment

I'm working on the code that distributes the cards. I had to use actual lua because Urwigo does not have list support. When I put this into "Lua user functions" it for some reason does not put any items in the player's inventory. Why? does it have something to do with not defining an id for the item?

function doStuff ()
	local cards = {"Colonel Mustard", "Mr. Green", "Mrs. Peacock", "Mrs. White", "Professor Plum", "Candle Sitck", "Revolver", "Lead Pipe", "Wrench", "Rope", "Dagger", "Kitchen", "Lounge", "Dining Room", "Ball Room", "Hall", "Conservatory", "Billiard Room", "Library", "Study"}

	function distributeCards ()
		randomNum = math.random(1, #cards)
		item1 = Wherigo.ZItem(objclue)
		item1.name = cards[randomNum]
		item1.Description = ""
		item1.Visible = true
		item1.Commands = {}
		item1.ObjectLocation = Wherigo.INVALID_ZONEPOINT
		item1.Locked = false
		item1.Opened = false
		item1.active = true
		table.remove(cards, randomNum)
		return item1
	end	
	card1 = distributeCards ()
	card1:MoveTo(player)
	card2 = distributeCards ()
	card2:MoveTo(player)
	card3 = distributeCards ()
	card3:MoveTo(player)
	card4 = distributeCards ()
	card4:MoveTo(player)
	card5 = distributeCards ()
	card5:MoveTo(player)
	for i, card in ipairs(cards) do
   		 print(i, card)
	end
end

 

Link to comment
On 12/28/2023 at 10:14 PM, Ranger Fox said:

Perhaps after someone makes a guess, I should remove the shown card from the list of choices from subsequent inputs.  I'd also need a way to save and restore this state, but it could be done.  Thoughts?

Removing the option would remove the fun of having to write down and cross off what you know. I personally don't want that for my cache.

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...