+Repmul Posted July 8, 2021 Share Posted July 8, 2021 I am trying to set up a multi-choice question, where one of the possible choices is the player's name. Is there a way to set up Player.Name or any other variable as a possible choices? Quote Link to comment
+Hügh Posted July 8, 2021 Share Posted July 8, 2021 (edited) The builders might have trouble accomplishing this, but it is still possible by editing the Lua directly. require "Wherigo" ZonePoint = Wherigo.ZonePoint Distance = Wherigo.Distance Player = Wherigo.Player cartExampleCartridge = Wherigo.ZCartridge() cartExampleCartridge.Id = "52928615ce751b7cf4d3ebf7b7cd8090" cartExampleCartridge.Name = "Example Cartridge" cartExampleCartridge.Activity = "TourGuide" cartExampleCartridge.Version = "" cartExampleCartridge.Company = "" cartExampleCartridge.Author = "" cartExampleCartridge.TargetDevice = "SmartPhone" cartExampleCartridge.TargetDeviceVersion = "0" cartExampleCartridge.BuilderVersion = "WWB 0000.3.2019.09.16.174037" cartExampleCartridge.StateId = "1" cartExampleCartridge.CountryId = "2" cartExampleCartridge.Description = [[]] cartExampleCartridge.StartingLocationDescription = [[]] cartExampleCartridge.Visible = true cartExampleCartridge.Complete = false cartExampleCartridge.UseLogging = false cartExampleCartridge.CreateDate = "5/19/2021 04:23:23 AM" cartExampleCartridge.PublishDate = "1/1/1970 01:00:00 AM" cartExampleCartridge.UpdateDate = "7/8/2021 07:52:46 PM" cartExampleCartridge.LastPlayedDate = "1/1/1970 01:00:00 AM" cartExampleCartridge.StartingLocation = Wherigo.INVALID_ZONEPOINT zinputexampleQuestion = Wherigo.ZInput(cartExampleCartridge) zinputexampleQuestion.Id = "922332dde2e64a2b74deb2ba1afd1b35" zinputexampleQuestion.Name = "exampleQuestion" zinputexampleQuestion.InputType = "MultipleChoice" zinputexampleQuestion.Choices = { -- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< "Alice", -- Notice how I have just used Player.Name "Bob", -- (with some additional text concatenated around it) "Charlie", -- as one of the options of the multiple-choice ("Or, maybe " .. Player.Name) .. "?" -- question. } -- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< zinputexampleQuestion.Text = "What is your name?" zinputexampleQuestion.Visible = false function cartExampleCartridge:OnStart() Wherigo.GetInput(zinputexampleQuestion) end return cartExampleCartridge This produces the desired effect (the default player name in Webwigo is "[Unknown]") If you're using a builder, you could probably add an "Author Script" that sets up the ZInput, and later when you want to prompt for the question you could use a "raw Lua statement" to trigger the question. Edited July 8, 2021 by Hügh 1 Quote Link to comment
+Repmul Posted July 8, 2021 Author Share Posted July 8, 2021 OK, so how do I set this up as an "Author Script" within URWIGO? Quote Link to comment
+Forest-Ghost Posted July 14, 2021 Share Posted July 14, 2021 I created a cartridge that demonstrates how to use custom choices in urwigo. There are two examples. Question one uses player.name. Question two uses a variable to set the input choice. Download the source code and change the extension to .zip: https://www.wherigofoundation.com/cartridge/cartridge_details.aspx?wg=WG1GB 1 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.