AndrewofDoom

Untitled

May 19th, 2013
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. #Global Hooks
  2.  
  3. $GameInit:
  4. [
  5. if cf.fileExists("vn.tbl",".\data\vn\",true) then
  6. --load vn constants.
  7. --Initialize variables for state machine.
  8. VN_STATE_INIT = -1 --This is the state that's set when the vn stage just changed.
  9. VN_STATE_CREATE_BACKGROUND = 0
  10. VN_STATE_INIT_UI_COMP = 1
  11. VN_STATE_TEXT_DRAW = 2
  12. VN_STATE_CHARACTER_GEN = 3
  13. VN_STATE_STAGE_TRANSITION = 4
  14. VN_STATE_CHARACTER_TRANSITION = 5
  15. VN_STATE_WAITING = 6 --Everything's loaded. Waiting for player input in this state.
  16. VN_STATE_TRANSITION_CHOICE = 7
  17. VN_STATE_ACTIVATE_CHOICE = 8
  18. VN_STATE_CHOICE_SELECTED = 9
  19. VN_STATE_END = 10
  20.  
  21. --background transition state.
  22. VN_TRANSITION_FADE = 0
  23. VN_TRANSITION_CROSSFADE = 1
  24.  
  25. --character transition state
  26. VN_CTRANISTION_FADE = 0
  27. VN_CTRANSITION_ROTATE = 1
  28.  
  29. --begin file openning.
  30. local file_vntbl = cf.openFile("vn.tbl","r",".\data\vn\")
  31. vntbl_parse_skip_this = false
  32. if file_vntbl.isValid() then
  33. local item_read = file_vntbl.read("*l")
  34. while item_read ~= nil do
  35.  
  36. --scan for comments like these~!
  37. item_read = strip_comment(item_read)
  38. if vntbl_parse_skip_this ~= true then
  39.  
  40. else
  41. vntbl_parse_skip_this = false
  42. end
  43.  
  44.  
  45. item_read = file_vntbl.read("*l") --read next line and reevaluate conditional.
  46. end
  47. bool_vntblactive = true
  48. file_vntbl.close()
  49. else
  50. ba.warn("vn.tbl loading failure. Something went wrong!")
  51. end
  52.  
  53. end
  54.  
  55. function strip_comment(str_line)
  56. local comment_index1 = string.find(str_line, ";")
  57. if comment_index1 ~= nil then
  58. if comment_index1 = 1 then --if line starts with a semicolon then skip this entirely
  59. vntbl_parse_skip_this = true
  60. else
  61. to_parse1 = string.sub(str_line,1,(comment_index1 - 1))
  62. return to_parse1
  63. end
  64. end
  65.  
  66. end
  67.  
  68. function lineParse(str_s)
  69.  
  70.  
  71. end
  72. ]
  73.  
  74. #Conditional Hooks
  75.  
  76. $State: GS_STATE_CMD_BRIEF
  77.  
  78. $On State Start:
  79. [
  80. if bool_vntblactive == true then
  81. boolean_IsVNActive = false
  82. local str_MissionName = getMissionFilename() .. "-vn.tbm"
  83. if cf.fileExists(str_MissionName,".\data\vn\",true) then
  84.  
  85. file_vn = cf.openFile(str_MissionName,"r",".\data\vn\")
  86. if file_vn.isValid() then
  87. --file parsing here
  88. local item_read = file_vn.read("*l")
  89. while item_read ~= nil do
  90.  
  91. item_read = file_vn.read("*l")
  92. end
  93. vnState = VN_STATE_INIT
  94. boolean_IsVNActive = true --ready to start!
  95. file_vn.close()
  96. else
  97. ba.warn("file " .. str_MissionName .. " was not able to be openned properly! Reverting to normal command briefing."
  98. --failure block
  99. end
  100. end
  101. --If vn file doesn't exist, then we just resume as normal.
  102. end
  103. --If vn.tbl doesn't exist or wasn't loaded right, we continue using the normal CB code.
  104. ]
  105.  
  106. $On Frame:
  107.  
  108. [
  109. if boolean_IsVNActive == true then
  110.  
  111. if vnState = VN_STATE_END then
  112. --ba.postGameEvent(gameevent Event)
  113. end
  114. end
  115. ]
  116.  
  117. #End
Advertisement
Add Comment
Please, Sign In to add comment