Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Global Hooks
- $GameInit:
- [
- if cf.fileExists("vn.tbl",".\data\vn\",true) then
- --load vn constants.
- --Initialize variables for state machine.
- VN_STATE_INIT = -1 --This is the state that's set when the vn stage just changed.
- VN_STATE_CREATE_BACKGROUND = 0
- VN_STATE_INIT_UI_COMP = 1
- VN_STATE_TEXT_DRAW = 2
- VN_STATE_CHARACTER_GEN = 3
- VN_STATE_STAGE_TRANSITION = 4
- VN_STATE_CHARACTER_TRANSITION = 5
- VN_STATE_WAITING = 6 --Everything's loaded. Waiting for player input in this state.
- VN_STATE_TRANSITION_CHOICE = 7
- VN_STATE_ACTIVATE_CHOICE = 8
- VN_STATE_CHOICE_SELECTED = 9
- VN_STATE_END = 10
- --background transition state.
- VN_TRANSITION_FADE = 0
- VN_TRANSITION_CROSSFADE = 1
- --character transition state
- VN_CTRANISTION_FADE = 0
- VN_CTRANSITION_ROTATE = 1
- --begin file openning.
- local file_vntbl = cf.openFile("vn.tbl","r",".\data\vn\")
- vntbl_parse_skip_this = false
- if file_vntbl.isValid() then
- local item_read = file_vntbl.read("*l")
- while item_read ~= nil do
- --scan for comments like these~!
- item_read = strip_comment(item_read)
- if vntbl_parse_skip_this ~= true then
- else
- vntbl_parse_skip_this = false
- end
- item_read = file_vntbl.read("*l") --read next line and reevaluate conditional.
- end
- bool_vntblactive = true
- file_vntbl.close()
- else
- ba.warn("vn.tbl loading failure. Something went wrong!")
- end
- end
- function strip_comment(str_line)
- local comment_index1 = string.find(str_line, ";")
- if comment_index1 ~= nil then
- if comment_index1 = 1 then --if line starts with a semicolon then skip this entirely
- vntbl_parse_skip_this = true
- else
- to_parse1 = string.sub(str_line,1,(comment_index1 - 1))
- return to_parse1
- end
- end
- end
- function lineParse(str_s)
- end
- ]
- #Conditional Hooks
- $State: GS_STATE_CMD_BRIEF
- $On State Start:
- [
- if bool_vntblactive == true then
- boolean_IsVNActive = false
- local str_MissionName = getMissionFilename() .. "-vn.tbm"
- if cf.fileExists(str_MissionName,".\data\vn\",true) then
- file_vn = cf.openFile(str_MissionName,"r",".\data\vn\")
- if file_vn.isValid() then
- --file parsing here
- local item_read = file_vn.read("*l")
- while item_read ~= nil do
- item_read = file_vn.read("*l")
- end
- vnState = VN_STATE_INIT
- boolean_IsVNActive = true --ready to start!
- file_vn.close()
- else
- ba.warn("file " .. str_MissionName .. " was not able to be openned properly! Reverting to normal command briefing."
- --failure block
- end
- end
- --If vn file doesn't exist, then we just resume as normal.
- end
- --If vn.tbl doesn't exist or wasn't loaded right, we continue using the normal CB code.
- ]
- $On Frame:
- [
- if boolean_IsVNActive == true then
- if vnState = VN_STATE_END then
- --ba.postGameEvent(gameevent Event)
- end
- end
- ]
- #End
Advertisement
Add Comment
Please, Sign In to add comment