#module
#deffunc getparams val, val
mref setvar, 56 : mref data, 25
i = 2
repeat 4
strlen i.2, data
instr i.1, data, "&", i : if i.1 = -1 : i.3 = i.2 - i : else: i.3 = i.1
strmid setvar.cnt, data, i, i.3
if i.1 = -1 : break : else : i += i.3 + 1
loop
return
#deffunc cmdrun val
mref data, 24
sdim tmp, 64, 4 // サンプルモジュールでは64バイト×4のパラメータだけとする
getparams tmp, data
repeat 4
cast = tmp.cnt : int cast : i.cnt = cast
loop
strmid command, data, 0, 1
switch command
case "1" // 画面クリア
color i.0, i.1, i.2 : boxf
pos 0, 0
swbreak
case "2" // 位置変更・改行禁止設定
if tmp.0 ! "" : pos i.0, i.1
if tmp.2 ! "" : prohibit = i.2
swbreak
case "3" // 色変更・フォントサイズ変更
if tmp.0 ! "" : color i.0, i.1, i.2
if tmp.3 ! "" : font "", i.3
swbreak
case "4" // データ表示・ウェイト
mes tmp
ginfo 7
if prohibit : pos csrx + prmx, csry - prmy
if tmp.1 ! "" : wait i.1
swbreak
case "5" // アプリケーション終了
if tmp.0 ! "" : wait i
end
swend
return
#global
// サンプルデータ読み込み
exist "script.dat"
if strsize = -1 : dialog "設定データが存在しません" : end
notesel buf
noteload "script.dat"
noteget check, 0
if check ! "hspbc_sample_command" : dialog "設定ファイルは専用データではありません" : end
// サンプルデータを1行ずつ解析
notemax rows
repeat rows - 1, 1
noteget tmpdata, cnt
cmdrun tmpdata
loop
|