忍者ブログ

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

【捨丸&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這個指令才會運用到這邊自行定義的程式碼,如何運用就靠自己的創意吧。

 

 

拍手[1回]

PR

この記事にコメントする

お名前
タイトル
メール
URL
コメント
絵文字
Vodafone絵文字 i-mode絵文字 Ezweb絵文字
パスワード

この記事へのトラックバック

この記事にトラックバックする