HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2008
0823
パンダミリ秒と制限時間3解決


パンダ

リンク

2008/8/23(Sat) 15:50:44|NO.18662

ゲームに制限時間を作ったのですが、ミリ秒の設定が上手くいきません。
迷走してます。。特に、時刻が59秒から0秒に戻るときに変になります。

抜粋して載せると・・・

tlim=10 ;制限時間10秒の設定

ns = gettime(6) ;秒の時刻
nms = gettime(7) ;ミリ秒の時刻

repeat
redraw 0

if tls<0 {
color 255,255,255 : boxf
color : pos 150,100 : mes "0:000"
: pos 160,200 : mes "終了"

}

if tls>-1 {
color 255,255,255 : boxf
pos 150,100 : color : mes ""+ tls +":"+ tlms

ts = gettime(6)-ns ;現在時刻−さっきの秒
tms = gettime(7)-nms ;現在時刻−さっきのミリ秒

if ts<0 : ts = ts+60 ;引き算が−になったら足す。
if tms<0 : tms = tms+999 ;

tls = tlim-ts ;制限時間−経過した秒
tlms = 999-tms ;制限時間−経過したミリ秒
}
wait 1
redraw 1
loop

こんな感じです。間違えを指摘していただけたら幸いです。



この記事に返信する


ひまつぶし

リンク

2008/8/23(Sat) 16:36:54|NO.18663

ミリ秒で書いた方が楽です


tlim=10000;制限時間10秒の設定 nms = (gettime (6) * 1000) + gettime (7) repeat redraw 0 tms = (gettime (6) * 1000) + gettime (7) - nms if tms < 0 { tms + 60000 } tls = strf ("%04d", limit (tlim - tms, 0, tlim)) if tms > tlim : break color 255,255,255 boxf pos 150,100 color mes strmid (tls, 0, 1) + ":" + strmid (tls, 1, 3) await 1 redraw 1 loop mes "終了" redraw 1



パンダ

リンク

2008/8/23(Sat) 22:07:39|NO.18666

早めの回答をありがとうございます!m(_ _*)m

秒とミリ秒を分けなくてもできるんですね。
・・・っていうかこんなサッパリとできるんですね(汗

ちょっと難しい命令もありますが・・・一生懸命調べて頑張ります!

ホントにありがとうございましたww



panda

リンク

2008/8/23(Sat) 22:59:21|NO.18667

あ、HN重なった・・・orz



ONION software Copyright 1997-2023(c) All rights reserved.