[SOLVED] Lists and Dialog

Jkniager

  • Posts: 13
Is there a way for me to use list game attributes in the dialog? Example:  List of items a shop sells.

« Last Edit: July 28, 2014, 08:49:42 pm by Jkniager »

Justin

  • *
  • Posts: 4716
No, no easy way. You would want to, based on your list, generate a new piece of dialog. Iterate over the items in the list, generating a text attribute to use as your dialog, instead of writing the dialog in the editor. Then you can call up a dialog box using your attribute as the text by creating a slightly modified version of a function in Dialog.hx.

The original begins on line 90, and looks mostly like what I'm about to post. Just add this modified form in as  another function in that file.

Code: [Select]
public static function globalCall(dg:String, style:String, o:Dynamic, call:String):Void
{
if(_instance == null)
_instance = new Dialog();

var dg:DialogBox = new DialogBox(dg, DialogStyleLibrary.getStyle(style));
_instance.addDialogBox(dg);

Engine.engine.whenDrawingListeners.push(_instance.dialogDrawer);
Engine.engine.whenUpdatedListeners.push(_instance.dialogUpdater);

_instance.o = o;
_instance.call = call;

dg.beginDialog();
}

Now you can call it with a code block.
Code: [Select]
Dialog.globalCall(_YourTextAttribute, "Default Style", null, "");
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Jkniager

  • Posts: 13
Okay thank you.