[SOLVED] Dialog Not Appearing

BMJ

  • Posts: 278
Hi Justin,

Thank you for the wonderful extension. I look forward to being able to use it in my game. I have read the "Getting Started" file and studied the sample game (which did not work for me, initially, but then I re-imported it and it works fine now.) I seem to be unable to show dialogue in my game. I have created a dialogue named "Greetings" and then used the custom block in an event for an otherwise blank scene as shown in the two pictures below. When I press the "talk" control, nothing happens, but every time I press it, the framerate dips lower and lower, so it seems that SOMETHING is happening. Have I missed something? (It also doesn't show anything if I use the pre-made "Start" krusty dialog, either.)

I am using Stencyl 3.1, build 7376 & yes, I downloaded the 1.3 Dialog Extension.


« Last Edit: December 22, 2014, 01:04:04 pm by Justin »

Justin

  • *
  • Posts: 4716
Hmm. Check your screen size. The v1.3 demo was made for a 640x480 screen, so if your screen is small enough it won't show the window.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

Justin

  • *
  • Posts: 4716
Split this from the topic it was in before. Did my last post help you figure out the issue?
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

BMJ

  • Posts: 278
Justin -- yes, thank you. :) The screen size was the problem. It displays correctly now that I fixed that issue.

Now, I have another question. Ideally, I would like to display the dialog window above the characters' heads -- I tried to accomplish this by making game attributes for the X and Y offsets (relative to the character's x/y screen coordinates) and using the <getattr>  in the Windows definitions in the Dialog extension to set the X and Y coordinates for the window. I'm not sure if I did it wrong, but it doesn't seem to work that way ...  Is there a way to accomplish this? (I've checked that the X and Y offset game attributes are calculated correctly).

Justin

  • *
  • Posts: 4716
That's not exactly how it works, but... darn if that isn't clever. I wonder if I can make those settings variable in a future release.

Somebody else tried to do the same thing a while ago, and I believe he got it working. Here's the thread.

http://community.stencyl.com/index.php/topic,30554.0.html

So I guess you'll want to try playing with the following code snippets and see what affect they have.

Before displaying your dialog:
Code: [Select]
DialogStyleLibrary.getStyle("Default Style").preferences.get("Dialog Base").set("msgX", 50);
This can happen anytime, I think:
Code: [Select]
var dialog : DialogBase = cast(DialogStyleLibrary.getStyle("Default Style").extensionMap.get("Dialog Base"),DialogBase);
dialog.window.positionRef = Util.valueOfString("(50 0)");
dialog.window.update();
dialog.window.reposition();


==

The code for getting a game attribute is getGameAttribute("Attribute Name"), so to get that into the Point type that the window is expecting, it would be something like this:
Code: [Select]
dialog.window.positionRef = Util.valueOfString("(" + getGameAttribute("X Offset Dialog") + " " + getGameAttribute("Y Offset Dialog") + ")");

« Last Edit: December 21, 2014, 04:24:41 pm by Justin »
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

BMJ

  • Posts: 278
Ah, OK -- how does one go about playing with the code snippets? As in: what software can I use to do that?  My experience with actual programming is limited.

Justin

  • *
  • Posts: 4716
You can do it in Stencyl.

http://community.stencyl.com/index.php/topic,35829.msg202940#msg202940

I'd say just place a code block with the following code before the display dialog block. If it works, try changing the numbers and see what happens.

Code: [Select]
DialogStyleLibrary.getStyle("Default Style");
DialogStyleLibrary.getStyle("Default Style").preferences.get("Dialog Base").set("msgX", 50);
DialogStyleLibrary.getStyle("Default Style").preferences.get("Dialog Base").set("msgY", 90);
var dialog : DialogBase = cast(DialogStyleLibrary.getStyle("Default Style").extensionMap.get("Dialog Base"),DialogBase);
dialog.window.positionRef = Util.valueOfString("(" + getGameAttribute("X Offset Dialog") + " " + getGameAttribute("Y Offset Dialog") + ")");
dialog.window.update();
dialog.window.reposition();

I have no idea if this will work!
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

BMJ

  • Posts: 278
Unfortunately, it gave me this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at MethodInfo-7681()[Source/scripts/Design_396_396_SaySomething.hx:128]
   at com.stencyl::Engine$/invokeListeners2()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:4032]
   at com.stencyl.models::Actor/handleCollisions()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/models/Actor.hx:2073]
   at com.stencyl.models::Actor/innerUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/models/Actor.hx:1480]
   at com.stencyl::Engine/update()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2519]
   at com.stencyl::Engine/postUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2744]
   at com.stencyl::Engine/onUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2737]

But now that I know I can insert a "code block" into my behavior, I feel like I can probably figure out how to do your first suggestion -- I'll just need to look at it with a better rested eyes/brain than i have right now.  :)

(but feel free to also keep suggesting other possible solutions if you happen to think of any :D)

je2prs

  • *
  • Posts: 1
Okay, I tried it out and got the same error. It looks like you need to run the first code before your dialog is shown, and then the second bit of code afterward. The way the dialog extension works is a little complicated so I went ahead and made a behavior to make it easier.

Search StencylForge for "Dialog Propertes" by Justin. I've included a "set position" block, too. You can modify that custom block to suit your needs, or build more custom blocks with it. Just call the set position block before you display the dialog to start with and let me know if you have any questions.

« Last Edit: December 22, 2014, 09:57:58 am by Justin »

BMJ

  • Posts: 278
Justin -- first of all, thank you so much for doing this. I really appreciate the help.

I d'loaded the behavior you made and attached it to the scene. I then called the custom block as shown in the picture below ... (this is in an actor behavior I made (as shown in the png below) that starts the dialog and stores an attribute that determines which dialog is shown). Unfortunately, I got this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at scripts::Design_398_398_DialogProperties$/_customBlock_setDialogWindowProp()[Source/scripts/Design_398_398_DialogProperties.hx:99]
   at scripts::Design_398_398_DialogProperties$/_customBlock_setDialogPos()[Source/scripts/Design_398_398_DialogProperties.hx:90]
   at MethodInfo-7690()[Source/scripts/Design_396_396_SaySomething.hx:127]
   at com.stencyl::Engine$/invokeListeners2()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:4032]
   at com.stencyl.models::Actor/handleCollisions()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/models/Actor.hx:2073]
   at com.stencyl.models::Actor/innerUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/models/Actor.hx:1480]
   at com.stencyl::Engine/update()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2519]
   at com.stencyl::Engine/postUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2744]
   at com.stencyl::Engine/onUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2737]

I wondered if maybe the custom block you made needed to be called from a scene behavior, so i added an event to the Dialog Properties behavior you made and tried it that way, too, but received this error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at scripts::Design_398_398_DialogProperties$/_customBlock_setDialogWindowProp()[Source/scripts/Design_398_398_DialogProperties.hx:99]
   at scripts::Design_398_398_DialogProperties$/_customBlock_setDialogPos()[Source/scripts/Design_398_398_DialogProperties.hx:90]
   at MethodInfo-7697()[Source/scripts/Design_398_398_DialogProperties.hx:117]
   at com.stencyl::Engine$/invokeListeners3()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:4059]
   at com.stencyl::Engine/update()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2437]
   at com.stencyl::Engine/postUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2744]
   at com.stencyl::Engine/onUpdate()[C:\Program Files (x86)\Stencyl\plaf\haxe\lib/stencyl/1,00/com/stencyl/Engine.hx:2737]

Now, before you go putting any more work into this -- I found another question this morning I need to ask, which might render this moot (for 1.3, anyway) ... is there any way to get 1.3 to work with 2x fonts  for games run at 2x scale or does one have to upgrade to 1.4/Stencyl 3.2 for the upscaling feature? :D

Justin

  • *
  • Posts: 4716
I think the problem is probably because of different resource names. Go into the behavior you downloaded and look at the set dialog pos block. I hardcoded it to work with "Default Style" as the style and "Dialog Main Window" for the window, I think. Set those to whatever names your style/main window have.

Yeah you'd need to update to Stencyl 3.2 and the latest extension version for better upscaled font support.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

BMJ

  • Posts: 278
Yes, that was the very problem! Thank you, it works now. :)

Justin

  • *
  • Posts: 4716
Quote
Yeah you'd need to update to Stencyl 3.2 and the latest extension version for better upscaled font support.
I just realized this isn't actually true. I forgot that I have an older version of the extension sitting on my harddrive that supports better scaling. Feel free to try it out!

https://dl.dropboxusercontent.com/u/9458929/Extensions/scale-dialog.rar
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

BMJ

  • Posts: 278
Oh, lol, thanks :) I didn't see this post you made over a month ago ... :) I will try this out.