+Arnyk Posted January 15, 2013 Share Posted January 15, 2013 So, a fast question to ask, but is it easy to answer? My colleague in Finland wants to build a Wherigo, where the choices are dependaple about the items what player has. So, Lets imagine there are three objects, bus ticket, bike, shoes and a train ticket. And if the player has bus ticket, shoes and bike, the input would give him/her three options to answer, like this: How are you going to travel? bus ticket -> by bus shoes -> by foot bike -> Riding bike If the player has only shoes and bike, the options for input should only be like this: How are you going to travel? shoes -> by foot bike -> riding a bike Is this somehow possible to do by changing the input depending the items player is carrying, or shoud he just do a bunch of inputs by all possible combinations? Thank you in advance for the answers! Arnyk Quote Link to comment
+redsox_mark Posted January 17, 2013 Share Posted January 17, 2013 (edited) You can check for the items in an IF statement. There are probably lots of ways you could implement this. One way would be to always give them the choice of the 4 options, then check if they have the right item. So if they choose "bus" but they don't have a bus ticket, you reply with "you need a bus ticket to travel by bus". This is probably the easiest solution I think. Or you can check the items and choose a different input option based on each combination to do as you have described. Others can probably provide more clever and detailed solutions.. Edited January 17, 2013 by redsox_mark Quote Link to comment
+jonny65 Posted January 17, 2013 Share Posted January 17, 2013 While playing you can not change the input choices depending on anything. It would work with different inputs but I would prefer the solution of redsox_mark too. Show all items, but if the player hasn't the right item show "you need a ticket ..." Quote Link to comment
+charlenni Posted January 22, 2013 Share Posted January 22, 2013 Sorry jonny65, that's not right. You could allways change the choices. The only, you had to do is a zinputYourInput.Choices = {"Test1", "Test8", "Test9"} and you get on the next Wherigo.GetInput(zinputYourInput) the above three choices. If you want to combine it programatically, then you could do it by local c = {} if HasPlayer(busticket) then table.insert(c,"by bus") if HasPlayer(shoes) then table.insert(c,"by foot") if HasPlayer(bike) then table.insert(c,"by bike") if #c == 0 then table.insert(c,"You could nothing do, because you didn't have anything") zinputYourInput.Choices = c That's all. Now you get only this choices, the player has. Quote Link to comment
+Kalkendotters Posted January 22, 2013 Share Posted January 22, 2013 From a users perspective: If I only see a choice to travel on foot, why should I assume there is also an option to find a busticket ? Leaving all choices as an option, and denying afterwards gives the user an indication that he might need to search some more. It gives same extra hints on how to complete all the objectives in the cartridge. Quote Link to comment
+Arnyk Posted January 25, 2013 Author Share Posted January 25, 2013 From a users perspective: If I only see a choice to travel on foot, why should I assume there is also an option to find a busticket ? Leaving all choices as an option, and denying afterwards gives the user an indication that he might need to search some more. It gives same extra hints on how to complete all the objectives in the cartridge. Thank you all for answers. I got what I needed and the whrigo developement continues. Kalkendotter: The above was quite fictional, only to somehow describe the need for the code. But still a fictional case. The "use-case" is different. Thanks you all again! Arnyk Quote Link to comment
+Arnyk Posted January 27, 2013 Author Share Posted January 27, 2013 From a users perspective: If I only see a choice to travel on foot, why should I assume there is also an option to find a busticket ? Leaving all choices as an option, and denying afterwards gives the user an indication that he might need to search some more. It gives same extra hints on how to complete all the objectives in the cartridge. Thank you all for answers. I got what I needed and the whrigo developement continues. Kalkendotter: The above was quite fictional, only to somehow describe the need for the code. But still a fictional case. The "use-case" is different. Thanks you all again! Arnyk One more question. Hopefully you can reply so detailed, that I dont have to take your valuable time more so, let me learn how to fish instead of giving me a couple of fish. In that way I can hopefully learn and teach others to fish No more wordpictures, so could someone explain me hot to use that code. I tried to insert it to the input part of urwigocode, no success. I tried to make a function of it, and got a error message "end expected near line 8", ie just after the end which I applid there. Is that code ready to be used or how to use it? Could someone be so nice, that could make me a urwigofile as a example to study, no more than that code inserted there without items also. I can make items my self. Thank you in advance! Arnyk Quote Link to comment
+Arnyk Posted January 30, 2013 Author Share Posted January 30, 2013 From a users perspective: If I only see a choice to travel on foot, why should I assume there is also an option to find a busticket ? Leaving all choices as an option, and denying afterwards gives the user an indication that he might need to search some more. It gives same extra hints on how to complete all the objectives in the cartridge. Thank you all for answers. I got what I needed and the whrigo developement continues. Kalkendotter: The above was quite fictional, only to somehow describe the need for the code. But still a fictional case. The "use-case" is different. Thanks you all again! Arnyk One more question. Hopefully you can reply so detailed, that I dont have to take your valuable time more so, let me learn how to fish instead of giving me a couple of fish. In that way I can hopefully learn and teach others to fish No more wordpictures, so could someone explain me hot to use that code. I tried to insert it to the input part of urwigocode, no success. I tried to make a function of it, and got a error message "end expected near line 8", ie just after the end which I applid there. Is that code ready to be used or how to use it? Could someone be so nice, that could make me a urwigofile as a example to study, no more than that code inserted there without items also. I can make items my self. Thank you in advance! Arnyk Im now at this point. Now I got error message "Attempt to call global ´HasPlayer´ a nil value. How to advance? Any ideas? Arnyk Quote Link to comment
+Arnyk Posted January 30, 2013 Author Share Posted January 30, 2013 (edited) now Im at this point: changed the "HasPlayer" value according to picture. And got an idea to change the item-identifiers as a item-names, not "automatic". But still no-go. I get Wherigo exception, and the player goes down. I dont get the frog-picture any help? Edited January 30, 2013 by Arnyk Quote Link to comment
Ranger Fox Posted January 31, 2013 Share Posted January 31, 2013 Well, without knowing the rest of the cartridge or how Urwigo handles tables, I can only guess. (Honestly, I never did try manipulating tables in Urwigo. When it came time for that, I hand-edited the cartridge.) So let me write a few things to check, just in case: -- Is Urwigo giving your items a different name when it compiles the cartridge? Is the reference breaking because of that? -- Try using a globally-declared table variable as a test. I don't think anything will come of it, but just to test. -- I haven't tried putting my true condition on the same line as my conditional. Try putting your table insertion statement on a separate line. -- Try commenting out the Choices assignment to see if that's the problem. -- You could use print statements between each line so you know how far in execution the code got before it crashed. For instance, print('Item 1 check passed'). All print statement results appear on the Lua Debug tab of the emulator. Please do not leave the statements in when you publish the cartridge as the iPhone Wherigo Player doesn't take too kindly to them and they can crash one of the Garmin Wherigo Players (the Oregon, I think). Also, you might want to check your logic on this. From what I see in the screenshot, the code will never get to the Choices assignment. Instead, the flow should be like this pseudocode: if player contains item then table insert end if player contains item then table insert end set input choices to table's values The way you have it set up, you're nesting the logic tests, so only if everything is true will the Choices assignment occur. Quote Link to comment
+Arnyk Posted February 22, 2013 Author Share Posted February 22, 2013 Well, without knowing the rest of the cartridge or how Urwigo handles tables, I can only guess. (Honestly, I never did try manipulating tables in Urwigo. When it came time for that, I hand-edited the cartridge.) So let me write a few things to check, just in case: -- Is Urwigo giving your items a different name when it compiles the cartridge? Is the reference breaking because of that? -- Try using a globally-declared table variable as a test. I don't think anything will come of it, but just to test. -- I haven't tried putting my true condition on the same line as my conditional. Try putting your table insertion statement on a separate line. -- Try commenting out the Choices assignment to see if that's the problem. -- You could use print statements between each line so you know how far in execution the code got before it crashed. For instance, print('Item 1 check passed'). All print statement results appear on the Lua Debug tab of the emulator. Please do not leave the statements in when you publish the cartridge as the iPhone Wherigo Player doesn't take too kindly to them and they can crash one of the Garmin Wherigo Players (the Oregon, I think). Also, you might want to check your logic on this. From what I see in the screenshot, the code will never get to the Choices assignment. Instead, the flow should be like this pseudocode: if player contains item then table insert end if player contains item then table insert end set input choices to table's values The way you have it set up, you're nesting the logic tests, so only if everything is true will the Choices assignment occur. Now Im here again. Still no-go. I have made a Urwigo-example (It is ZIP-packed, so you need to unpack it, not rename it) how I have tried to get the code work. I have three areas in the example. Warehouse, Checkpoint1, checkpoint2. (sorry, I wrote Checkpint first...might be a need of a cold beer...) To the issue: Player can take one to three items from the warehouse. And for checkpoint1 I made a value, which is compared and Im trying to create the input choises according to value of variable (as you can see on-enter section of checkpoint1). Checkpoint2 is a little bit more straight lined, only the LUA-usercode to "insert" the input-choises. Both areas raises the same error message. And Im lacking experience to get this work. Im not even sure if this is in a marigin on possibilities. Here is my urwigo-file, I have already taken the choises of "encrypting the file" off, I have allready given the Items a custom ID. I hope theres only a basic mistake left because of lack of my knowledge to get it easily work by you professionals I see this as a part of "expanding" Wherigo restrictions and in future it might give a way to create easily more advanced functions and interactivity inside the cartridge. I know that this could be done by multiple inputs, but I think its not the right way because of the amount of work. I would be very happy if someone could help me with this. Thank you very much, for atleast reading my message to the end testing choises.zip Quote Link to comment
+Arnyk Posted March 14, 2013 Author Share Posted March 14, 2013 Hello, its me again I think that this way of inserting choises to input is in Urwigo a "path to end to brickwall". I might be wrong, but it seems to be that. I would like to know, if someone has a lua-code to create a input in urwigo directly? So that I could make a custom input from a IF/ELSE-statement which compares the Items user has. The code would be a lot easier to make than a multiple input for every usecase. And also there would be a lot less inputs and variables etc. So, Im just wondering if someone could help me out.... from darkness... Arnyk Quote Link to comment
+Stompy&Stampy Posted December 24, 2014 Share Posted December 24, 2014 I have been wanting to do the same thing, and saw this topic and I have got something to work in urwigo using user code (without actually knowing lua). I realize it is nearly a year old but I thought someone else might be interested also in the betterment of Wherigo. What I wanted to do was create a conversation with a NPC where you go down a conversation path, then that path is no-longer available to ask once it has been asked. Or a question appears once a player has a certain item. So far I have only been able to change it in a limited way because I dont have any knowledge in lua. But I am thinking that it can maybe done using variables/values in the choices. But someone like ranger fox would be able to better answer that and hopefully make it better than I have. Basically what I noticed was that the "choices" where identified by using "id.Choices" (id being input identifier) So i set this to equal what I wanted with the following code:- ChatQ1.Choices = { "Did you see the clown?", "Do you know what day it is?", "How are you today?" } Prior to this code there was another option asking what the NPC's name was, see attached screenshot of the test cart I made. Hopefully someone can take this and better it so we can all use it. Quote Link to comment
+Stompy&Stampy Posted January 4, 2015 Share Posted January 4, 2015 Finally cracked one way of doing this, Im hoping to make it more efficient, less long winded and more flexible at some point. You need to set up a true or false variable for each of the answers, this is so we can check if the player has clicked that answer or not yet. If they click an answer we then set that answers variable to true. We then need to set up a function to check which answers have been pressed by using "IF" actions to "COMPARE" variables to true/false if true goes down one branch and false goes down another. Until all possible options have been covered by the branches. At the end of each branch you then need to put in a bit of "USER CODE" That looks like this :- ChatQ1.Choices = { "Did you see the clown?", "Do you know what day it is?", "How are you today?" } ChatQ1 is the identifier for the input you are trying to change, I set mine manually so I knew what it was. Each line is and answer button with that text on it that is between the quotation marks. Depending on your branches to check which answers have been used the answers will be different. Hope that makes sense! 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.