Jump to content


Photo

Advanced chat scripts


  • Please log in to reply
1 reply to this topic

#1 jon sploder

jon sploder

    GMC Member

  • GMC Member
  • 859 posts

Posted 17 January 2012 - 12:42 AM

Download: http://www.box.com/s...nhxqesd0r733sja

These chat scripts are very powerful and easy to use, it includes line breaks without cutting off words in the middle, pasting and scrolling automatically when typing a long message in the chat bar. You essentially draw a rectangle for the chat to fit into, tell it how many lines it should have and specify the font, the co-ordinates for the chat bar you type in, color, pixels between lines, and maximum amount of characters allowed in a message. The size of the font is calculated automatically based on the amount of lines, line break pixels, width etc for you, so when specifying the font keep that in mind.

Chat isn't necessarily native to one object as well, so you can create the chat in object1, draw it in object2 and add to it from object3,4,5 etc.

Everything is a script for you except for two small events which you may or may not want:
Pasting from clipboard: (key_press v, recommended)
if (keyboard_check(vk_control))
{
    keyboard_string += clipboard_get_text();
}
Limiting maximum characters typed in a message (being_step recommended):
if (string_length(keyboard_string) > global.chat_bar_chars)
{
    keyboard_string = string_copy(keyboard_string,1,global.chat_bar_chars);
}


More info directly from the chat_init script header comments:

chat_init(font,x,y,x2,y2,lines,chatbar_x,chatbar_y,color,linebreak,chatbar_chars);
argument0: font, the first argument required in font_add();
argument1: top left corner x value
argument2: top left corner y value
argument3: bottom right corner x value, also width in pixels before a line break is necessary
argument4: bottom right corner y value
argument5: lines to be stored
argument6: the x value of the singular line that displays the keyboard_string
argument7: the BOTTOM y value of the singular line that displays the keyboard_string, ie y2
argument8: chat color
argument9: the amount of pixels between lines
argument10: the amount of characters on the chat bar before cut off. I recommend a maximum of the width of chat bar*2, else the while loop will have to do a lot of work.
note:
    these scripts are not native to any one object, so you may initialize them in a and draw them in b, yet add them from c.
    by default these scripts bind the x/y values to the room view[0], if you wish to change this look in chat_draw.


Enjoy, no need to credit.

Edited by jon sploder, 17 January 2012 - 12:43 AM.

  • 1

#2 flxp

flxp

    GMC Member

  • GMC Member
  • 325 posts
  • Version:GM8

Posted 17 January 2012 - 12:50 AM

Nice!
im probably not gonna use something like this in a game...
but good chat system...(i could never get em down..)
  • -1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users