Jump to content


Photo
- - - - -

Easy Text Box Example


  • Please log in to reply
81 replies to this topic

#1 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1407 posts
  • Version:GM:Studio

Posted 15 September 2011 - 11:22 PM

  • Title: Text box example
  • Description: A very easy way to make your own dialog box
  • GM Version: :GM81:, GM:S
  • Registered: Yes, but a limited lite version exists
  • File Type: .gm81 | .zip (.gmx inside)
  • File Size: 19 Kb, 3.42 Mb for Studio Version
  • File Link: GM8.1 | Studio | Studio with icon --- 8.1 Lite | Original 8.1 (All on MediaFire)
  • Required Extensions: None
  • Required DLLs: None

Summary

This is a very simple way to make a dialog/text box for a game. Commented for your convenience.

It supports:

  • Scrolling text (appearing a few letters at a time).
  • Multiple messages at once
  • Easily added strings from anywhere
  • Scaled text
  • Skipping to the end of string (rather than waiting the whole time)
  • Following views
  • Sounds for appearing letters
  • Sounds when the message is closed/next message is loaded
  • Freezing everything when there is text visible
  • Separate box for speaker's name *
  • Colourable text *
  • Scripts for easier use *

* Not in Lite or Original 8.1 version

 

Using a queue, the strings are stored and read back in the same order as before. While the text is appearing, the player can skip to the end of the text, and can then remove the message from the queue to display the next one. When the queue is empty, the object becomes invisible, and stops obstructing the vision. It does NOT require placing multiple objects and the strings can be added to the queue at anytime, anywhere!

The Lite version does the same thing, but with an array that holds the messages, and requires more work for longer sequences of messages.
 

The Studio with icon version also includes support for having an icon of the character speaking in the message box, the same way that you would see in RuneScape.

 

To add automatic string wrapping, see here


Edited by thegame, 08 May 2013 - 11:18 PM.

  • 3

#2 icymx

icymx

    Patrick Brett

  • GMC Member
  • 790 posts
  • Version:GM8

Posted 13 October 2011 - 06:41 AM

Nice!
  • 0

#3 Devinit_gD

Devinit_gD

    GMC Member

  • New Member
  • 232 posts

Posted 19 October 2011 - 04:42 AM

This may help my game! I'll edit this post when I try it!
  • 0

#4 loverock125

loverock125

    GMC Member

  • GMC Member
  • 1618 posts
  • Version:GM8

Posted 19 October 2011 - 12:23 PM

Could you please fix the link :)
  • 0

#5 Devinit_gD

Devinit_gD

    GMC Member

  • New Member
  • 232 posts

Posted 19 October 2011 - 01:11 PM

Could you please fix the link :)


The Lite Version link works! :)
  • 0

#6 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1407 posts
  • Version:GM:Studio

Posted 19 October 2011 - 07:56 PM

Huh... if you stare at the error screen for a while it works... but I fixed it anyway!
  • 0

#7 icymx

icymx

    Patrick Brett

  • GMC Member
  • 790 posts
  • Version:GM8

Posted 27 October 2011 - 09:42 PM

Nice work!
  • 0

#8 The_Cone_man

The_Cone_man

    GMC Member

  • New Member
  • 17 posts

Posted 08 November 2011 - 01:53 AM

for some unknown reason i cant get my first speech thing to show. it just skips to the next room. i have even copied the exact coding ver beta and this still happens...no clue as to why, i also cant figure out how to set more variables for an object to speak but just a different dialogue than what was previously said in the room before. if anyone could help i would greatly appreciate it.
edit: spelling mistake

Edited by The_Cone_man, 08 November 2011 - 01:54 AM.

  • 0

#9 saibot22

saibot22

    GMC Member

  • New Member
  • 302 posts

Posted 14 November 2011 - 04:18 PM

Make it work with views because it is useless other wise as a lot of games with this have views...
  • 0

#10 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1407 posts
  • Version:GM:Studio

Posted 17 November 2011 - 12:07 PM

Make it work with views because it is useless other wise as a lot of games with this have views...

Did it! Enjoy!
  • 0

#11 _240773

_240773

    GMC Member

  • New Member
  • 2 posts

Posted 24 November 2011 - 04:47 AM

This is great :) Nice work. But how do you pause everything else like the message command does? Anyone know the code? I dont want monsters running around my characters while they are talking to one another, I just want the focus to be on the dialog.

Edited by _240773, 26 November 2011 - 04:20 AM.

  • 0

#12 uebo7

uebo7

    GMC Member

  • New Member
  • 19 posts
  • Version:GM8

Posted 21 December 2011 - 01:36 AM

How do you set the size of the text? On your example game, it's very small, but on my game it appears very large. Is it relative to the room size or something?
  • 0

#13 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1407 posts
  • Version:GM:Studio

Posted 22 December 2011 - 12:26 PM

Set your font to a different size in the font editor, or scale the text in some way. It's not relative to the room size, but to the zoomed-in-ness from your view
  • 0

#14 Bcm27

Bcm27

    GMC Member

  • New Member
  • 333 posts
  • Version:GM8

Posted 02 January 2012 - 11:29 PM

Mind if I comment? I'm saving this to my content thing. :D
  • 0

#15 DudeGuy676

DudeGuy676

    GMC Member

  • New Member
  • 47 posts
  • Version:GM:Studio

Posted 06 January 2012 - 04:26 AM

Could I use this in my game MageStones? I'll put you in the creditz
http://sandbox.yoyog...magestones-v1-2

Edited by DudeGuy676, 06 January 2012 - 04:27 AM.

  • 0

#16 thegame

thegame

    Flying Penguin

  • GMC Member
  • 1407 posts
  • Version:GM:Studio

Posted 06 January 2012 - 02:25 PM

Go ahead! That's what I made it for... :)
  • 0

#17 Devinit_gD

Devinit_gD

    GMC Member

  • New Member
  • 232 posts

Posted 06 January 2012 - 07:55 PM

I like how I got this post popular again. I feel good. C:
  • 0

#18 Bcm27

Bcm27

    GMC Member

  • New Member
  • 333 posts
  • Version:GM8

Posted 06 January 2012 - 08:23 PM

Lol, actually. I encountered a problem.

/* NOTE:
Make sure the box is NOT visible and IS persistent
Put ONE text box in the first room 
*/

image_speed=0.05; //Set the image to not flash too fast
//Create a queue to contain all the texts
globalvar text;
text=ds_queue_create();
drawstr="";

//Set the string position to make the text scroll nicely
pos=0;

On the Example- Textbox gmk8 file this globalvar text; does not come up as a error. But when I try and use it.
It shows up as a error.

Posted Image

I copied the code and all the objects and sprites. Anybody got a clue?
  • 0

#19 Sirosky

Sirosky

    GMC Member

  • GMC Member
  • 1323 posts
  • Version:GM8

Posted 07 January 2012 - 01:12 AM

It looks nice, though the text box lags behind with views but I'm sure this problem will be easily alleviated with a bit of code.
  • 0

#20 Bcm27

Bcm27

    GMC Member

  • New Member
  • 333 posts
  • Version:GM8

Posted 07 January 2012 - 03:28 AM

Anybody got a answer to my question. :D
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users