PDA

View Full Version : Small Problem with the textgosub function from Ponscripter [Solved]


Keichi
2013-01-25, 07:43
Hello,

i'm currently working on a German Translation of Saya no Uta and use the Ponscripter Port from Winkiller for that.

I'm currently trying to use the Right click detection over textgosub from Narcissu for Saya no Uta, because it just looks totally ugly to use rmenu for it.

But i ran into a small Problem there, basicly everthing it working fine so far..

He draws the window, shows the text, and puts the Cursor Icon right after the end of the Text..

The Problem comes now.. After the End of a Line he just erases the window and the Text, and just shows the Cursor, until i left click, to get to the next line, where it then shows the first line and the next one. But again just till he draws the Cursor again, where he removes everything again from the screen, and only shows the cursor.

I know that the Problem must be somewhere in the textgosub routine, but i really can't find it, so i'm asking does anyone have an idea what would be the cause of it?

*define

automode
automode_time %autospeed
; Turning on global variables
globalon

kidokuskip
windowback
textgosub *text_lb
pretextgosub *pretext_lb

usewheel

; BGM aliases
stralias s01,"sound\s01.ogg"
stralias s02,"sound\s02.ogg"
stralias s03,"sound\s03.ogg"
stralias s04,"sound\s04.ogg"
stralias s05,"sound\s05.ogg"
stralias s05_psycho,"sound\s05_psycho.ogg"
stralias s06,"sound\s06.ogg"
stralias s07,"sound\s07.ogg"
stralias s08,"sound\s08.ogg"
stralias s09,"sound\s09.ogg"
stralias s09_2,"sound\s09_2.ogg"
stralias s10,"sound\s10.ogg"
stralias s11,"sound\s11.ogg"
stralias sayanouta,"sound\sayanouta.ogg" ; A mixed version of 沙耶の唄 and s05
stralias song_of_saya,"sound\song_of_saya.ogg" ;沙耶の唄
stralias shoes_of_glass,"sound\shoes_of_glass.ogg" ;ガラスの靴
stralias spectacle,"sound\sound0204.ogg" ;郁紀光景

=========================================

numalias sys_ispage,107
numalias temp_str,102
numalias temp_str2,161
numalias moji_x,128
numalias moji_y,129
numalias sys_vlog_num,130
numalias x,108
numalias y,109
numalias sys_log_ringstd,131
numalias LOGMAX,50
maxkaisoupage LOGMAX
numalias temp_num,120
numalias sys_log_ringcr,133
pindentstr basic
pbreakstr basic
numalias sys_logvoice_str,106
numalias sys_log_channel,132
numalias sys_log_voicefile,105
numalias sys_log_page,127

=========================================

numalias scene,222 ; Scene name for savegame

numalias badend,10 ; Bad end trigger
numalias ending,900 ; Ending trigger
numalias end1_clear,901 ; White ending trigger
numalias end2_clear,902 ; "Bad" end trigger
numalias end3_clear,903 ; "Mad" end trigger

numalias cgset_0,904 ; Beginning
numalias cgset_1,905 ; White end
numalias cgset_2,906 ; Middle
numalias cgset_3,907 ; Blossoming end
numalias cgset_4,908 ; Mad end

numalias lic_accepted,999

; Aliases for OST menu
numalias track_num,11
numalias repeat,12

; Aliases for CG menu
numalias cgpage,13
numalias cg_sel,14

; Aliases for config menu
numalias gro,500 ; Grotesque image switcher

numalias vol0,501
numalias vol1,502
numalias vol2,503
numalias vol3,504
numalias vol4,505
numalias vol5,506
numalias vol6,507
numalias vol7,508
numalias vol8,509
numalias vol9,510
numalias vol10,511
numalias vol11,512
numalias vol12,513
numalias volsfx,514
numalias volvoice,515
numalias volmp3,516

numalias fullscr,8

numalias movplay,517

numalias textspeed,518
numalias autospeed,519

; Use archive mode (if possible)
nsa
mode_ext

; Effects section
effect 2,6,500
effect 3,10,600
effect 4,13,3000
effect 5,10,1000
effect 6,6,500

effectcut
effect 10,10,500 ;Fade out
effect 11,18,2000,"data\effect.png" ;Cloud effect

effect 19,10,150

savename "^~~ Speichern ~~","^~~ Laden ~~","#"
savenumber 20

; This is it, no fancy right-click menus :(
;rmenu "^~~ Speichern ~~",save,"^~~ Laden ~~",load,"^",,"^~~ Log mode ~~",lookback,"^",,"^~~ Zurück zum Hauptmenü ~~",reset
;rmenu "^~~~ Klick mich ~~",systemmenu
menusetwindow 18,18,0,0,1,1,#484848
menuselectcolor #fc0000,#ffffff,#ffffff
selectcolor #fc0000,#ffffff




windoweffect 10,250

;lookbackbutton ":a;system\uoncur.bmp",":a;system\uoffcur.bmp",":a;system\doncur.bmp",":a;system\doffcur.bmp"


;h_mapfont 0,"fonts\SazanamiGothic-Cyrillic.ttf"
;h_mapfont 1,"fonts\DejaVuSansCondensed-Oblique.ttf"


===============================================================
h_rendering none, integer
h_mapfont 0, "fonts/face0.ttf"
h_mapfont 1, "fonts/face1.ttf"
h_mapfont 2, "fonts/face2.ttf"
h_mapfont 3, "fonts/face3.ttf"
h_mapfont 4, "fonts/face4.ttf"
h_mapfont 5, "fonts/face5.ttf"
h_mapfont 6, "fonts/face6.ttf"
h_mapfont 7, "fonts/face7.ttf"

clickstr "",2
===============================================================



; Game caption
caption "Saya no Uta - PONScripter Edition"

; Game version
versionstr "Saya no Uta PONScripter","(c) Nitro+"

localestring message_save_confirm "^ Spiel auf Speicherplatz (%s%n) speichern?"
localestring message_load_confirm "^ Möchtest du Spielstand (%s%n) laden?"
localestring message_reset_confirm "^ Möchtest du wirklich zum Hauptmenü zurück ?"
localestring message_yes "^ Ja
localestring message_no "^ Nein
localestring days "Son","Mon","Die","Mitt","Don","Fre","Sam"
localestring months "jan.","feb.","märz","apr.","mai","juni","juli.","aug","sept.","okt.","nov.","dec."
localestring message_save_exist "%a %b %i %_H:%i%M"




;h_defwindow "main", 130,358,540,240,fs_main, 0, 0,1, 1,5, #ffffff ,0 ,0,799,599
h_defwindow "main", 60 ,70 ,540,240 ,20 , 0, 0,%textspeed ,1,1,":a;data\f05.png",40,50
; Game logics section begin
game

; Allowing GUI buttons to be drawn normally
;windowback
; 0 - 8 sprites are used for GUI
;humanz 8

; Test

*text_lb

;cur
lsph 0,":a/7,160,0;data\cur00.png",0,0
;next-page
lsph 1,":a/5,160,0;data\cur01.png",0,0

ispage %sys_ispage
getcursorpos %x,%y
if %sys_ispage == 0 amsp 0,%x,%y,255:vsp 0,1:vsp 1,0
if %sys_ispage == 1 amsp 1,%x,%y+2,255:vsp 1,1:vsp 0,0
;vsp 0,1
;vsp 1,1


*textbtnloop

btndef clear


textbtnwait %11

;どこでもないところをクリック
if %11 == 0 goto *end_textbtn
;右クリック
if %11 == -1 vsp 0,0:vsp 1,0:gosub *systemmenu:vsp 0,1
if %11 == -2 vsp 0,0:gosub *backlog:vsp 0,1:goto *textbtnloop
;下方向スクロール
if %11 == -3 goto *end_textbtn



goto *textbtnloop


*end_textbtn

;ページクリアとカーソル非表示
texec
vsp 1,0
vsp 0,0
print 1

;改ページ(\)の時ボイスストップ
if %sys_ispage == 1 dwavestop 0


;ログ回想情報を更新
add %sys_log_ringstd,1
if %sys_log_ringstd > LOGMAX mov %sys_log_ringstd,1
mov %temp_num,%sys_log_ringstd

;split用の文字列作成
itoa $temp_str,%sys_log_channel
mov $%temp_num,$temp_str
add $%temp_num,"/"


saveon



return

*backlog
gosub *box9
;ログは1ページ目から表示
mov %sys_log_page,1

;ログが無かったら無反応
checkpage %temp_num,%sys_log_page
if %temp_num == 0 return

;その次のログが無かったら、logupは表示しない
checkpage %temp_num,%sys_log_page + 1
if %temp_num == 0 gosub *backlog_spload_logdown
if %temp_num == 1 gosub *backlog_spload

;ログ回想の画面を描画
gosub *backlog_drawing

;テキストだけを隠す
texthide

*backlog_loop

btndef clear

;ボタン定義
gosub *backlog_btndef

btnwait %11

;ログテキストをクリック
if %11 == 1 gosub *backlog_logtext:goto *backlog_loop

;どこでもないところをクリック:何もしない
if %11 == 0 goto *backlog_loop
;右クリック:戻る
if %11 == -1 goto *end_backlog
;上方向スクロール:ページ+1
if %11 == -2 goto *backlog_up
;下方向スクロール:ページ-1
if %11 == -3 goto *backlog_down

;ログアップ:ページ+1
if %11 == 2 goto *backlog_up
;ログダウン:ページ-1
if %11 == 3 goto *backlog_down

;このあとにページ判定が入るけど、処理的にまずいかも?
;サブルーチンで飛ばした後ラベル付きreturnで戻した方が確実かも

goto *backlog_loop

*end_backlog

;ログ回想の画面を破棄
gosub *backlog_spclear
;テキストウィンドウの更新領域に入らないかもしれないので、一度printする
print 1

;隠していたテキストを戻す
textshow

return

*backlog_up

;これ以上ログがなかったら無反応
checkpage %temp_num,%sys_log_page + 1
if %temp_num == 0 goto *backlog_loop

;次が最後ならlogupの矢印を消す
checkpage %temp_num,%sys_log_page + 2
if %temp_num == 0 csp 201


add %sys_log_page,1

;ログ画面の描画
gosub *backlog_drawing
print 1

goto *backlog_loop

*backlog_down

sub %sys_log_page,1

;最初まで戻ってきたら通常画面に戻る
if %sys_log_page <= 0 goto *end_backlog

;ログ画面の描画
gosub *backlog_spload
gosub *backlog_drawing
print 1

goto *backlog_loop

;――――――――――――ログ回想-画像の読み込み
*backlog_spload

lsp 201,":l/2,0,3;system\uoncur.bmp",776,0

*backlog_spload_logdown

lsp 202,":l/2,0,3;system\doncur.bmp",776,576

;sys\logupとsys\logdown
;sys\logdownは常に出すが、sys\logupは最後の時は消す。

return
;――――――――――――ログ回想-画像の破棄
*backlog_spclear

csp 200,202

return
;――――――――――――ログ回想-ボタン定義
*backlog_btndef

cellcheckspbtn 200,202,1

return
;――――――――――――ログ回想-画面描画
*backlog_drawing

getlog $temp_str,%sys_log_page

;say $temp_str

;ログ設定文字列を取得
;素直にリング位置番号に変換
mov %sys_log_ringcr,%sys_log_ringstd - %sys_log_page
;ログのリングをはみ出していたらリングの反対側へ
if %sys_log_ringcr <= -1 mov %sys_log_ringcr,LOGMAX + (%sys_log_ringstd - %sys_log_page)
;ログ設定文字列の格納された変数番号に変換
add %sys_log_ringcr,1
add %sys_log_ringcr,sys_logvoice_str - 1

;ログ設定文字列をばらす
mov $temp_str2,$%sys_log_ringcr
split $temp_str2,"/",%lg_sys_channel,$lg_sys_voicefile

;文章を表示(ボイスありなしで色とセル数変化)
if $lg_sys_voicefile == "" logsp2utf 200,$temp_str,%moji_x,%moji_y,17,17,0,3,#FFFFAA
if $lg_sys_voicefile != "" logsp2utf 200,$temp_str,%moji_x,%moji_y,17,17,0,3,#AAFFFF,#FFAAFF

;strsp 200,$temp_str,0,0,20,5,20,20,0,0,0,0,#FFFFFF,#FF0000
;logsp2 200,$temp_str,%moji_x,%moji_y,17,17,0,3,#FFFFAA,#AAFFFF

return


*pretext_lb

;画面の一番左上の文字の座標を知る(%sys_ispage == 1だと一番最初が認識不可能だから)
gettext $temp_str
if $temp_str == "" getcursorpos %moji_x,%moji_y:mov %sys_vlog_num,0

return


And a snippet of the first page:

h_usewindow "main"
if %vol2<>-1 dwave 0,"voice\2\000104.ogg"
;^"Url," the wriggling lump of flesh burbles, "jul qba'g jr tb fbzrjurer jvgu fxngvat sbe guvf lrne'f fxv gevc?"@
^"Url," die zappelnden Fleischklumpen plappern, "jul qba'g jr tb fbzrjurer jvgu fxngvat sbe guvf lrne'f fxv gevc?"@
dwavestop
br
if %vol4<>-1 dwave 0,"voice\2\000205.ogg"
;^"Fxngvat? Jul tb gb n fxv erfbeg gb fxngr?"@
^"Fxngvat? Jul tb gb n fxv erfbeg gb fxngr?"@
dwavestop
br
if %vol3<>-1 dwave 0,"voice\2\000302.ogg"
^"Unun. Tvir ure n oernx, Gfhxhon. Fur'f orra vagb fxngvat erpragyl."@
dwavestop
br
br
;^ Three such creatures are sitting around the table in front of me, slurping filthy sludge from their cups as they trade whines, growls, and sounds that I can hardly describe.\
^ Drei solcher Kreaturen sitzen vor mir am Tisch, schlürfen schmutzigen Schlamm aus ihren Bechern, fauchen und machen töne die ich kaum beschreiben kann.\

bg "cg\bp02me0.jpg",10,200

if %vol2<>-1 dwave 0,"voice\2\000404.ogg"
^"Url! Vf vg fb fgenatr gung V'q arire orra fxngvat orsber?"@
dwavestop
if %vol3<>-1 dwave 0,"voice\2\000502.ogg"
^"V qba'g guvax gurer'er znal svefg-gvzr fxngref va gurve gjragvrf gurfr qnlf."@
dwavestop
if %vol2<>-1 dwave 0,"voice\2\000604.ogg"
^"V jnf xvaqn fpnerq jura V jnf yvggyr. Gubfr fubrf frrzrq yvxr xavirf gb zr."\
dwavestop

Keichi
2013-01-29, 04:51
I solved it with a simple "Erasetextwindow 0" after the *start label and before the goto routine.