Visual Novel Maker

Visual Novel Maker

Kinder 2017 年 12 月 18 日 上午 4:14
About scripters' guide. How to call script in game
In the turtorial chapter "about scripter's guide"
the first chapter "Setup a test bed".
I follow the turtoril to create the scirpt componet_testbehaviour as file under componets/scene

But I confused that why the tutorial just tell to run the game and test the scripts now
The tutorial did not say how to "call the script"

Does the tutorial mean the script at such folder/hirachy would run automaically at start?

But I did not see any thing works when I try to run the game.

I also tried copy/paste all codes on a script tag in game editor but seems not work also.

I want to show something on the backgound anytime and anyplace I want and can be move and interactive by mouse click then store variables in the game as a result. But I can't get how from the tutorial.

Would you give me some tip?


The test bed code
# ===================================================================
#
# Script: Component_TestBedBehavior
#
# Put your name here
#
# ===================================================================
class Component_TestBedBehavior extends gs.Component_SceneBehavior
###*
* A test bed scene behavior. Here you can play around with Visual Novel Maker's
* game engine to get a better feeling for everything.
###
constructor: ->
super()
###*
* Initializes the scene.
###
initialize: ->
super
###*
* Disposes the scene.
###
dispose: ->
super

###*
* Prepares all visual game object for the scene.
###
prepareVisual: ->
# Create a new quad graphic object.
@quad = new gs.Quad(Graphics.viewport)

# Setup the size of the rectangle
@quad.rect.width = 100
@quad.rect.height = 100

# Setup the position on screen. We make it centered.
@quad.rect.x = (Graphics.width - @quad.rect.width) / 2
@quad.rect.y = (Graphics.height - @quad.rect.height) / 2

# Set the color of the rectangle.
@quad.color.set(255, 0, 0, 255)

# We are done with preparing our visual objects. So we can start
# the screen transition to fade in our new created objects smoothly.
@transition()

###*
* Prepares all data for the scene and loads the necessary graphic and audio resources.
###
prepareData: ->

###*
* Update the scene's content.
###
updateContent: ->

gs.Component_LayoutSceneBehavior = Component_TestBedBehavior
最后由 Kinder 编辑于; 2017 年 12 月 18 日 上午 4:17
< >
正在显示第 1 - 4 条,共 4 条留言
Kentou  [开发者] 2017 年 12 月 19 日 上午 6:11 
Hi, the problem here is probably the indentation of the code. I remember a similar issue from another user. When you copy it from the help file and paste it into vn maker, the indentation of the script gets lost in some cases. Since CoffeeScript is an indentation sensitive language, same like Python, the script will not work correctly then.

Does the tutorial mean the script at such folder/hirachy would run automaically at start?
In that special case yes, that was the idea that you just put that one script in and you can easily play around without too much configuration.

Make sure the statements under the methods are correctly indentend/shifted. So instead of:

constructor: -> super()
make it

constructor: -> super()

I put the entire script on pastebin just in case so you can try to copy and paste it again from there:

https://pastebin.com/raw/yEAvqYB5

Let me know if that helps you out.
最后由 Kentou 编辑于; 2017 年 12 月 19 日 上午 6:12
Kinder 2017 年 12 月 19 日 下午 7:27 
引用自 Kentou
Hi, the problem here is probably the indentation of the code. I remember a similar issue from another user. When you copy it from the help file and paste it into vn maker, the indentation of the script gets lost in some cases. Since CoffeeScript is an indentation sensitive language, same like Python, the script will not work correctly then.

Does the tutorial mean the script at such folder/hirachy would run automaically at start?
In that special case yes, that was the idea that you just put that one script in and you can easily play around without too much configuration.

Make sure the statements under the methods are correctly indentend/shifted. So instead of:

constructor: -> super()
make it

constructor: -> super()

I put the entire script on pastebin just in case so you can try to copy and paste it again from there:

https://pastebin.com/raw/yEAvqYB5

Let me know if that helps you out.


I am sorry,I may not catch the point. The code I copy paste here just rearranged by the forum.My actual code got the right style(space before super).I copy paste your code and seems they are the same
I may did not put the the right things.
Let me repeat my job.
1.create a new file(coffee script) under compoent/scenes/
2.rename it to Component_TestBedBehavior
3.copy/paste the code from here https://pastebin.com/raw/yEAvqYB5 and make sure there is space in front of super()
4.save the game and run a blank game scene.

So the "run game" means what? Does it mean start t he game from any scene or somewhere to active the script?
I made a blank(no tag) new scene and start the game from it(as intro scene),there is nothing showed.

最后由 Kinder 编辑于; 2017 年 12 月 19 日 下午 7:31
Kentou  [开发者] 2017 年 12 月 19 日 下午 11:28 
Hi, ok I maybe I should put more info about that into that help section.

1. It is important you have no intro scene set. Go to Database > System and uncheck Intro Scene.

2. Make sure that your new CoffeeScript file is placed below Component_LayoutSceneBehavior and not above.

Then just start the game by clicking the green play button from the toolbar. Don't worry which start scene you have selected since that scene will not be triggered anyway. Then you should see a red rectangle in the center of the screen.

Let me know if that helps you out.
最后由 Kentou 编辑于; 2017 年 12 月 19 日 下午 11:29
Kinder 2017 年 12 月 20 日 上午 12:53 
OK. I see the red and very thanks.
But I'd like to make minigames in the scene(show and play at the time I require but not only at start) but not just override the startscene.
I'll learn your tutoral first and ask later if got question.Thanks!
最后由 Kinder 编辑于; 2017 年 12 月 20 日 上午 12:54
< >
正在显示第 1 - 4 条,共 4 条留言
每页显示数: 1530 50

发帖日期: 2017 年 12 月 18 日 上午 4:14
回复数: 4