+bflentje Posted July 19, 2015 Posted July 19, 2015 Trying to keep all of my questions single threaded here... When I create a dialog or message, is there a way, preferably in the builder, but in source too, to concatenate a variable within the dialog or message text? I suspect there is but not finding a clear example that stands out. Quote
+charlenni Posted July 19, 2015 Posted July 19, 2015 You should mention, which builder you use. In code, you could use .. to concatenate to strings. Use it like "The variable var is "..var.."." or [[The variable car is ]]..var..[[.]]. Quote
+bflentje Posted July 20, 2015 Author Posted July 20, 2015 You should mention, which builder you use. In code, you could use .. to concatenate to strings. Use it like "The variable var is "..var.."." or [[The variable car is ]]..var..[[.]]. Sorry. I am using Earwigo. In code, meaning, if I am editing the LUA file directly? Quote
+charlenni Posted July 21, 2015 Posted July 21, 2015 In Earwigo it is easy. You could use the variable delimiters (if I'm right, they are ~~) to insert variables in text. Than you write "The variable var is ~~var~~.". That's it. Yes, in code means direct editing Lua code. Quote
+bflentje Posted July 21, 2015 Author Posted July 21, 2015 In Earwigo it is easy. You could use the variable delimiters (if I'm right, they are ~~) to insert variables in text. Than you write "The variable var is ~~var~~.". That's it. Yes, in code means direct editing Lua code. Thank you for the note. I did find this same information last night after posting here but have not yet had a moment to see it work in person. Thank you all for your continued help. Quote
+Borky00 Posted November 23, 2015 Posted November 23, 2015 Can anyone tell me how to do this with the Urwigo, I recently tried it and all I could do was have the player press the ok button multiple times and that looks bad. Another question slightly related. If I try and make this change in the source code instead of the builder how would I do this? Can I use Notepad? Will the Urwigo player convert it to something it can interpret? Thanx Bill (Borky00) Quote
+charlenni Posted November 23, 2015 Posted November 23, 2015 You create a dynamic dialog by a timer, which displayes every second (or longer times) a new dialog. To create Lua code inside if Urwigo use the "Lua defined functions" entry in the menu. There you could create free Lua code with an editor. Quote
+bflentje Posted February 1, 2016 Author Posted February 1, 2016 Question. When I use this in a dialog or a message, this translates perfectly.. "some text ~~string.char(78)~~ more text" as "some text N more text". But when I do the same thing in the description of an item, no go. Anyone have any ideas? Quote
+charlenni Posted February 1, 2016 Posted February 1, 2016 What's gong wrong? Do you get an error message? Quote
+bflentje Posted February 1, 2016 Author Posted February 1, 2016 What's gong wrong? Do you get an error message? No error at all, it just doesn't resolve. The item description just outputs the original.."some text ~~string.char(78)~~ more text" as opposed to translating the code between the ~~. To be more clear, this happens while I am running the cartridge in WebWigo.net. I have not yet tried it on an actual device yet. I assumed (probably wrongly) that if it didn't work in Webwigo that it wouldn't work on a device either. Quote
+charlenni Posted February 1, 2016 Posted February 1, 2016 I assume, that you create this string by hand. Normally Lua uses .. to concatenate strings. Earwigo replaces the ~~ with the correct string on the fly. If you create the string, you have to do this by yourself. Perhaps you could post a short demo? Quote
+bflentje Posted February 2, 2016 Author Posted February 2, 2016 I assume, that you create this string by hand. Normally Lua uses .. to concatenate strings. Earwigo replaces the ~~ with the correct string on the fly. If you create the string, you have to do this by yourself. Perhaps you could post a short demo? I got around the issue by placing my dynamic text within a variable, and then using a SetValue function when an event fires. I tried that after having found this snippet in the Wiki.. You can include variable text in any string which is displayed when the cartridge is running (meaning, Dialog or Message strings which are displayed in event handlers, functions defined on the Functions tab, and Message callback functions; but not, for example, the initial value of the Description field of an object). The variable text can be the result of any Lua expression. Probably the most common use of this is to display the value of a variable. Quote
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.