Difference between revisions of "Basic code scripting"

From XStoryPlayer Wiki
Jump to: navigation, search
 
(44 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
All the scripts for the dungeon pack directory can be found in the <code>./pack/pack_dungeon/init</code> directory.
  
 +
===Init sub-directories===
 +
The /init directory contains the following sub-directories:
 +
* /std : These files are the same for all stories (like .dll files in windows)
 +
* /stories : These files are story specific.
  
All the scripts for the dungeon pack directory can be found in the ./pack/pack_dungeon/init directory.
+
===Stories sub-directories===
 +
The /init/stories/dungeon directory contains the following sub-directories:
  
It contains two sub-directories:
+
* /scenes : Scene settings
 +
* /chars : Character code
 +
* /mains : Main player code
 +
* /objects : Object settings
 +
* /lib : Defines used in code
 +
* /gamestate : Global gamestate
 +
* /settings : Settings for custom fastsex menu
  
* /std : These files are the same for all stories (like .dll files in windows)
+
==Playtime==
 +
For now we like to play around with some settings/code that are easy to do and have quick visual effect.<br>
 +
We assume you are in the <code>./pack/pack_dungeon/init/stories/dungeon directory</code>.
  
* /stories : These files are story specific.
+
===Changing Saiko character===
 +
<ol>
 +
<li>Make sure there are no save files in the ./save directory</li>
 +
<li>Open the /chars/saiko/init.dat file.</li>
 +
<li>Change the skin color to:
 +
<syntaxhighlight lang="cpp">
 +
pose
 +
{
 +
  ...
 +
   
 +
  skin_color      = (240,300,300,255); // <<-- Bright silver
 +
  skin_spec_shiny = 2.0;              // <<-- Very shiny
 +
  skin_spec_power = 100.0;            // <<-- Sharp shiny
 +
   
 +
  ...
 +
}
 +
</syntaxhighlight>
 +
</li>
 +
<li>Now start XStoryPlayer, select the fastsex dungeon mod, the Saiko character and start it.
 +
Saiko should now appear somewhat silver plastic like.</li>
 +
</ol>
 +
 
 +
===Entering dungeon directly===
 +
<ol>
 +
<li>To be inside the dungeon directly when we enter it we need to make a change to the default entry point for the main player.<br>
 +
Open the /mains/player/init.dat file.</li>
 +
<li>Change the pose to:
 +
<syntaxhighlight lang="cpp">
 +
pose
 +
{
 +
  ...   
 +
  waypoint = "in_wp"; // <<-- Change waypoint
 +
  ...
 +
}
 +
</syntaxhighlight>
 +
</li>
 +
<li>Now each tim you enter the dungeon you will be directly inside</li>
 +
</ol>
 +
 
 +
===Changing Saiko hair and cloth===
 +
<ol>
 +
<li>Open the <code>./pack/pack_dungeon/init/std/base/char/char_base.dat'</code> file. In it you will see all the settings that are available for a character.<br>
 +
We will not edit this file because the Saiko character instance is derived from this CHAR_BASE char_object.</li>
 +
<li>Open the /chars/saiko/init.dat file. You will see that at the top it says: <code>char_objecti:CHAR_BASE SAIKO</code>.<br>
 +
This means that the character Saiko instance is derived from the char_object CHAR_BASE. We can override the settings for this character by adding them.
 +
We will do this for the hair and cloth settings in this small tutorial.</li>
 +
<li>Change the saiko/init.dat file settings to:
 +
<syntaxhighlight lang="cpp">
 +
pose
 +
{
 +
  ...   
 +
  skin_color      = (240,300,300,255);
 +
  skin_spec_shiny = 2.0;
 +
  skin_spec_power = 100.0;
 +
 
 +
 
 +
  // Add these lines \/\/\/
 +
 
 +
  hair_tex        = "#";
 +
  hair_color      = (500,1200,1200,255); // <<-- Because texture color is dark and we keep using hair texture we need to have high values for hair color
 +
  hair_spec_shiny  = 2.0;
 +
  hair_spec_power  = 100.0;
  
 +
  cloth_tex[0]        = "";  // <<-- Do not use cloth texture # means use standard cloth texture in model
 +
  cloth_color[0]      = (180,150,150,64); // <<-- Color of cloth (red,green,blue,alpha). By settings alpha to 64 it is transparent.
 +
  cloth_spec_shiny[0] = 2.0;
 +
  cloth_spec_power[0] = 100.0;
 +
   
 +
  cloth_tex[1]        = "";
 +
  cloth_color[1]      = (180,150,150,64);
 +
  cloth_spec_shiny[1] = 2.0;
 +
  cloth_spec_power[1] = 100.0;
 +
   
 +
  cloth_tex[2]        = "";
 +
  cloth_color[2]      = (180,150,150,64);
 +
  cloth_spec_shiny[2] = 2.0;
 +
  cloth_spec_power[2] = 100.0;
  
The /stories/dungeon directory contains the following sub-directories:
+
  shoes_tex        = "";
 +
  shoes_color      = (165,150,150,255);
 +
  shoes_spec_shiny = 2.0;
 +
  shoes_spec_power = 100.0;
  
* /chars : These files are the same for all stories (like .lib files in c++)
+
  // Add these lines /\/\/\
 +
  ...
 +
}
 +
</syntaxhighlight>
 +
</li>
 +
<li>Now start XStoryPlayer, select the fastsex dungeon mod, the Saiko character and start it.
 +
Saiko should have brown transparent cloth, matching shoes and green hair.</li>
 +
</ol>
  
* /gamestate : These files are story specific.
+
===Changing scene color===
 +
<ol>
 +
<li>Open the /scenes/dungeon1.dat file. It contains the settings for the dungeon scene.</li>
 +
<li>Change the light object to:
 +
<syntaxhighlight lang="cpp">
 +
data
 +
{
 +
  ...
 +
  light_ambient = (0.125,0.25,0.125,1); // <<-- Change this to make the global ambient light greenish
 +
  ...
 +
}
  
* /lib : These files are story specific.
+
light_objecti:LIGHT LIGHT1
 +
{
 +
  group = 0;
 +
 +
  ambient = (0.75,0.75,0.75,0); // This is how much diffuse light is added to the scene by this light
  
* /mains : These files are story specific.
+
  color = (0.85,1,0.85,1); // <<-- Add this to change the color of this light to greenish glow
 +
}
 +
</syntaxhighlight>
 +
</li>
 +
<li>Now start XStoryPlayer, select the fastsex dungeon mod and start it.
 +
The scene has now an greenish glow applied to it.</li>
 +
</ol>
  
* /objects : These files are story specific.
+
===Changing object size===
  
* /scenes : These files are story specific.
+
<ol>
 +
<li>Open the /scenes/dungeon1.dat file.</li>
 +
<li>
 +
Change the PSCREEN1 tv object to:
 +
<syntaxhighlight lang="cpp">
 +
tv_objecti:PSCREEN PSCREEN1
 +
{  
 +
  obj_name = "pscreen:pscreen";
 +
 
 +
  enabled = true;
 +
 
 +
  channel = 1;
 +
 +
  channels {file = "VIDEO_PATH/*.*";}
 +
 
 +
  scale = (3,1,3);  // <<-- Add this to resize projection screen
 +
}
 +
</syntaxhighlight>
 +
</li>
 +
<li>Now start XStoryPlayer, select the fastsex dungeon mod and start it.
 +
The projection screen is now very wide.</li>
 +
</ol>
  
* /settings : These files are story specific.
+
===Resume===
 +
You now have taken a small peek inside scripting. There is a lot of code contained within the /init directory but don't let that scare you off, as you have seen it is also easy to get results fast.<br>
 +
You can now proceed with the [[Changing textures]] tutorial.

Latest revision as of 14:29, 7 January 2015

All the scripts for the dungeon pack directory can be found in the ./pack/pack_dungeon/init directory.

Init sub-directories

The /init directory contains the following sub-directories:

  • /std : These files are the same for all stories (like .dll files in windows)
  • /stories : These files are story specific.

Stories sub-directories

The /init/stories/dungeon directory contains the following sub-directories:

  • /scenes : Scene settings
  • /chars : Character code
  • /mains : Main player code
  • /objects : Object settings
  • /lib : Defines used in code
  • /gamestate : Global gamestate
  • /settings : Settings for custom fastsex menu

Playtime

For now we like to play around with some settings/code that are easy to do and have quick visual effect.
We assume you are in the ./pack/pack_dungeon/init/stories/dungeon directory.

Changing Saiko character

  1. Make sure there are no save files in the ./save directory
  2. Open the /chars/saiko/init.dat file.
  3. Change the skin color to:
    pose
    {
      ...
     
      skin_color      = (240,300,300,255); // <<-- Bright silver
      skin_spec_shiny = 2.0;               // <<-- Very shiny
      skin_spec_power = 100.0;             // <<-- Sharp shiny
     
      ...
    }
  4. Now start XStoryPlayer, select the fastsex dungeon mod, the Saiko character and start it. Saiko should now appear somewhat silver plastic like.

Entering dungeon directly

  1. To be inside the dungeon directly when we enter it we need to make a change to the default entry point for the main player.
    Open the /mains/player/init.dat file.
  2. Change the pose to:
    pose
    {
      ...    
      waypoint = "in_wp"; // <<-- Change waypoint
      ...
    }
  3. Now each tim you enter the dungeon you will be directly inside

Changing Saiko hair and cloth

  1. Open the ./pack/pack_dungeon/init/std/base/char/char_base.dat' file. In it you will see all the settings that are available for a character.
    We will not edit this file because the Saiko character instance is derived from this CHAR_BASE char_object.
  2. Open the /chars/saiko/init.dat file. You will see that at the top it says: char_objecti:CHAR_BASE SAIKO.
    This means that the character Saiko instance is derived from the char_object CHAR_BASE. We can override the settings for this character by adding them. We will do this for the hair and cloth settings in this small tutorial.
  3. Change the saiko/init.dat file settings to:
    pose
    {
      ...    
      skin_color      = (240,300,300,255);
      skin_spec_shiny = 2.0;
      skin_spec_power = 100.0;
     
     
      // Add these lines \/\/\/
     
      hair_tex         = "#";
      hair_color       = (500,1200,1200,255); // <<-- Because texture color is dark and we keep using hair texture we need to have high values for hair color
      hair_spec_shiny  = 2.0;
      hair_spec_power  = 100.0;
     
      cloth_tex[0]        = "";  // <<-- Do not use cloth texture # means use standard cloth texture in model
      cloth_color[0]      = (180,150,150,64); // <<-- Color of cloth (red,green,blue,alpha). By settings alpha to 64 it is transparent.
      cloth_spec_shiny[0] = 2.0;
      cloth_spec_power[0] = 100.0;
     
      cloth_tex[1]        = "";
      cloth_color[1]      = (180,150,150,64);
      cloth_spec_shiny[1] = 2.0;
      cloth_spec_power[1] = 100.0;
     
      cloth_tex[2]        = "";
      cloth_color[2]      = (180,150,150,64);
      cloth_spec_shiny[2] = 2.0;
      cloth_spec_power[2] = 100.0;
     
      shoes_tex        = "";
      shoes_color      = (165,150,150,255);
      shoes_spec_shiny = 2.0;
      shoes_spec_power = 100.0;
     
      // Add these lines /\/\/\
      ...
    }
  4. Now start XStoryPlayer, select the fastsex dungeon mod, the Saiko character and start it. Saiko should have brown transparent cloth, matching shoes and green hair.

Changing scene color

  1. Open the /scenes/dungeon1.dat file. It contains the settings for the dungeon scene.
  2. Change the light object to:
    data
    {
      ...
      light_ambient = (0.125,0.25,0.125,1); // <<-- Change this to make the global ambient light greenish
      ...
    }
     
    light_objecti:LIGHT LIGHT1
    {
      group = 0;
     
      ambient = (0.75,0.75,0.75,0); // This is how much diffuse light is added to the scene by this light
     
      color = (0.85,1,0.85,1); // <<-- Add this to change the color of this light to greenish glow
    }
  3. Now start XStoryPlayer, select the fastsex dungeon mod and start it. The scene has now an greenish glow applied to it.

Changing object size

  1. Open the /scenes/dungeon1.dat file.
  2. Change the PSCREEN1 tv object to:
    tv_objecti:PSCREEN PSCREEN1
    {	  
      obj_name = "pscreen:pscreen";
     
      enabled = true;
     
      channel = 1;
     
      channels {file = "VIDEO_PATH/*.*";}
     
      scale = (3,1,3);  // <<-- Add this to resize projection screen
    }
  3. Now start XStoryPlayer, select the fastsex dungeon mod and start it. The projection screen is now very wide.

Resume

You now have taken a small peek inside scripting. There is a lot of code contained within the /init directory but don't let that scare you off, as you have seen it is also easy to get results fast.
You can now proceed with the Changing textures tutorial.