A
Alan Régis
Guest
I have a little trouble finding the right words to describe my problem so i'll try be as objective as possible:
What i want:
- Left Click the dice > roll dice > Message on the chatbox: ("You rolled a d6 and got a 5").
- Left click the dice again > same thing, but with the new dice result showing on a new line in the chat box.
What i have:
- Left Click the dice > roll dice > Message on the chatbox: ("You rolled a d6 and got a 5").
- Left click the dice again > New dice result is ok, new line too, but the older lines are updated with the last dice result.
Here's the code (i know its wrong, but anyway, maybe it could be helpful to put me in the right direction...)
Create Event
Left Click Event:
Draw Event:
What i want:
- Left Click the dice > roll dice > Message on the chatbox: ("You rolled a d6 and got a 5").
- Left click the dice again > same thing, but with the new dice result showing on a new line in the chat box.
What i have:
- Left Click the dice > roll dice > Message on the chatbox: ("You rolled a d6 and got a 5").
- Left click the dice again > New dice result is ok, new line too, but the older lines are updated with the last dice result.
Here's the code (i know its wrong, but anyway, maybe it could be helpful to put me in the right direction...)
Create Event
Code:
show_roll = false ;
dice_type = 6 ;
click_count = 0 ;
Code:
randomize() ;
show_roll = true;
dice_roll = irandom_range(1,dice_type) ;
click_count += 1 ;
Code:
draw_self() ;
pos_vert = obj_chatbox.y + 0;
pos_horiz = obj_chatbox.x + 25 ;
if show_roll
{
var i;
for (i = 0; i < click_count ; i += 1)
{
draw_set_font(fnt_dice) ;
dice_result = "Rolled a d" + string(dice_type) + " and got a " + string(dice_roll) ;
draw_text(pos_horiz, pos_vert + i*16, dice_result);
}
}