Your First Script

Below, you'll find the complete qScript from this tutorial. However, don't just take it at face value: customize it and make it your own! To learn more, refer to the full reference guide for details on each and every event, action, and function of VNgen.

Happy scripting!

Example

vngen_event_set_target();
if (vngen_event()) {
vngen_scene_create("bg", spr_background, 0, 0, 0, false, false, trans_fade, 2);
vngen_char_create("John Doe", spr_body, spr_face_idle, spr_face_talk, 0, 1080, 0, 180, 200, false, trans_slide_right, 2);
vngen_textbox_create("textbox", spr_textbox, 0, 1080, 0, trans_wipe_right, 2);
vngen_text_create("text", "John Doe", "Hello, world!", 128, 900, 0, 1664, fnt_Arial, c_white, trans_fade, 2);
vngen_text_modify_style("text", c_white, c_white, c_gray, c_gray, c_black, c_black, 1, 2);
}
if (vngen_event()) {
vngen_text_replace("text", "John Doe", "How are you?", fnt_Arial, c_white, 1);
}
if (vngen_event()) {
vngen_char_create("Jane Doe", spr_body, spr_face_idle, spr_face_talk, 0, 1080, 0, 180, 200, true, trans_slide_left, 2);
vngen_text_replace("text", "Jane Doe", "I'm good, thanks! How about you?", previous, previous, 1);
}
if (vngen_event()) {
if (vngen_option("options", 960, 540, 1, 1, snd_hover, snd_select)) {
vngen_option_create("option_good", "I'm doing great!", spr_option, spr_option_hover, spr_option_select, 0, 0, -1, fnt_Arial, c_white, trans_slide_right, 1);
vngen_option_create("option_bad", "Well...", spr_option, spr_option_hover, spr_option_select, 0, 100, -2, fnt_Arial, c_white, trans_slide_right, 1);
}
switch (vngen_get_option()) {
case "option_good": vngen_goto("event_good"); break;
case "option_bad": vngen_goto("event_bad"); break;
}
}
if (vngen_event("event_good")) {
vngen_text_replace("text", "John Doe", "I'm doing great!", inherit, inherit, 1);
}
if (vngen_event()) {
vngen_script_execute(vngen_goto, "event_complete");
}
if (vngen_event("event_bad")) {
vngen_text_replace("text", "John Doe", "Not so great, I'm afraid...", inherit, inherit, 1);
}
if (vngen_event("event_complete")) {
vngen_text_replace("text", "Jane Doe", "I see.", inherit, inherit, 1);
}
vngen_event_reset_target();