close

寫skill程式的時候難免要用到script,調用script的過程中總會顯示出整個的操作過程,可能會是很多個allegro的form打開關閉等等,讓人眼花繚亂。
下面的方法可以讓這些script很安靜的被調用。
比如:在執行script的時候加一個-b的選項,就會關掉執行中可能出現的beep聲。

語法和參數

語法規則

使用方式 scriptmode [+/-]<option> ...
1.    用"+"來增加參數(執行規則),用"-"來恢復默認設置

2.    一次可以指定多個參數

3.    不指定參數就使用當前預設值

4.    如果是用在script裏面,那麼script執行完畢以後,參數設定會自動恢復

5.    支持參數的全名或者只是縮寫

6.    在allegro啟動過程中也可以使用

參數

縮寫   全名       功能描述

f     flush       Flush output to file after every command.

i     invisible   Form ports don't display during script

b     beep        inhibit most beeps during script replay

c     continue    Continue playback even if there are errors

s     step        single step, click mouse or hit a key to continue to next script statement (use with +echo option)

e     echo        echo every command

n     noinfo      Inhibit echo of informational messages

w     warnerror   Inhibit form warning and error messages

示例

scriptmode +i +c
script調用到的視窗都被隱藏
執行碰到錯誤也不停下來
script執行後還打開的視窗都可見
scriptmode -echo
關掉回顯的功能
推薦參數

scriptmode +invisible +noinfo

script執行時不顯示各種視窗
不顯示執行過程中的資訊,比如 "pick x y"
Allegro調用

如果代碼中需要調用script,則命令註冊函數axlCmdRegister需聲明類型參數cmdType為general
例子:

 

axlCmdRegister( "scr" 'scr ?cmdType "general" )
procedure(scr(@optional (scriptFile "test.scr"))
	prog(()

		axlShell(sprintf(nil "scriptmode +invisible +noinfo;replay %s;"      scriptFile))
	)
)
arrow
arrow
    創作者介紹
    創作者 熊熊 的頭像
    熊熊

    熊熊的部落格

    熊熊 發表在 痞客邦 留言(0) 人氣()