忍者ブログ

[PR]

×

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

【捨丸&KID】SAVE與LOAD自訂界面

 

SAVE與LOAD要自訂界面非常容易,只要不使用預設的按鈕,自己製作一的按鈕叫SAVE或LOAD,並連到自己做好的*save 或 *load標籤就可以,以下也是參考前人模組改寫的:
;==========Save制御==========
*save
goto *save_1

;-----簡略化Subroutine-----
*save_sub_1
lsp 500,":a;sys/save.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
lsp 15,":s/13,15,0,0;#ffffff#999999EXIT",50,500
return
;這邊先製作頁碼按鈕與跳出按鈕的圖
*save_sub_2
;spbtn 10,101:spbtn 11,102:spbtn 12,103:spbtn 13,104:spbtn 14,105
exbtn 10,101,"P10,1S4,(se\maoudamashii_system40.wav)"
exbtn 11,102,"P11,1S4,(se\maoudamashii_system40.wav)"
exbtn 12,103,"P12,1S4,(se\maoudamashii_system40.wav)"
exbtn 13,104,"P13,1S4,(se\maoudamashii_system40.wav)"
exbtn 14,105,"P14,1S4,(se\maoudamashii_system40.wav)"
exbtn 15,106,"P15,1S4,(se\maoudamashii_system40.wav)"
;為了華麗改用exbtn

return
;只要是sub區塊 用gosub指令就一定要加return,才可以跳回原本的地方


save_check_sub
csp-1
lsp 99,":a;sys/save.jpg",0,0
lsp 51,":s/13,15,0,0;#ffffff確定要儲存檔案嗎?",290,200
lsp 52,":s/13,15,0,0;#ffffff#999999YES",310,230
lsp 53,":s/13,15,0,0;#ffffff#999999NO",450,230

btndef ""
exbtn 52,11,"P52,1S4,(se\maoudamashii_system40.wav)"
exbtn 53,12,"P53,1S4,(se\maoudamashii_system40.wav)"
;save check box要變華麗的話請先有華麗的素材~~

*save_check_sub_lp
btnwait2 %BtnRes
if %BtnRes=0 goto *save_check_sub_lp
if %BtnRes=-1 mov %BtnRes2,2:csp -1:return
if %BtnRes=11 mov %BtnRes2,1:csp -1:return
if %BtnRes=12 mov %BtnRes2,2:csp -1:return

goto *save_check_sub_lp
;-----日期取得-----
*save_time
mov $1,""
savetime %1,%2,%3,%4,%5
itoa2 $2,%2:add $1,$2:add $1,"月"
itoa2 $2,%3:add $1,$2:add $1,"日"
itoa2 $2,%4:add $1,$2:add $1,"時"
itoa2 $2,%5:add $1,$2:add $1,"分"
return
;-----日期取得到此-----


;-----Save畫面跳出-----
*save_end
btndef clear
csp -1
print 10,250
deletescreenshot ;砍掉遊戲截圖
mov %BtnRes,50
;為啥要多這個「mov %BtnRes,50」奇怪的指令咧,因為在sub區塊用btnwait相關指令,不知道為啥輸入的變數會直接再傳到return之後遇到的第一個btnwait 或是 textbtnwait,然後程式碼就亂跳了,非常歡樂,所以我習慣再跳回去之前輸入一個什麼意義都沒有的數字,在這裡是隨便輸入一個50,其實要輸入什麼數值都可以。
return
;-----Save跳出到此-----
;-----Subroutine到此-----

;-----Save畫面處理-----
;-----PAGE1-----
*save_1

gosub *save_sub_1
lsp 101,":s/13,15,0,0;#ffffff#999999DATA1",250,50
lsp 102,":s/13,15,0,0;#ffffff#999999DATA2",250,120
lsp 103,":s/13,15,0,0;#ffffff#999999DATA3",250,190
lsp 104,":s/13,15,0,0;#ffffff#999999DATA4",250,260
lsp 105,":s/13,15,0,0;#ffffff#999999DATA5",250,330
lsp 106,":s/13,15,0,0;#ffffff#999999DATA6",250,400
lsp 107,":s/13,15,0,0;#ffffff#999999DATA7",250,470
lsp 108,":s/13,15,0,0;#ffffff#999999DATA8",250,540
lsp 201,":s/13,15,0,0;#ffffff$901",350,50
lsp 202,":s/13,15,0,0;#ffffff$902",350,120
lsp 203,":s/13,15,0,0;#ffffff$903",350,190
lsp 204,":s/13,15,0,0;#ffffff$904",350,260
lsp 205,":s/13,15,0,0;#ffffff$905",350,330
lsp 206,":s/13,15,0,0;#ffffff$906",350,400
lsp 207,":s/13,15,0,0;#ffffff$907",350,470
lsp 208,":s/13,15,0,0;#ffffff$908",350,540

savefileexist %101,1
savefileexist %102,2
savefileexist %103,3
savefileexist %104,4
savefileexist %105,5
savefileexist %106,6
savefileexist %107,7
savefileexist %108,8
;這邊是如果該savefile8存在,就將1的數值輸入%108,否則就是0
if %101=1 lsp 301,":c/1,0,3;savedata/save01.bmp",520,25
if %102=1 lsp 302,":c/1,0,3;savedata/save02.bmp",620,100
if %103=1 lsp 303,":c/1,0,3;savedata/save03.bmp",520,170
if %104=1 lsp 304,":c/1,0,3;savedata/save04.bmp",620,240
if %105=1 lsp 305,":c/1,0,3;savedata/save05.bmp",520,310
if %106=1 lsp 306,":c/1,0,3;savedata/save06.bmp",620,380
if %107=1 lsp 307,":c/1,0,3;savedata/save07.bmp",520,450
if %108=1 lsp 308,":c/1,0,3;savedata/save08.bmp",620,520
notif %101=1 lsp 301,":c/1,0,3;sys/save00.bmp",520,25
notif %102=1 lsp 302,":c/1,0,3;sys/save00.bmp",620,100
notif %103=1 lsp 303,":c/1,0,3;sys/save00.bmp",520,170
notif %104=1 lsp 304,":c/1,0,3;sys/save00.bmp",620,240
notif %105=1 lsp 305,":c/1,0,3;sys/save00.bmp",520,310
notif %106=1 lsp 306,":c/1,0,3;sys/save00.bmp",620,380
notif %107=1 lsp 307,":c/1,0,3;sys/save00.bmp",520,450
notif %108=1 lsp 308,":c/1,0,3;sys/save00.bmp",620,520
;這邊是呈現縮圖的程式碼 save00.bmp可以是透明圖,或是nodata之類的
print 16

btndef ""
gosub *save_sub_2



exbtn 101,1,"P101,1S4,(se\maoudamashii_system40.wav)"
exbtn 102,2,"P102,1S4,(se\maoudamashii_system40.wav)"
exbtn 103,3,"P103,1S4,(se\maoudamashii_system40.wav)"
exbtn 104,4,"P104,1S4,(se\maoudamashii_system40.wav)"
exbtn 105,5,"P105,1S4,(se\maoudamashii_system40.wav)"
exbtn 106,6,"P106,1S4,(se\maoudamashii_system40.wav)"
exbtn 107,7,"P107,1S4,(se\maoudamashii_system40.wav)"
exbtn 108,8,"P108,1S4,(se\maoudamashii_system40.wav)"
;在這邊要稍稍注意一下按鈕的音效是在哪一個頻道,如果跟遊戲進行中使用的頻道相同,會使得return之後原本正在播放的音效中斷
*save_1_lp
btnwait2 %BtnRes


if %BtnRes=0 goto *save_1_lp
if %BtnRes=-1 goto *save_end
if %BtnRes=-10 goto *save_end
if %BtnRes=1 gosub *save_check_sub:if %BtnRes2=1 savegame 1:savescreenshot2 "savedata/save01.bmp":mov %1,1:gosub *save_time:mov $901,$1:csp -1:goto *save_1
if %BtnRes=2 gosub *save_check_sub:if %BtnRes2=1 savegame 2:savescreenshot2 "savedata/save02.bmp":mov %1,2:gosub *save_time:mov $902,$1:csp -1:goto *save_1
if %BtnRes=3 gosub *save_check_sub:if %BtnRes2=1 savegame 3:savescreenshot2 "savedata/save03.bmp":mov %1,3:gosub *save_time:mov $903,$1:csp -1:goto *save_1
if %BtnRes=4 gosub *save_check_sub:if %BtnRes2=1 savegame 4:savescreenshot2 "savedata/save04.bmp":mov %1,4:gosub *save_time:mov $904,$1:csp -1:goto *save_1
if %BtnRes=5 gosub *save_check_sub:if %BtnRes2=1 savegame 5:savescreenshot2 "savedata/save05.bmp":mov %1,5:gosub *save_time:mov $905,$1:csp -1:goto *save_1
if %BtnRes=6 gosub *save_check_sub:if %BtnRes2=1 savegame 6:savescreenshot2 "savedata/save06.bmp":mov %1,6:gosub *save_time:mov $906,$1:csp -1:goto *save_1
if %BtnRes=7 gosub *save_check_sub:if %BtnRes2=1 savegame 7:savescreenshot2 "savedata/save07.bmp":mov %1,7:gosub *save_time:mov $907,$1:csp -1:goto *save_1
if %BtnRes=8 gosub *save_check_sub:if %BtnRes2=1 savegame 8:savescreenshot2 "savedata/save08.bmp":mov %1,8:gosub *save_time:mov $908,$1:csp -1:goto *save_1
;搭配之前的程式碼,要按yes %BtnRes2才會等於1,才會繼續執行下去 「savescreenshot2 "savedata/save08.bmp"」就是儲存遊戲截圖 「gosub *save_time:mov $908,$1」這兩行指令是用來顯示當時遊戲時間用的。

if %BtnRes=101 csp -1:goto *save_1
if %BtnRes=102 csp -1:goto *save_2
if %BtnRes=103 csp -1:goto *save_3
if %BtnRes=104 csp -1:goto *save_4
if %BtnRes=105 csp -1:goto *save_5
if %BtnRes=106 csp -1:goto *save_end

goto *save_1
;這行不加的話用滑鼠滾輪可能會滑到意外的程式碼區塊唷
;-----PAGE2-----
*save_2
……
……
;-----PAGE5-----
*save_5
……
;==========Save制御終了==========
基本上要做幾頁就做幾頁吧,除了按鈕編號不同其他都一樣,但NS遊戲應該不至於要記錄上百次才對
做出來長這樣,按鈕位置什麼的就自己調整吧!

接下來是load,load比起save來說容易多了,就只是要check有沒有檔案存在就好,程式碼如下:
;==========Load制御==========
*load
goto *load_1

;-----簡略化Subroutine-----
*load_sub_1
lsp 500,":a;sys/load.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
lsp 15,":s/13,15,0,0;#ffffff#999999EXIT",50,500
return
*load_sub_2
;spbtn 10,101:spbtn 11,102:spbtn 12,103:spbtn 13,104:spbtn 14,105

exbtn 10,101,"P10,1S4,(se\maoudamashii_system40.wav)"
exbtn 11,102,"P11,1S4,(se\maoudamashii_system40.wav)"
exbtn 12,103,"P12,1S4,(se\maoudamashii_system40.wav)"
exbtn 13,104,"P13,1S4,(se\maoudamashii_system40.wav)"
exbtn 14,105,"P14,1S4,(se\maoudamashii_system40.wav)"
exbtn 15,106,"P15,1S4,(se\maoudamashii_system40.wav)"

return

*load_check_sub
csp -1
lsp 99,":a;sys/load.jpg",0,0
lsp 51,":s/13,15,0,0;#ffffff確定要讀取檔案嗎?",290,200
lsp 52,":s/13,15,0,0;#ffffff#999999YES",310,230
lsp 53,":s/13,15,0,0;#ffffff#999999NO",450,230

mov %BtnRes2,0

btndef ""
exbtn 52,11,"P52,1S4,(se\maoudamashii_system40.wav)"
exbtn 53,12,"P53,1S4,(se\maoudamashii_system40.wav)"

*load_check_sub_lp
btnwait2 %BtnRes
if %BtnRes=0 goto *save_check_sub_lp
if %BtnRes=-1 csp -1:mov %BtnRes2,2:return
if %BtnRes=11 csp -1:mov %BtnRes2,1:return
if %BtnRes=12 csp -1:mov %BtnRes2,2:return
;-----Load畫面跳出-----
*load_end
btndef clear
csp -1
print 10,250
deletescreenshot
mov %BtnRes,50
return
;-----Load跳出到此-----
;-----Subroutine到此-----

;-----PAGE1-----
*load_1

gosub *load_sub_1

lsp 101,":s/13,15,0,0;#ffffff#999999DATA1",250,50
lsp 102,":s/13,15,0,0;#ffffff#999999DATA2",250,120
lsp 103,":s/13,15,0,0;#ffffff#999999DATA3",250,190
lsp 104,":s/13,15,0,0;#ffffff#999999DATA4",250,260
lsp 105,":s/13,15,0,0;#ffffff#999999DATA5",250,330
lsp 106,":s/13,15,0,0;#ffffff#999999DATA6",250,400
lsp 107,":s/13,15,0,0;#ffffff#999999DATA7",250,470
lsp 108,":s/13,15,0,0;#ffffff#999999DATA8",250,540
lsp 201,":s/13,15,0,0;#ffffff$901",350,50
lsp 202,":s/13,15,0,0;#ffffff$902",350,120
lsp 203,":s/13,15,0,0;#ffffff$903",350,190
lsp 204,":s/13,15,0,0;#ffffff$904",350,260
lsp 205,":s/13,15,0,0;#ffffff$905",350,330
lsp 206,":s/13,15,0,0;#ffffff$906",350,400
lsp 207,":s/13,15,0,0;#ffffff$907",350,470
lsp 208,":s/13,15,0,0;#ffffff$908",350,540

print 16

btndef ""
gosub *load_sub_2
savefileexist %101,1
savefileexist %102,2
savefileexist %103,3
savefileexist %104,4
savefileexist %105,5
savefileexist %106,6
savefileexist %107,7
savefileexist %108,8
if %101=1 lsp 301,":c/1,0,3;savedata/save01.bmp",520,25:exbtn 101,1,"P101,1S4,(se\maoudamashii_system40.wav)"
if %102=1 lsp 302,":c/1,0,3;savedata/save02.bmp",620,100:exbtn 102,2,"P102,1S4,(se\maoudamashii_system40.wav)"
if %103=1 lsp 303,":c/1,0,3;savedata/save03.bmp",520,170:exbtn 103,3,"P103,1S4,(se\maoudamashii_system40.wav)"
if %104=1 lsp 304,":c/1,0,3;savedata/save04.bmp",620,240:exbtn 104,4,"P104,1S4,(se\maoudamashii_system40.wav)"
if %105=1 lsp 305,":c/1,0,3;savedata/save05.bmp",520,310:exbtn 105,5,"P105,1S4,(se\maoudamashii_system40.wav)"
if %106=1 lsp 306,":c/1,0,3;savedata/save06.bmp",620,380:exbtn 106,6,"P106,1S4,(se\maoudamashii_system40.wav)"
if %107=1 lsp 307,":c/1,0,3;savedata/save07.bmp",520,450:exbtn 107,7,"P107,1S4,(se\maoudamashii_system40.wav)"
if %108=1 lsp 308,":c/1,0,3;savedata/save08.bmp",620,520:exbtn 108,8,"P108,1S4,(se\maoudamashii_system40.wav)"
notif %101=1 lsp 301,":c/1,0,3;sys/save00.bmp",520,25
notif %102=1 lsp 302,":c/1,0,3;sys/save00.bmp",620,100
notif %103=1 lsp 303,":c/1,0,3;sys/save00.bmp",520,170
notif %104=1 lsp 304,":c/1,0,3;sys/save00.bmp",620,240
notif %105=1 lsp 305,":c/1,0,3;sys/save00.bmp",520,310
notif %106=1 lsp 306,":c/1,0,3;sys/save00.bmp",620,380
notif %107=1 lsp 307,":c/1,0,3;sys/save00.bmp",520,450
notif %108=1 lsp 308,":c/1,0,3;sys/save00.bmp",620,520


*load_1_lp
btnwait2 %BtnRes

if %BtnRes=0 goto *load_1_lp
if %BtnRes=-1 goto *load_end
if %BtnRes=-10 goto *load_end
if %BtnRes=1 gosub *load_check_sub:if %BtnRes2=1 csp -1:loadgame 1
if %BtnRes=2 gosub *load_check_sub:if %BtnRes2=1 csp -1:loadgame 2
if %BtnRes=3 gosub *load_check_sub:if %BtnRes2=1 csp -1:loadgame 3
if %BtnRes=4 gosub *load_check_sub:if %BtnRes2=1 csp -1:loadgame 4
if %BtnRes=5 gosub *load_check_sub:if %BtnRes2=1 csp -1:loadgame 5
if %BtnRes=6 gosub *load_check_sub:if %BtnRes2=1 csp -1:loadgame 6
if %BtnRes=7 gosub *load_check_sub:if %BtnRes2=1 csp -1:loadgame 7
if %BtnRes=8 gosub *load_check_sub:if %BtnRes2=1 csp -1:loadgame 8

if %BtnRes=101 csp -1:goto *load_1
if %BtnRes=102 csp -1:goto *load_2
if %BtnRes=103 csp -1:goto *load_3
if %BtnRes=104 csp -1:goto *load_4
if %BtnRes=105 csp -1:goto *load_5
if %BtnRes=106 csp -1:goto *load_end

goto *load_1


;-----PAGE2-----
……
程式碼跟畫面幾乎一樣,就不多說明了,當然想要自己調整成save與load是完全不同的風格是一定可以做到的,撇開畫面配置,所謂save與load其實也就只有savegame 1 和 loadgame 1 這兩個指令,因此想要在腳本進行中偷偷做一個玩家沒發覺的存檔,在玩家死掉(?)之後自動load,回到所謂的 checkpoint是很容易的。

 

 

拍手[4回]

PR

【捨丸&KID】backlog

 

回想模式很容易,關鍵指令就只有getlog與logsp,其他就只是按鈕的配置而已:
;==========BackLog(回想Mode)==========
;Return值Memo 左Click0 右Click-1 Space-11 Enter-19 Esc-10 Wheel上-2 Wheel下-3 ↑-40 ↓-42
*backlog
Texthide ;先把遊戲原本的文字框隱藏
csp -1

for %0 = 1 to 10
getlog $%0,%0
next
;將遊戲的log輸入,這邊是輸入10頁,只要文字框有換頁就算一頁,不管字數多少。

lsp 500,":a;sys/backlog.jpg",0,0
lsp 98,":c/2,0,3;sys/up.jpg",770,5
lsp 99,":c/2,0,3;sys/down.jpg",770,540

goto *log_1

;-----BackLog跳出-----
*log_end
btndef clear
csp -1
textshow
repaint
return

;-----Log1-----
*log_1
logsp 400,$1,40,30
;將輸入的log在這裡叫出,後面兩個數值是X 、Y值
print 16

btndef ""
spbtn 98,1:spbtn 99,2

*log_1_lp
getcursor
textbtnwait %BtnRes
if %BtnRes=-1 goto *log_end

;上(回去)判定
if %BtnRes=1 csp 400:goto *log_2
if %BtnRes=-2 csp 400:goto *log_2
if %BtnRes=-40 csp 400:goto *log_2

;下(前進)判定
if %BtnRes=2 goto *log_end
if %BtnRes=-3 goto *log_end
if %BtnRes=-42 goto *log_end

;以外的輸入
goto *log_1_lp



;-----Log2-----
*log_2
logsp 400,$2,40,30
print 16

btndef ""
spbtn 98,1:spbtn 99,2

*log_2_lp
getcursor
textbtnwait %BtnRes
if %BtnRes=-1 goto *log_end

;上(回去)判定
if %BtnRes=1 csp 400:goto *log_3
if %BtnRes=-2 csp 400:goto *log_3
if %BtnRes=-40 csp 400:goto *log_3

;下(前進)判定
if %BtnRes=2 csp 400:goto *log_1
if %BtnRes=-3 csp 400:goto *log_1
if %BtnRes=-42 csp 400:goto *log_1

;以外的輸入
goto *log_2_lp

;-----Log3-----
*log_3
……

 

 

拍手[4回]