Jump to content

Lua Code to designate any character


Pocahontas and Meeko

Recommended Posts

I am working on a Wherigo cartridge using the urwigo builder. I have created a place for the user to input the pass phrase "Hurry up doctor who has boarded the Spaceship". The cartridge then compares the entered pass phrase to the sentence I entered to check for correctness. Unfortunately when many GPS specific devices try to play my Wherigo they are only able to input about 13 characters. When they need to enter the pass phrase they can not and so have to terminate the game. I want to alter the game so that it will compare the user input to only the first thirteen characters of the sentence I entered so everyone can play. I do not know anything about lua coding. Any ideas how I can accomplish this? Thank you.

Link to comment

Why not shorten it altogether to make it "Hurry doctor"? That's twelve characters, including the space? At that point, you won't have to get into the code.

 

If you're intent on modifying the code, I (or someone else who would like to help) could whip up an example cartridge for you.

 

Thank you for the reply Ranger Fox. I was hoping not to have to shorten the pass phrase as the translation of it from braille is part of the game. Perhaps I could send you my cartridge and you could take a look at it? It's also downloadable from Wherigo.com as "Doctor Whos Ashland Adventure" http://www.Wherigo.com/search/results.aspx?&searchlat=42.253129&searchlon=-71.460756&stype=2&zip=01721&rad=100

The quickest way to find the "problem" (In Urwigo) is to look under Inputs>Psychic Message Decipher>On Get Input

Thank you for offering to help. This is my first Wherigo and several people have found it already but I'd be very happy if more devices could play it too! I feel more comfortable creating wherigos knowing that this forum answers so quickly! Thanks again and please let me know if I can send you additional information.

Feel free to streamline anything else you should see as I'm sure for an experienced writer this cartridge is heavy handed.

Link to comment

The problem is, in Urwigo, the line that tests to see if you got the answer right looks like this:

if _Urwigo.Hash(string.lower(input)) == 40897 then

If something is trimming your answer to fifteen characters, you're going to have a problem. Urwigo creates a hash for the answer you provided and sticks it in the cartridge. When people play your cartridge, Uwrigo has something to create a hash out of the player's answer and this is compared to the answer's hash. It's one way to prevent the answers from being included in the cartridge (you also can't reverse the hash to get the answer). I could trim the answer to thirteen characters (not counting for length error checking):

if _Urwigo.Hash(string.lower(string.sub(input,0,13))) == 40897 then

However, the answer's hash that Urwigo came up with will be unchanged and, therefore, even the right answer would be wrong.

 

Your cartridge didn't include the .urwigo file within its GWZ, so I couldn't open it in Urwigo. I just looked at the source code and found my way down to what it was doing.

 

I'll have some more time in the evening, I think. I'll create a quick experiment cartridge. Do know which devices were encountering the problem? Or, if you'd like, I'll let you test the experiment since it can be played anywhere. In short, the experiment will ask some questions of varying length and attempt to determine whether it's truly the length of the answer, the way people are putting the answer in, etc.

Link to comment

The problem is, in Urwigo, the line that tests to see if you got the answer right looks like this:

if _Urwigo.Hash(string.lower(input)) == 40897 then

If something is trimming your answer to fifteen characters, you're going to have a problem. Urwigo creates a hash for the answer you provided and sticks it in the cartridge. When people play your cartridge, Uwrigo has something to create a hash out of the player's answer and this is compared to the answer's hash. It's one way to prevent the answers from being included in the cartridge (you also can't reverse the hash to get the answer). I could trim the answer to thirteen characters (not counting for length error checking):

if _Urwigo.Hash(string.lower(string.sub(input,0,13))) == 40897 then

However, the answer's hash that Urwigo came up with will be unchanged and, therefore, even the right answer would be wrong.

 

Your cartridge didn't include the .urwigo file within its GWZ, so I couldn't open it in Urwigo. I just looked at the source code and found my way down to what it was doing.

 

I'll have some more time in the evening, I think. I'll create a quick experiment cartridge. Do know which devices were encountering the problem? Or, if you'd like, I'll let you test the experiment since it can be played anywhere. In short, the experiment will ask some questions of varying length and attempt to determine whether it's truly the length of the answer, the way people are putting the answer in, etc.

 

 

I don't understand the code though I do have a very basic knowledge of perl code. In perl there is a character that I can use let's say it's "*" that can designate any letter, number or space. I was hoping lua might have something similar. Then I could ask the code to match the users input to "hurry doctor who *******************" .....and I see the problem...... It will never be able to match characters that the user can't input no matter what they are. OK, I could make it a multiple choice question I guess. I really liked the idea of the user having to do the translation all the way through but perhaps it's not possible.

 

I believe the problem is the actual device not being able to input enough characters (as opposed to user error). I think I even read somewhere that several devices have this problem. Now that my cartridge is running I'd like to go back and try to correct for it if possible.

Here's the devices data people have reported so far:

Successful Devices Used- iPhone5, Android Samsung S3, Droid Razor hd

Unsuccessful -iPad (some do not show pictures)

-Garmin Colorado 400T (cannot enter enough characters)

-Garmin Oregon 550T (cannot enter enough characters)

 

The website does not look like it will allow me to attach a .gwz file for some reason but I can email it to you if you'd like it.

Link to comment

And if you make it a multiple choice question, the text won't be able to fit all the way in the button. (There's so much to work on when the Wherigo Foundation gets the rights from Groundspeak...)

 

If you're trying to attach a GWZ to the forum, you'll have to change it to a ZIP. While you can email me the cartridge, other people might want to help--and I encourage that much more.

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