Datetime 显示当前时间游戏生成器

Datetime 显示当前时间游戏生成器,datetime,game-maker,Datetime,Game Maker,我一直在努力简单地显示当前时间,但在任何地方都找不到解决方案…很抱歉,这篇文章放错了地方 我只想在用户的pc或手机上显示时间 我能做的就是有时间显示在一个方框消息中,而不是让它每秒钟显示和更新一次 这是我当前的代码 //store the current time t=date_current_datetime(); //get the hour portion of that time h=date_get_hour(t); //get the minute portion of the

我一直在努力简单地显示当前时间,但在任何地方都找不到解决方案…很抱歉,这篇文章放错了地方

我只想在用户的pc或手机上显示时间

我能做的就是有时间显示在一个方框消息中,而不是让它每秒钟显示和更新一次

这是我当前的代码

//store the current time
t=date_current_datetime();

//get the hour portion of that time
h=date_get_hour(t);

//get the minute portion of the time.
m=date_get_minute(t);

//get the second potion of the time
s=date_get_second(t);

//show the time
txt="The current time is:"+string(h)+":"+string(m)+":"+string(s);
show_message(txt); 

希望此gamemaker代码有意义,谢谢您的帮助。

好的,添加到
创建
事件:

txt = "";
alarm[0] = 1;
//store the current time
t = date_current_datetime();

//get the hour portion of that time
h = date_get_hour(t);

//get the minute portion of the time.
m = date_get_minute(t);

//get the second potion of the time
s = date_get_second(t);

//show the time
txt = "The current time is: " + string(h) + ":" + string(m) + ":" + string(s);

alarm[0] = room_speed;
draw_text(10, 10, txt);
将代码移动到
报警0
事件:

txt = "";
alarm[0] = 1;
//store the current time
t = date_current_datetime();

//get the hour portion of that time
h = date_get_hour(t);

//get the minute portion of the time.
m = date_get_minute(t);

//get the second potion of the time
s = date_get_second(t);

//show the time
txt = "The current time is: " + string(h) + ":" + string(m) + ":" + string(s);

alarm[0] = room_speed;
draw_text(10, 10, txt);
最后一个-
绘制事件:

txt = "";
alarm[0] = 1;
//store the current time
t = date_current_datetime();

//get the hour portion of that time
h = date_get_hour(t);

//get the minute portion of the time.
m = date_get_minute(t);

//get the second potion of the time
s = date_get_second(t);

//show the time
txt = "The current time is: " + string(h) + ":" + string(m) + ":" + string(s);

alarm[0] = room_speed;
draw_text(10, 10, txt);
当然,您也可以使用
绘制GUI
事件或查看坐标,如

draw_text(view_xview[0] + 10, view_yview[0] + 10, txt);

你想要什么?(你的目标是什么?)。我不知道show_消息只用于调试Wow在第一次运行时工作,这正是我需要的!Thx a lot你知道我要做什么才能使一个物体在一个垂直时间可见吗?我一直在使用h、m和s作为变量时出错…@Panga97有很多方法。例如,您可以在
txt=..
之后添加
报警0
,例如:
如果h=13和m=00{obj_午餐.visible=true;}否则{obj_午餐.visible=false;}
其中“obj_午餐”是您的午餐object@Panga97您使用的GM版本是什么?@Panga97 File->导入项目