Recrit
同人遊戲相關專欄連載
【捨丸&KID】textbtnwait與selectbtnwait
本周要來介紹 textbtnwait 與 selectbtnwait這兩個指令,放在一起介紹是因為這兩個的用法差不多,首先是textbtnwait,這個指令必需要搭配*csp這個標籤名稱一起使用,使用效果是在NS的每一行文字等代click的時候將會執行*csp裡面的執行程式,如此就能讓按鈕或著是圖片常駐在NS的遊戲畫面上,實際運用程式碼如下,注意這也是從前人就寫好的程式碼範本改編而來,所以看到變數名稱命名相同是正常的:
;-----csp-----
*csp
getparam %CspParam
if %CspParam=-1 _csp -1:lsph TextCC1SpNum,":1/3,160,2;sys/cursor0.bmp",0,0:lsph TextCC2SpNum,":1/3,160,2;sys/cursor1.bmp",0,0:lsph
;上面這行是click圖示顯示與消失用的程式碼
98,":c/2,0,3;sys/doncur.bmp",770,570:lsph 99,":c/2,0,3;sys/uoncur.bmp",770,5:return
_csp %CspParam:return
;-----Click等待Subroutine-----
*text_cw
getcursorpos %x,%y ;Cursor位置取得
ispage %TextCC12Flug ;Click等待or改頁的判別
;將TextWindow在Effect時也顯示
erasetextwindow 0
;Click等待Icon表示
if %TextCC12Flug=0 amsp TextCC1SpNum,%X,%Y+7:vsp TextCC1SpNum,1
if %TextCC12Flug=1 amsp TextCC2SpNum,%X,%Y+7:vsp TextCC2SpNum,1
print 1
btndef clear ;按鈕定義Clear
getenter ;EnterKey受付
;-----Click等待按鈕Loop-----
*text_cwlp
saveon ;Save可
getcursor
csp 21 ;refresh常駐按鈕用
csp 51 ; refresh常駐按鈕用,這邊按鈕51是用做地區名稱
if %21>200 goto *scene_nightcoming
; %21是隱藏時間參數,超過一定數值就到badend
if %51=1 strsp 51,"「望鄉的陽台」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %52=1 strsp 51,"「女祭師的畫室」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %53=1 strsp 51,"「漆黑長廊」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %54=1 strsp 51,"「隱者之聲」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %55=1 strsp 51,"「全自動命運機」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %56=1 strsp 51,"「正義之羽」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %57=1 strsp 51,"「女帝的浴場」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %58=1 strsp 51,"「門口」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %59=1 strsp 51,"「法王的遊樂場」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %60=1 strsp 51,"「戀人們的愛巢」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %61=1 strsp 51,"「皇帝的獵場」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %62=1 strsp 51,"「倒吊者沙漠」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %63=1 strsp 51,"「戰車大道」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %64=1 strsp 51,"「沉睡的力量」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
;strsp這個指令是將文字變成SP圖 可以繼續將其轉變為按鈕或著移動作動畫
if %21=-1 lsph 21,":c;sys\timbar1.jpg",700,50:strsph 31,"『終點就是起點』",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21<12 && %21>0 lsph 21,":c;sys\timbar1.jpg",700,50:strsph 31,"蝴蝶在你頭上漂浮,撒下細微的鱗粉",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=12 && %21<24 lsph 21,":c;sys\timbar2.jpg",700,50:strsph 31,"蝴蝶在你頭上漂浮,撒下細微的鱗粉",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=24 && %21<36 lsph 21,":c;sys\timbar3.jpg",700,50:strsph 31,"蝶翅的邊緣微微融入了黑暗中",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=36 && %21<48 lsph 21,":c;sys\timbar4.jpg",700,50:strsph 31,"蝶翅的邊緣微微融入了黑暗中",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=48 && %21<60 lsph 21,":c;sys\timbar5.jpg",700,50:strsph 31,"破破爛爛的夢蝶依舊漂浮在你頭上",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=60 && %21<72 lsph 21,":c;sys\timbar6.jpg",700,50:strsph 31,"破破爛爛的夢蝶依舊漂浮在你頭上",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=72 && %21<84 lsph 21,":c;sys\timbar7.jpg",700,50:strsph 31,"宛如幽靈的蝴蝶無聲無息的跟著你",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=84 && %21<96 lsph 21,":c;sys\timbar8.jpg",700,50:strsph 31,"宛如幽靈的蝴蝶無聲無息的跟著你",700,150,7,5,13,15,0,0,1,0,#FFFFFF
;搭配%21時間參數的不同,可以出現不同的timbar跟說明數值
if %22=0 lsp 22,":l;sys\noitem.jpg",10,20:strsph 32,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %22=1 lsp 22,":l;sys\ni30_30_1.bmp",10,20:strsph 32,"一元復始萬象更新?",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %23=0 lsp 23,":l;sys\noitem.jpg",60,20:strsph 33,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %23=1 lsp 23,":l;sys\copper30_30_1.bmp",50,20:strsph 33,"這世界錢又少又臭又髒。",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %24=0 lsp 24,":l;sys\noitem.jpg",10,60:strsph 34,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %24=1 lsp 24,":l;sys\silver30_30_1.bmp",10,60:strsph 34,"空心的錢總比沒有好?",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %25=0 lsp 25,":l;sys\noitem.jpg",60,60:strsph 35,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %25=1 lsp 25,":l;sys\iron30_30_1.bmp",50,60:strsph 35,"人重於鴻毛輕於泰山。",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %26=0 lsp 26,":l;sys\noitem.jpg",10,100:strsph 36,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %26=1 lsp 26,":l;sys\chocolate30_30_1.bmp",10,100:strsph 36,"巧克力更勝麵包",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %27=0 lsp 27,":l;sys\noitem.jpg",60,100:strsph 37,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %27=1 lsp 27,":l;sys\golden30_30_1.bmp",50,100:strsph 37,"22K的黃金最是實用",0,140,7,5,13,15,0,0,1,0,#FFFFFF
;這邊搭配劇情中變數的變化,可以做成類似物品欄的畫面
lsph 99,":a/2,0,3;sys\textsave.jpg",730,488
lsph 98,":a/2,0,3;sys\textLoad.jpg",730,488
lsph 97,":a/2,0,3;sys\saveloadimg.jpg",730,488
lsph 96,":a/2,0,3;sys\saveloadimg.jpg",730,517
;這邊是常駐 sysbuttom
btndef ""
if %202 == 0 exbtn_d "P21P22P23P24P25P26P27C31C32C33C34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn_d "P21P22P23P24P25P26P27C31C32C33C34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 21,21,"P21P22P23P24P25P26P27P31C32C33C34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 21,21,"P21P22P23P24P25P26P27P31C32C33C34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 22,22,"P21P22P23P24P25P26P27C31P32C33C34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 22,22,"P21P22P23P24P25P26P27C31P32C33C34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 23,23,"P21P22P23P24P25P26P27C31C32P33C34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 23,23,"P21P22P23P24P25P26P27C31C32P33C34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 24,24,"P21P22P23P24P25P26P27C31C32C33P34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 24,24,"P21P22P23P24P25P26P27C31C32C33P34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 25,25,"P21P22P23P24P25P26P27C31C32C33C34P35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 25,25,"P21P22P23P24P25P26P27C31C32C33C34P35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 26,26,"P21P22P23P24P25P26P27C31C32C33C34C35P36C37P96P97P98P99,1"
if %202 == 1 exbtn 26,26,"P21P22P23P24P25P26P27C31C32C33C34C35P36C37P96P97P98,1P99"
if %202 == 0 exbtn 27,27,"P21P22P23P24P25P26P27C31C32C33C34C35C36P37P96P97P98P99,1"
if %202 == 1 exbtn 27,27,"P21P22P23P24P25P26P27C31C32C33C34C35C36P37P96P97P98,1P99"
exbtn 97,97,"P21P22P23P24P25P26P27C31C32C33C34C35C36C37P96P97P98P99,1S4,(se\maoudamashii_se_paper01.wav)";游標在exbtn97上
exbtn 96,96,"P21P22P23P24P25P26P27C31C32C33C34C35C36C37P96P97P98,1P99S4,(se\maoudamashii_se_paper01.wav)";游標在exbtn96上
;autoclick 1000 ; 每1000ms會自動按一次 搭配if判別式可以自己製作 automode
textbtnwait %BtnRes ;Click等待按鈕Weight
;按鈕全部設定完之後就是這行指令,根據不同按鈕會輸入不同的變數
if %BtnRes==97 mov %202,0:getscreenshot 80,60:btndef clear:csp -1:gosub *save ;開始新遊戲
if %BtnRes==96 mov %202,1:btndef clear:csp -1:gosub *load ;讀取進度
if %BtnRes=0 goto *text_cw_next ;左Click 變數是0
if %BtnRes=-42 goto *text_cw_next ;↓變數是-42
if %BtnRes=-3 goto *text_cw_next ;滑鼠wheel下
if %BtnRes=-11 goto *text_cw_next ;Space
if %BtnRes=-19 goto *text_cw_next ;Enter
if %BtnRes=-1 getscreenshot 80,60:gosub *text_cw_rclk:goto *text_cw ;右Click
if %BtnRes=-10 getscreenshot 80,60:gosub *text_cw_rclk:goto *text_cw ;Esc
if %BtnRes=-2 gosub *text_cw_lookback:goto *text_cw ;wheel上(回想)
if %BtnRes=-40 gosub *text_cw_lookback:goto *text_cw ;↑
goto *text_cwlp
;設定以外的變數輸入會Loop 這行一定要加,不然亂按按鈕會發生悲劇
;-----Click等待到左Click-----
*text_cw_next
vsp TextCC1SpNum,0:vsp TextCC2SpNum,0 ;這是搭配*csp就寫好的程式碼變數,與按鈕等待圖示的顯示有關
print 1
texec ;改頁等待的場合Text消去
;將TextWindow在Effect時非顯示
erasetextwindow 1
return
;-----Click等待到右Click-----
*text_cw_rclk
;Click等待Icon的非表示
csp -1
vsp TextCC1SpNum,0:vsp TextCC2SpNum,0
print 1
gosub *rmenu_custom ;跳到右鍵cutom程式
return
;-----回想------
*text_cw_lookback
vsp TextCC1SpNum,0
vsp TextCC2SpNum,0
print 1
gosub *backlog
return
如此可以做出下圖的遊戲畫面,
或許搭配大圖背景、隱形按鈕、矩陣、以及變數能做出SLG吧~~,或是RPG2000的遊戲畫面,只是何必呢?
接下來是selectbtnwait ,必需要搭配*customsel,這是在對話中使用「csel "點頭", *scene2_angel_a,"搖頭", *scene2b 」這種選像指令時,程式在等待玩家點擊選像時會去執行*customsel標籤下的指令,大致上使用方法與*text_cwlp一樣,只是要多加一個區塊
*customsel
skipoff
texton
getcselnum %2 ;計算選項有幾個並將數量代入%2
getcursorpos %0,%1
btndef clear
cselbtn 0,1,%0+24,%1+10:if %2=1 goto *csel_lp
cselbtn 1,2,%0+24,%1+45:if %2=2 goto *csel_lp
cselbtn 2,3,%0+24,%1+80:if %2=3 goto *csel_lp
cselbtn 3,4,%0+24,%1+115:if %2=4 goto *csel_lp
cselbtn 4,5,%0+24,%1+150:if %2=5 goto *csel_lp
cselbtn 5,6,%0+24,%1+185:if %2=6 goto *csel_lp
;這邊是定義按鈕出現位置
*csel_lp
……
selectbtnwait %BtnRes
……
以上這邊可以自行定義在選項出現時要執行哪些程式碼,甚至搭配 autoclick指令做出限時的效果(但有必要嗎?),要注意這邊的程式碼是整個遊戲共用的,所以若要在不同時期的選項做出不同效果,請多善用if判別式,還有在腳本進行中一定要用csel這個指令才會運用到這邊自行定義的程式碼,如何運用就靠自己的創意吧。
;-----csp-----
*csp
getparam %CspParam
if %CspParam=-1 _csp -1:lsph TextCC1SpNum,":1/3,160,2;sys/cursor0.bmp",0,0:lsph TextCC2SpNum,":1/3,160,2;sys/cursor1.bmp",0,0:lsph
;上面這行是click圖示顯示與消失用的程式碼
98,":c/2,0,3;sys/doncur.bmp",770,570:lsph 99,":c/2,0,3;sys/uoncur.bmp",770,5:return
_csp %CspParam:return
;-----Click等待Subroutine-----
*text_cw
getcursorpos %x,%y ;Cursor位置取得
ispage %TextCC12Flug ;Click等待or改頁的判別
;將TextWindow在Effect時也顯示
erasetextwindow 0
;Click等待Icon表示
if %TextCC12Flug=0 amsp TextCC1SpNum,%X,%Y+7:vsp TextCC1SpNum,1
if %TextCC12Flug=1 amsp TextCC2SpNum,%X,%Y+7:vsp TextCC2SpNum,1
print 1
btndef clear ;按鈕定義Clear
getenter ;EnterKey受付
;-----Click等待按鈕Loop-----
*text_cwlp
saveon ;Save可
getcursor
csp 21 ;refresh常駐按鈕用
csp 51 ; refresh常駐按鈕用,這邊按鈕51是用做地區名稱
if %21>200 goto *scene_nightcoming
; %21是隱藏時間參數,超過一定數值就到badend
if %51=1 strsp 51,"「望鄉的陽台」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %52=1 strsp 51,"「女祭師的畫室」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %53=1 strsp 51,"「漆黑長廊」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %54=1 strsp 51,"「隱者之聲」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %55=1 strsp 51,"「全自動命運機」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %56=1 strsp 51,"「正義之羽」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %57=1 strsp 51,"「女帝的浴場」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %58=1 strsp 51,"「門口」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %59=1 strsp 51,"「法王的遊樂場」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %60=1 strsp 51,"「戀人們的愛巢」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %61=1 strsp 51,"「皇帝的獵場」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %62=1 strsp 51,"「倒吊者沙漠」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %63=1 strsp 51,"「戰車大道」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
if %64=1 strsp 51,"「沉睡的力量」",700,10,7,2,13,15,0,0,1,0,#FFFFFF
;strsp這個指令是將文字變成SP圖 可以繼續將其轉變為按鈕或著移動作動畫
if %21=-1 lsph 21,":c;sys\timbar1.jpg",700,50:strsph 31,"『終點就是起點』",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21<12 && %21>0 lsph 21,":c;sys\timbar1.jpg",700,50:strsph 31,"蝴蝶在你頭上漂浮,撒下細微的鱗粉",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=12 && %21<24 lsph 21,":c;sys\timbar2.jpg",700,50:strsph 31,"蝴蝶在你頭上漂浮,撒下細微的鱗粉",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=24 && %21<36 lsph 21,":c;sys\timbar3.jpg",700,50:strsph 31,"蝶翅的邊緣微微融入了黑暗中",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=36 && %21<48 lsph 21,":c;sys\timbar4.jpg",700,50:strsph 31,"蝶翅的邊緣微微融入了黑暗中",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=48 && %21<60 lsph 21,":c;sys\timbar5.jpg",700,50:strsph 31,"破破爛爛的夢蝶依舊漂浮在你頭上",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=60 && %21<72 lsph 21,":c;sys\timbar6.jpg",700,50:strsph 31,"破破爛爛的夢蝶依舊漂浮在你頭上",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=72 && %21<84 lsph 21,":c;sys\timbar7.jpg",700,50:strsph 31,"宛如幽靈的蝴蝶無聲無息的跟著你",700,150,7,5,13,15,0,0,1,0,#FFFFFF
if %21>=84 && %21<96 lsph 21,":c;sys\timbar8.jpg",700,50:strsph 31,"宛如幽靈的蝴蝶無聲無息的跟著你",700,150,7,5,13,15,0,0,1,0,#FFFFFF
;搭配%21時間參數的不同,可以出現不同的timbar跟說明數值
if %22=0 lsp 22,":l;sys\noitem.jpg",10,20:strsph 32,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %22=1 lsp 22,":l;sys\ni30_30_1.bmp",10,20:strsph 32,"一元復始萬象更新?",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %23=0 lsp 23,":l;sys\noitem.jpg",60,20:strsph 33,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %23=1 lsp 23,":l;sys\copper30_30_1.bmp",50,20:strsph 33,"這世界錢又少又臭又髒。",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %24=0 lsp 24,":l;sys\noitem.jpg",10,60:strsph 34,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %24=1 lsp 24,":l;sys\silver30_30_1.bmp",10,60:strsph 34,"空心的錢總比沒有好?",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %25=0 lsp 25,":l;sys\noitem.jpg",60,60:strsph 35,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %25=1 lsp 25,":l;sys\iron30_30_1.bmp",50,60:strsph 35,"人重於鴻毛輕於泰山。",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %26=0 lsp 26,":l;sys\noitem.jpg",10,100:strsph 36,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %26=1 lsp 26,":l;sys\chocolate30_30_1.bmp",10,100:strsph 36,"巧克力更勝麵包",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %27=0 lsp 27,":l;sys\noitem.jpg",60,100:strsph 37,"",0,140,7,5,13,15,0,0,1,0,#FFFFFF
if %27=1 lsp 27,":l;sys\golden30_30_1.bmp",50,100:strsph 37,"22K的黃金最是實用",0,140,7,5,13,15,0,0,1,0,#FFFFFF
;這邊搭配劇情中變數的變化,可以做成類似物品欄的畫面
lsph 99,":a/2,0,3;sys\textsave.jpg",730,488
lsph 98,":a/2,0,3;sys\textLoad.jpg",730,488
lsph 97,":a/2,0,3;sys\saveloadimg.jpg",730,488
lsph 96,":a/2,0,3;sys\saveloadimg.jpg",730,517
;這邊是常駐 sysbuttom
btndef ""
if %202 == 0 exbtn_d "P21P22P23P24P25P26P27C31C32C33C34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn_d "P21P22P23P24P25P26P27C31C32C33C34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 21,21,"P21P22P23P24P25P26P27P31C32C33C34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 21,21,"P21P22P23P24P25P26P27P31C32C33C34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 22,22,"P21P22P23P24P25P26P27C31P32C33C34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 22,22,"P21P22P23P24P25P26P27C31P32C33C34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 23,23,"P21P22P23P24P25P26P27C31C32P33C34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 23,23,"P21P22P23P24P25P26P27C31C32P33C34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 24,24,"P21P22P23P24P25P26P27C31C32C33P34C35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 24,24,"P21P22P23P24P25P26P27C31C32C33P34C35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 25,25,"P21P22P23P24P25P26P27C31C32C33C34P35C36C37P96P97P98P99,1"
if %202 == 1 exbtn 25,25,"P21P22P23P24P25P26P27C31C32C33C34P35C36C37P96P97P98,1P99"
if %202 == 0 exbtn 26,26,"P21P22P23P24P25P26P27C31C32C33C34C35P36C37P96P97P98P99,1"
if %202 == 1 exbtn 26,26,"P21P22P23P24P25P26P27C31C32C33C34C35P36C37P96P97P98,1P99"
if %202 == 0 exbtn 27,27,"P21P22P23P24P25P26P27C31C32C33C34C35C36P37P96P97P98P99,1"
if %202 == 1 exbtn 27,27,"P21P22P23P24P25P26P27C31C32C33C34C35C36P37P96P97P98,1P99"
exbtn 97,97,"P21P22P23P24P25P26P27C31C32C33C34C35C36C37P96P97P98P99,1S4,(se\maoudamashii_se_paper01.wav)";游標在exbtn97上
exbtn 96,96,"P21P22P23P24P25P26P27C31C32C33C34C35C36C37P96P97P98,1P99S4,(se\maoudamashii_se_paper01.wav)";游標在exbtn96上
;autoclick 1000 ; 每1000ms會自動按一次 搭配if判別式可以自己製作 automode
textbtnwait %BtnRes ;Click等待按鈕Weight
;按鈕全部設定完之後就是這行指令,根據不同按鈕會輸入不同的變數
if %BtnRes==97 mov %202,0:getscreenshot 80,60:btndef clear:csp -1:gosub *save ;開始新遊戲
if %BtnRes==96 mov %202,1:btndef clear:csp -1:gosub *load ;讀取進度
if %BtnRes=0 goto *text_cw_next ;左Click 變數是0
if %BtnRes=-42 goto *text_cw_next ;↓變數是-42
if %BtnRes=-3 goto *text_cw_next ;滑鼠wheel下
if %BtnRes=-11 goto *text_cw_next ;Space
if %BtnRes=-19 goto *text_cw_next ;Enter
if %BtnRes=-1 getscreenshot 80,60:gosub *text_cw_rclk:goto *text_cw ;右Click
if %BtnRes=-10 getscreenshot 80,60:gosub *text_cw_rclk:goto *text_cw ;Esc
if %BtnRes=-2 gosub *text_cw_lookback:goto *text_cw ;wheel上(回想)
if %BtnRes=-40 gosub *text_cw_lookback:goto *text_cw ;↑
goto *text_cwlp
;設定以外的變數輸入會Loop 這行一定要加,不然亂按按鈕會發生悲劇
;-----Click等待到左Click-----
*text_cw_next
vsp TextCC1SpNum,0:vsp TextCC2SpNum,0 ;這是搭配*csp就寫好的程式碼變數,與按鈕等待圖示的顯示有關
print 1
texec ;改頁等待的場合Text消去
;將TextWindow在Effect時非顯示
erasetextwindow 1
return
;-----Click等待到右Click-----
*text_cw_rclk
;Click等待Icon的非表示
csp -1
vsp TextCC1SpNum,0:vsp TextCC2SpNum,0
print 1
gosub *rmenu_custom ;跳到右鍵cutom程式
return
;-----回想------
*text_cw_lookback
vsp TextCC1SpNum,0
vsp TextCC2SpNum,0
print 1
gosub *backlog
return
如此可以做出下圖的遊戲畫面,
或許搭配大圖背景、隱形按鈕、矩陣、以及變數能做出SLG吧~~,或是RPG2000的遊戲畫面,只是何必呢?
接下來是selectbtnwait ,必需要搭配*customsel,這是在對話中使用「csel "點頭", *scene2_angel_a,"搖頭", *scene2b 」這種選像指令時,程式在等待玩家點擊選像時會去執行*customsel標籤下的指令,大致上使用方法與*text_cwlp一樣,只是要多加一個區塊
*customsel
skipoff
texton
getcselnum %2 ;計算選項有幾個並將數量代入%2
getcursorpos %0,%1
btndef clear
cselbtn 0,1,%0+24,%1+10:if %2=1 goto *csel_lp
cselbtn 1,2,%0+24,%1+45:if %2=2 goto *csel_lp
cselbtn 2,3,%0+24,%1+80:if %2=3 goto *csel_lp
cselbtn 3,4,%0+24,%1+115:if %2=4 goto *csel_lp
cselbtn 4,5,%0+24,%1+150:if %2=5 goto *csel_lp
cselbtn 5,6,%0+24,%1+185:if %2=6 goto *csel_lp
;這邊是定義按鈕出現位置
*csel_lp
……
selectbtnwait %BtnRes
……
以上這邊可以自行定義在選項出現時要執行哪些程式碼,甚至搭配 autoclick指令做出限時的效果(但有必要嗎?),要注意這邊的程式碼是整個遊戲共用的,所以若要在不同時期的選項做出不同效果,請多善用if判別式,還有在腳本進行中一定要用csel這個指令才會運用到這邊自行定義的程式碼,如何運用就靠自己的創意吧。
PR
【捨丸&KID】CG模式製作介紹
本周是CG模式製作介紹,其實沒什麼,就只是將實際原始碼貼上來稍做講解,畢竟前面都已經學很多了,應該要能看懂才對,另一方面我本人一定得看到程式碼實例才懂,所以我認為直接用實例介紹會比較方便,另外這個程式碼其實之前網路上就有了,並不是我寫的,但我會將我遇到的問題與大家分享。
「
*album
lsp 500,":a;sys/album.jpg",0,0 ;這是背景
lsp 10,":s/13,15,0,0;#ffffff#999999 EXIT",50,550 ;離開按鈕
goto *album_1
;因為下面本來有sub區段,所以要加這一句跳過,所謂sub區段要搭配gosub指令,最後加個return指令就可以返回原來的地方繼續程式碼,在遊戲進行中進到save load畫面跳回來能繼續遊戲是必要的指令
;*album_sub_1
;lsp 500,":a;sys/album.jpg",0,0
;lsp 10,":s/13,15,0,0;#ffffff#999999PAGE1",50,150
;lsp 11,":s/13,15,0,0;#ffffff#999999PAGE2",50,190
;lsp 12,":s/13,15,0,0;#ffffff#999999PAGE3",50,230
;lsp 13,":s/13,15,0,0;#ffffff#999999PAGE4",50,270
;lsp 14,":s/13,15,0,0;#ffffff#999999PAGE5",50,310
;return
;*album_sub_2
;spbtn 10,10:spbtn 11,11:spbtn 12,12:spbtn 13,13:spbtn 14,14
;return
;*album_sub_3
;if %BtnRes=10 csp -1:goto *album_1
;if %BtnRes=11 csp -1:goto *album_2
;if %BtnRes=12 csp -1:goto *album_3
;if %BtnRes=13 csp -1:goto *album_4
;if %BtnRes=14 csp -1:goto *album_5
;return
;大家看到這邊我把sub區段都註解掉了,這是為什麼呢?因為製作的時候只有12張CG,根本不需要換頁阿~~~
*album_end
btndef clear
csp -1
print 10,250
return
;-----這兒開始是ALBUM畫面-----
;-----PAGE1-----
*album_1
;gosub *album_sub_1
mov $1,"pic/01magician.jpg"
mov $2,"pic/02priestess.jpg"
mov $3,"pic/03empress.jpg"
mov $4,"pic/04emperor.jpg"
mov $5,"pic/05hierophant.jpg"
mov $6,"pic/06lovers.jpg"
mov $7,"pic/07chariot.jpg"
mov $8,"pic/08strength.jpg"
mov $9,"pic/09hermit.jpg"
mov $10,"pic/10wheel.jpg"
mov $11,"pic/11justice.jpg"
mov $12,"pic/12hangedman.jpg"
;上方是將圖片名稱輸入變數,可以讓程式碼簡潔一點,
lsp 101,($1)":c/2,0,3;pic/01magician_thum.jpg"":c;sys/nosee.jpg",50,100
lsp 102,($2)":c/2,0,3;pic/02priestess_thum.jpg"":c;sys/nosee.jpg",250,100
lsp 103,($3)":c/2,0,3;pic/03empress_thum.jpg"":c;sys/nosee.jpg",450,100
lsp 104,($4)":c/2,0,3;pic/04emperor_thum.jpg"":c;sys/nosee.jpg",650,100
lsp 105,($5)":c/2,0,3;pic/05hierophant_thum.jpg"":c;sys/nosee.jpg",50,240
lsp 106,($6)":c/2,0,3;pic/06lovers_thum.jpg"":c;sys/nosee.jpg",250,240
lsp 107,($7)":c/2,0,3;pic/07chariot_thum.jpg"":c;sys/nosee.jpg",450,240
lsp 108,($8)":c/2,0,3;pic/08strength_thum.jpg"":c;sys/nosee.jpg",650,240
lsp 109,($9)":c/2,0,3;pic/09hermit_thum.jpg"":c;sys/nosee.jpg",50,380
lsp 110,($10)":c/2,0,3;pic/10wheel_thum.jpg"":c;sys/nosee.jpg",250,380
lsp 111,($11)":c/2,0,3;pic/11justice_thum.jpg"":c;sys/nosee.jpg",450,380
lsp 112,($12)":c/2,0,3;pic/12hangedman_thum.jpg"":c;sys/nosee.jpg",650,380
;看到這一排程式碼應該大家都看不懂,我一開始也看不懂,112表示該SP圖的編號,($12)這個是關鍵指令,表示若在遊戲進行中$12也就是pic/12hangedman.jpg這張圖出現過的話,就執行":c/2,0,3;pic/12hangedman_thum.jpg"否則就執行":c;sys/nosee.jpg"最後面650,380是座標,換句話說如果圖片已經顯示過就會執行lsp 112, ":c/2,0,3;pic/12hangedman_thum.jpg",650,380否則就是lsp 112, ":c;sys/nosee.jpg",650,380,真是方便阿~~
print 16
btndef ""
;gosub *album_sub_2
spbtn 10,10
for %0 = 101 to 112
cellcheckspbtn %0,%0
next
; cellcheckspbtn這個指令是甚麼呢,就是檢查這個SP圖有無cell,有cell的才會做成按鈕,所以12hangedman_thum.jpg這張圖一定是要有cell的sys/nosee.jpg這張圖一定是要沒有cell的,如此就能做出只有顯示過的圖才能變成按鈕的CG模式
*album_1_lp
btnwait2 %BtnRes
;gosub *album_sub_3
if %BtnRes=0 goto *album_1_lp
if %BtnRes=-1 goto *album_end
if %BtnRes=10 goto *album_end
if %BtnRes=101 allsphide:bg $1,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=102 allsphide:bg $2,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=103 allsphide:bg $3,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=104 allsphide:bg $4,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=105 allsphide:bg $5,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=106 allsphide:bg $6,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=107 allsphide:bg $7,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=108 allsphide:bg $8,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=109 allsphide:bg $9,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=110 allsphide:bg $10,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=111 allsphide:bg $11,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=112 allsphide:bg $12,15:click:bg #000000,16:allspresume:goto *album_1
;這一連串指令就不用說明了吧,總之就是顯示CG,然後回到CG模式
;-----PAGE2-----
*album_2
gosub *album_sub_1
mov $1,"pic/test_10.jpg"
mov $2,"pic/test_11.jpg"
mov $3,"pic/test_12.jpg"
mov $4,"pic/test_13.jpg"
mov $5,"pic/test_14.jpg"
mov $6,"pic/test_15.jpg"
mov $7,"pic/test_16.jpg"
mov $8,"pic/test_17.jpg"
mov $9,"pic/test_18.jpg"
lsp 101,($1)":c/2,0,3;pic/test_10_thum.jpg"":c;sys/nosee.jpg",220,80
lsp 102,($2)":c/2,0,3;pic/test_11_thum.jpg"":c;sys/nosee.jpg",380,80
lsp 103,($3)":c/2,0,3;pic/test_12_thum.jpg"":c;sys/nosee.jpg",540,80
lsp 104,($4)":c/2,0,3;pic/test_13_thum.jpg"":c;sys/nosee.jpg",220,220
lsp 105,($5)":c/2,0,3;pic/test_14_thum.jpg"":c;sys/nosee.jpg",380,220
lsp 106,($6)":c/2,0,3;pic/test_15_thum.jpg"":c;sys/nosee.jpg",540,220
lsp 107,($7)":c/2,0,3;pic/test_16_thum.jpg"":c;sys/nosee.jpg",220,360
lsp 108,($8)":c/2,0,3;pic/test_17_thum.jpg"":c;sys/nosee.jpg",380,360
lsp 109,($9)":c/2,0,3;pic/test_18_thum.jpg"":c;sys/nosee.jpg",540,360
print 16
btndef ""
gosub *album_sub_2
for %0 = 101 to 109
cellcheckspbtn %0,%0
next
*album_2_lp
btnwait2 %BtnRes
gosub *album_sub_3
if %BtnRes=0 goto *album_2_lp
if %BtnRes=-1 goto *album_end
if %BtnRes=101 allsphide:bg $1,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=102 allsphide:bg $2,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=103 allsphide:bg $3,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=104 allsphide:bg $4,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=105 allsphide:bg $5,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=106 allsphide:bg $6,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=107 allsphide:bg $7,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=108 allsphide:bg $8,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=109 allsphide:bg $9,15:click:bg #000000,16:allspresume:goto *album_2
;==========CG MODE終了==========
;到此為止,隨便要做幾頁都沒問題~~
」
「
*album
lsp 500,":a;sys/album.jpg",0,0 ;這是背景
lsp 10,":s/13,15,0,0;#ffffff#999999 EXIT",50,550 ;離開按鈕
goto *album_1
;因為下面本來有sub區段,所以要加這一句跳過,所謂sub區段要搭配gosub指令,最後加個return指令就可以返回原來的地方繼續程式碼,在遊戲進行中進到save load畫面跳回來能繼續遊戲是必要的指令
;*album_sub_1
;lsp 500,":a;sys/album.jpg",0,0
;lsp 10,":s/13,15,0,0;#ffffff#999999PAGE1",50,150
;lsp 11,":s/13,15,0,0;#ffffff#999999PAGE2",50,190
;lsp 12,":s/13,15,0,0;#ffffff#999999PAGE3",50,230
;lsp 13,":s/13,15,0,0;#ffffff#999999PAGE4",50,270
;lsp 14,":s/13,15,0,0;#ffffff#999999PAGE5",50,310
;return
;*album_sub_2
;spbtn 10,10:spbtn 11,11:spbtn 12,12:spbtn 13,13:spbtn 14,14
;return
;*album_sub_3
;if %BtnRes=10 csp -1:goto *album_1
;if %BtnRes=11 csp -1:goto *album_2
;if %BtnRes=12 csp -1:goto *album_3
;if %BtnRes=13 csp -1:goto *album_4
;if %BtnRes=14 csp -1:goto *album_5
;return
;大家看到這邊我把sub區段都註解掉了,這是為什麼呢?因為製作的時候只有12張CG,根本不需要換頁阿~~~
*album_end
btndef clear
csp -1
print 10,250
return
;-----這兒開始是ALBUM畫面-----
;-----PAGE1-----
*album_1
;gosub *album_sub_1
mov $1,"pic/01magician.jpg"
mov $2,"pic/02priestess.jpg"
mov $3,"pic/03empress.jpg"
mov $4,"pic/04emperor.jpg"
mov $5,"pic/05hierophant.jpg"
mov $6,"pic/06lovers.jpg"
mov $7,"pic/07chariot.jpg"
mov $8,"pic/08strength.jpg"
mov $9,"pic/09hermit.jpg"
mov $10,"pic/10wheel.jpg"
mov $11,"pic/11justice.jpg"
mov $12,"pic/12hangedman.jpg"
;上方是將圖片名稱輸入變數,可以讓程式碼簡潔一點,
lsp 101,($1)":c/2,0,3;pic/01magician_thum.jpg"":c;sys/nosee.jpg",50,100
lsp 102,($2)":c/2,0,3;pic/02priestess_thum.jpg"":c;sys/nosee.jpg",250,100
lsp 103,($3)":c/2,0,3;pic/03empress_thum.jpg"":c;sys/nosee.jpg",450,100
lsp 104,($4)":c/2,0,3;pic/04emperor_thum.jpg"":c;sys/nosee.jpg",650,100
lsp 105,($5)":c/2,0,3;pic/05hierophant_thum.jpg"":c;sys/nosee.jpg",50,240
lsp 106,($6)":c/2,0,3;pic/06lovers_thum.jpg"":c;sys/nosee.jpg",250,240
lsp 107,($7)":c/2,0,3;pic/07chariot_thum.jpg"":c;sys/nosee.jpg",450,240
lsp 108,($8)":c/2,0,3;pic/08strength_thum.jpg"":c;sys/nosee.jpg",650,240
lsp 109,($9)":c/2,0,3;pic/09hermit_thum.jpg"":c;sys/nosee.jpg",50,380
lsp 110,($10)":c/2,0,3;pic/10wheel_thum.jpg"":c;sys/nosee.jpg",250,380
lsp 111,($11)":c/2,0,3;pic/11justice_thum.jpg"":c;sys/nosee.jpg",450,380
lsp 112,($12)":c/2,0,3;pic/12hangedman_thum.jpg"":c;sys/nosee.jpg",650,380
;看到這一排程式碼應該大家都看不懂,我一開始也看不懂,112表示該SP圖的編號,($12)這個是關鍵指令,表示若在遊戲進行中$12也就是pic/12hangedman.jpg這張圖出現過的話,就執行":c/2,0,3;pic/12hangedman_thum.jpg"否則就執行":c;sys/nosee.jpg"最後面650,380是座標,換句話說如果圖片已經顯示過就會執行lsp 112, ":c/2,0,3;pic/12hangedman_thum.jpg",650,380否則就是lsp 112, ":c;sys/nosee.jpg",650,380,真是方便阿~~
print 16
btndef ""
;gosub *album_sub_2
spbtn 10,10
for %0 = 101 to 112
cellcheckspbtn %0,%0
next
; cellcheckspbtn這個指令是甚麼呢,就是檢查這個SP圖有無cell,有cell的才會做成按鈕,所以12hangedman_thum.jpg這張圖一定是要有cell的sys/nosee.jpg這張圖一定是要沒有cell的,如此就能做出只有顯示過的圖才能變成按鈕的CG模式
*album_1_lp
btnwait2 %BtnRes
;gosub *album_sub_3
if %BtnRes=0 goto *album_1_lp
if %BtnRes=-1 goto *album_end
if %BtnRes=10 goto *album_end
if %BtnRes=101 allsphide:bg $1,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=102 allsphide:bg $2,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=103 allsphide:bg $3,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=104 allsphide:bg $4,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=105 allsphide:bg $5,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=106 allsphide:bg $6,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=107 allsphide:bg $7,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=108 allsphide:bg $8,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=109 allsphide:bg $9,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=110 allsphide:bg $10,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=111 allsphide:bg $11,15:click:bg #000000,16:allspresume:goto *album_1
if %BtnRes=112 allsphide:bg $12,15:click:bg #000000,16:allspresume:goto *album_1
;這一連串指令就不用說明了吧,總之就是顯示CG,然後回到CG模式
;-----PAGE2-----
*album_2
gosub *album_sub_1
mov $1,"pic/test_10.jpg"
mov $2,"pic/test_11.jpg"
mov $3,"pic/test_12.jpg"
mov $4,"pic/test_13.jpg"
mov $5,"pic/test_14.jpg"
mov $6,"pic/test_15.jpg"
mov $7,"pic/test_16.jpg"
mov $8,"pic/test_17.jpg"
mov $9,"pic/test_18.jpg"
lsp 101,($1)":c/2,0,3;pic/test_10_thum.jpg"":c;sys/nosee.jpg",220,80
lsp 102,($2)":c/2,0,3;pic/test_11_thum.jpg"":c;sys/nosee.jpg",380,80
lsp 103,($3)":c/2,0,3;pic/test_12_thum.jpg"":c;sys/nosee.jpg",540,80
lsp 104,($4)":c/2,0,3;pic/test_13_thum.jpg"":c;sys/nosee.jpg",220,220
lsp 105,($5)":c/2,0,3;pic/test_14_thum.jpg"":c;sys/nosee.jpg",380,220
lsp 106,($6)":c/2,0,3;pic/test_15_thum.jpg"":c;sys/nosee.jpg",540,220
lsp 107,($7)":c/2,0,3;pic/test_16_thum.jpg"":c;sys/nosee.jpg",220,360
lsp 108,($8)":c/2,0,3;pic/test_17_thum.jpg"":c;sys/nosee.jpg",380,360
lsp 109,($9)":c/2,0,3;pic/test_18_thum.jpg"":c;sys/nosee.jpg",540,360
print 16
btndef ""
gosub *album_sub_2
for %0 = 101 to 109
cellcheckspbtn %0,%0
next
*album_2_lp
btnwait2 %BtnRes
gosub *album_sub_3
if %BtnRes=0 goto *album_2_lp
if %BtnRes=-1 goto *album_end
if %BtnRes=101 allsphide:bg $1,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=102 allsphide:bg $2,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=103 allsphide:bg $3,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=104 allsphide:bg $4,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=105 allsphide:bg $5,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=106 allsphide:bg $6,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=107 allsphide:bg $7,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=108 allsphide:bg $8,15:click:bg #000000,16:allspresume:goto *album_2
if %BtnRes=109 allsphide:bg $9,15:click:bg #000000,16:allspresume:goto *album_2
;==========CG MODE終了==========
;到此為止,隨便要做幾頁都沒問題~~
」
重大更新
New Entries
(02/16)
(12/03)
(10/30)
(10/03)
(09/19)
Categories
Search
推廣遊戲
─歡迎交換連結─
Banner放置處