Button Click -> opens chatbox

Posted by TypicalAndy
Hello, Im trying to make a event if you click CTRL then the chat opens, but If you press it again the chat will disappear.

Replies (9)

Last message on 28 Mar 2018

Size43 (Administrator) on 24 Dec 2017, 16:04:40
If you want to hide the entire chat, not just activate/deactivate typing, you can use gms_draw_toggle to disable automatic chat drawing, and then draw it manually using gms_chat_draw.
TypicalAndy (Topicstarter) on 27 Mar 2018, 22:05:47
How do I do that? I tried this but the chat came up but 1 second disappeared.

(Step Event)

enable = false

if keyboard_check_pressed(vk_control)
{
enable = true
gms_chat_toggle(enable)
gms_chat_draw()
}
else
{
enable = false
gms_chat_toggle(enable)
gms_chat_draw()
}
Size43 (Administrator) on 28 Mar 2018, 19:25:56
You'll still need gms_chat_draw in the draw event (only if you've disabled automatic chat drawing).

Try something like this:

// Create
enable = false
// Step
if keyboard_check_pressed(vk_control)
{
    enable = not enable
    gms_chat_toggle(enable)
}
KadePcGames on 27 Mar 2018, 22:32:34
if keyboard_check_pressed(vk_control)
{
enable = true
gms_chat_toggle(enable)
gms_chat_draw()
}
//Then do
if enable = true 
{
gms_chat_toggle(enable)
gms_chat_draw()
}
KadePcGames on 27 Mar 2018, 22:34:14
You could remove a lot of the keyboard check code too
if keyboard_check_pressed(vk_control)
{
if enable = true {
enable = false
} else {
enable = true
}
}
AouabAdYT on 28 Mar 2018, 23:59:58
You can simply do :
if keyboard_check_pressed(vk_control)
{
enable = not enable;
}
//This will make it true if it's false , or false if it's true
TypicalAndy (Topicstarter) on 28 Mar 2018, 17:41:48
In what event do I need to put it? Step? Create?
Sustitos on 28 Mar 2018, 18:46:08
step to be constantly updated i think
PenguinPalaceGame on 23 Dec 2017, 21:11:33
Hey there,

To do this you could use
gms_chat_keys(vk_control, vk_enter, 0)
.