Jump to content

Dynamic Dialogs and Messages


bflentje

Recommended Posts

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.

Link to comment

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?

Link to comment

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.

Link to comment

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)

Link to comment

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.

Link to comment

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