Jump to content

Ranger Fox

Moderators
  • Posts

    3263
  • Joined

  • Last visited

Everything posted by Ranger Fox

  1. Looks like the problem was with the Google Maps charts server. The server was serving map pins again after I started looking at this after work. Go figure. I guess that means I have more time to do things this evening than I thought.
  2. The Google site I was using for the map pins might no longer be available. I’ll need some after-work time to come up with another solution. I’ll post when I’ve resolved this.
  3. You could use Earwigo or Kit from a browser. Earwigo is far more featured than Kit, but if you want a quick linear cartridge, you could make use of Kit. (Links to both are in my signature line.)
  4. 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?
  5. I'm looking at your first October 27th post for reference. In it, your Init() function stores strings in the table. So, that's what you're getting back when you call GetRandomItem. You instead need to store the item objects (they're technically tables themselves, but I'll call them objects here to avoid confusion) in your table. If you need to show the name of one of those items to a player, you can call the object's Name property. Since you've seen my Clue cartridge, take a look at what I'm storing in the tables: they're the character, zone, and item objects themselves. Also, make sure you have the code as of about four days ago. Note I'm using my own "GetAllOfType" function instead of the inbuilt one because the iOS player app shows a lua exception when I try to get all of type ZItem or ZCharacter (or "character" or "item" for that matter). Though I've yet to clean it up and add comments everywhere, you should be able to follow what's being done and what variable contains what because I tend to have a good sense at naming things.
  6. I would assume the point is to get people in an area accustomed to running a Wherigo cartridge without having to know anything beyond that. The next step would then be a simple cartridge where you'd see a single zone, you go to that zone, then it shows another zone with the final. That or making a really easy geo art (though an inappropriate use of Wherigo, according to my preference to use the lowest denominator cache type). Personally, I'd just be happy that another cache came out. Fewer and fewer caches are published every year in my area. Every little bit helps.
  7. Because the player decides whether or not to restore the cartridge's state upon launching the cartridge, there isn't a way to pass information from one playthrough to another. Even if you provide a way within your cartridge to start a new game (which would effectively pass information from one playthrough to another), the player still has to elect to restore state.
  8. When you define a variable in, say, Urwigo, that variable's value is retained if the user exits and restarts the cartridge, so long as either you manually trigger the save event or the user selects to save the cartridge when exiting. Either way, the user has to consent to restoring the game upon restarting the cartridge. There's a cartridge event that happens upon restore. You can test for a variable's value there. All zones will be restored to the state they were in when the cartridge was saved. (Manipulations and state in author script are another matter.) To my knowledge, you can't modify text media. Or, at least, I haven't heard of anyone doing this. I have not heard of anyone using the LastPlayedDate variable, and I cannot guarantee all player apps set this variable. They might, but I don't know. If you do an experiment, let everyone know your findings. For documentation on the Env variable:
  9. Congratulations, and also in creating something a little different. When I finish what I'm working on, I'll look at it.
  10. 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): If the suspect is incorrect, add it to the incorrect items array (table) If the weapon is incorrect, add it to the incorrect items array If the location is incorrect, add it to the incorrect items array If the incorrect items array is empty, return nil 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.
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. Sure, you can use it. All but one of my cartridges is open source, so feel free to give your locals some fun. If you come up with a complicated idea for a game, let me know. If the idea seems fun, I'll spend the time to make it.
  18. 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!
  19. 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.
  20. After uploading to Wherigo.com, you'll need to create the cache page. When creating the cache page (and on the edit page), you'll find a spot for a related web page. Copy the Wherigo.com URL to there. Once your geocache listing has been published, you'll see your cartridge on your geocaching.com map.
  21. While there is a way to keep a message box open (tie into the message box button event so it shows the same message when the button is clicked to dismiss it), perhaps you could put an item in the player's inventory upon entering the zone. The item's description would have the page of information. This will also survive resuming a cartridge from saved state. Download Uriwigo and give it a try. Earwigo requires a user account and Kit won't keep a message box open or won't allow you to put an item into the player's inventory. What you'd want to do is create one zone and one item. On the zone entry or proximity event, move the item to the player, which puts it into the player's inventory. You might want to show a message to the player to tell the player to check his or her inventory. Or you could just show a message with the information and tell the player to view their inventory if they need to look at the message again.
  22. Oh, it's kind of like a two stage Lights Out kit I have. You put all the zones in one group and say the player has to visit a certain number before the next zone group, which just has a final, is shown. The main difference is the zones in the first group are hidden. Okay, got it. Someone in my area years back said they'd like to create a cartridge called "Where I Go" to show people where all the best toilets are. Heh.
  23. I guess that depends on the builder. When I write cartridges, I tend to do the easy stuff in the builder, then sometimes drag it down into the author script section if I want it to call one of my functions. Anyway, it depends on the builder whether it'll let you call author script and preserve what you wrote. The challenging thing from a builder design standpoint is that you'd typically want to access cartridge objects from that function and pass them in, which means if the user later renames one of those objects, it's a pain to change the call into author script. Anyway, objects can be inserted into a table just like strings. I'm writing this without testing it, but something like this: zitemSword = Wherigo.ZItem{Cartridge=cartFunWithTables} zitemShield = Wherigo.ZItem{Cartridge=cartFunWithTables} zitemArmor = Wherigo.ZItem{Cartridge=cartFunWithTables} itemTable = {} table.insert(itemTable, zitemSword) table.insert(itemTable, zitemShield) table.insert(itemTable, zitemArmor) If you use Urwigo, don't tell it to obfuscate names when it makes the cartridge because it'll change the names of all your objects into something else. You'll have a tough time keeping things straight. Usually, when I build a cartridge, my workflow looks like this: Open a builder and create all the objects I want in the cartridge: zones, items, characters, timers, variables I want to persist when the game is saved and restored, etc. Add any media to the cartridge and associate it with the objects. Add any basic logic: messages and dialogs. After saving the cartridge, open it in a text editor. Write a function or two in author script. Save it. Reload the cartridge in the builder to make sure the lua file is still valid. Continue adding more code using the text editor, pausing every now and then to reopen it in the builder to make sure the lua file is still valid. Compile and play in an emulator to test what I've done so far. Continue adding more and testing until I'm done. Any builder is good at generating objects, so I use one to start off with, then I switch over to adding all the other stuff. If you want to look at some of my other cartridges for inspiration, I suggest you look at Battleship and Cacher Pursuit. These use tables and are heavily commented for people to learn what I'm doing and what everything is. In fact, here's one line from the Battleship cartridge: local ship = { Name = name, Zones = { z }, IsSunk = false, Class = boatClass, Task = nil } I have a table (object) with a property called "Name" (value of string), "Zones" containing an array of zones, "IsSunk" (boolean), "Class" (string), and "Task" (a Wherigo Task object). All of that is loaded into a table (array) of similar battleships. Finally, I'll leave you with this: it's just an array. A string is a type of object (an array of characters) and a Wherigo item is a type of object (a table of properties no different from the "ship" one I showed above, which is just really a table of key/value pairs).
  24. So, the official paperwork out of the way, what is an "I Love Place" cartridge? Would you please elaborate?
  25. As this is a link to a utility, it falls under approval to allow in the forum. The linked site is noncommercial, free, and does not have ads. Okay. I'll approve it.
×
×
  • Create New...