Dialog Extension General Discussion

oripessach

  • *
  • Posts: 259
Yes, changing the window size just once would be fine. I'd also be OK with changing it every time I start the dialog, if that's necessary.

Justin

  • *
  • Posts: 4706
Okay. Well, you can specify most dimensions in percentages as well as pixel based values, but if a single percentage + pixel offset isn't enough to cover the full range of devices you target, you can modify it at runtime using the data structure extension blocks.

In the first screenshot, I have a "window" attribute of type "Anything". The second block you see is the one with an "anything" slot where I placed the window, not a text slot.

You can get the name of the property you want to modify (in this case "scaleWidthSize") as well as the type of the property (here it's a RatioInt) by looking it up in the Data Structures extension's Structure Editor 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: 4706
Alternatively, you can go with the attribute-less method. If you're not going to be using the block very often, there's no reason not to do so. (The text-based lookup is less efficient than storing the value in an attribute).

Just use the block with the [text] slot in the middle.

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

oripessach

  • *
  • Posts: 259
Where is the name "My Dialog Window" coming from?

Justin

  • *
  • Posts: 4706
What it's called in your data structures.

For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)


oripessach

  • *
  • Posts: 259
I'm pretty sure you can get the default look of your font by changing dialog/src/dialog/core/DialogFont.hx line 52:
Code: [Select]
loadedFonts.set(f, new DialogFont(DialogFontInfo.get(f), 0xFFFFFF));Change 0xFFFFFF to -1.

While this does work, somewhat, look at the attached image to see what the text looks like.

It's not just that the letters' backgrounds aren't always transparent - the shadow is a lot darker than it's supposed to be. The screenshot is from the Mac build.



« Last Edit: September 02, 2015, 02:33:21 pm by oripessach »

oripessach

  • *
  • Posts: 259
Okay. Well, you can specify most dimensions in percentages as well as pixel based values, but if a single percentage + pixel offset isn't enough to cover the full range of devices you target, you can modify it at runtime using the data structure extension blocks.

Just to clarify, the reason I can't use the standard positioning techniques you mention is that I want to position the window at a specific distance from the edge of the screen - after clipping (in Scale to Fit (Fill) mode.) The percentages, etc. work relative to the full scene... Right?

Justin

  • *
  • Posts: 4706
Not sure, tbh. I don't do much with different scaling modes. You'd just have to try different options out and see what happens. For example, x at 10, width of 100% - 20, see if it's 10 px away from either edge regardless of scale mode.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

oripessach

  • *
  • Posts: 259
Looks like everything is relative to the scene size. That's consistent with the rest of Stencyl, at least.

I found that adding an offset, calculated using something like:

Code: [Select]
var offset:Int = Std.int(-engine.root.x/(engine.root.scaleX*Engine.SCALE));
works well for my game.

Doing this:

Code: [Select]
  var offset:Int = Std.int(-engine.root.x/(engine.root.scaleX*Engine.SCALE));
  Reflect.setField(DataStructures.get("Dialog Window"), "position", new scripts.ds.dialog.RatioPoint(20 + offset, 0., 60, 0.));

positions the dialog window 20 pixels from the edge of the screen (in scene pixels.) That's exactly what I need. I use the same technique to make sure that UI buttons are always visible, even on small devices.

bonechill

  • *
  • Posts: 270
In my game I have it were the names in the game are decided randomly, and put into a game attribute list. But, I can't seem to figure out how to access that information in the dialog, I need it to be able to do something like "Hello, my name is (item 1 of list [names])" or something like that, but I can't get it to work, any help would be awesome.
Play Gold Hunter on Kongregate, Newgrounds, or Stencyl Arcade

Justin

  • *
  • Posts: 4706
Code: [Select]
<show <listget <getattr game "My List"> 1>>Something like that probably. I'd recommend putting it in a macro.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

bonechill

  • *
  • Posts: 270
I also tried to put it in my own game, and the game crashes everytime I try to open the dialog, but the example game works fine. whats the difference in the default set up?
Play Gold Hunter on Kongregate, Newgrounds, or Stencyl Arcade

Justin

  • *
  • Posts: 4706
Please reiterate. What did you try to do? Put the snippet above into your dialog? It worked in the sample game but not yours? What crashed? The toolset or the engine? If something crashed, please provide the error it reported.
For Live Support: Join our discord server and ping me @justin.
I'm most often available between 10am and 10pm Japan time. (GMT+9)

bonechill

  • *
  • Posts: 270
I made it where when you step into a specific region, then press z, it opens a dialog. But rather then open the dialog, it crashes the test environment, and closes it out. the dialog works fine in the sample, but not in my project.
Play Gold Hunter on Kongregate, Newgrounds, or Stencyl Arcade