Difference between revisions of "Korman:Python Nodes"

(Created page with "{{Tutorial}} file:KorPython01.jpg This tutorial will show how to utilize various Python scripts in Korman to work in URU. ==Introduction== Python scripts are what ma...")
 
m (Python File Node)
 
(46 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Tutorial}}
+
{{Tutorial|Python Nodes|Korman}}
  
[[file:KorPython01.jpg]]
+
[[file:KorPython01.jpg|center|700px]]
  
  
Line 20: Line 20:
 
[[file:KorPython02.jpg]]
 
[[file:KorPython02.jpg]]
  
This is the node with which you'll want to start.  Click '''Select''' to choose your Python script.  The node will expand and add sockets for each function of the script.
+
This is the node with which you'll want to start.  Click '''Load Script''' to choose your Python script.  The node will expand and add sockets for each function of the script. A copy of the full script will also be copied into your text editor for reference. Notice the different colors of the sockets when they appear.  This will tell you which kinds of the following nodes will connect to that socket.
  
Notice the different colors of the sockets when they appear.  This will tell you which kinds of the following nodes will connect to that socket.
+
===Boolean Attribute Node===
 
+
===Boolean Node===
+
  
 
[[file:KorPython03.jpg]]
 
[[file:KorPython03.jpg]]
  
Use this socket to set boolean functions of a script.  Checking the box once it's connected will set the value to "true".
+
Use this socket to set boolean functions of a script (true or false).  Checking the box once it's connected will set the value to "true".
 +
 
 +
===Drop Down List Node===
 +
 
 +
[[file:KorPython15.jpg]]
 +
 
 +
This node controls any drop down menu function of a Python script.
  
 
===Numeric Attribute Node===
 
===Numeric Attribute Node===
Line 40: Line 44:
 
[[file:KorPython05.jpg]]
 
[[file:KorPython05.jpg]]
  
This node is used to reference an existing object in the blend.
+
This node is used to reference an existing object in the blend file.
  
 
===String Attribute Node===
 
===String Attribute Node===
  
[[file:KorPython06.jpg
+
[[file:KorPython06.jpg]]
  
 
This node creates a string value (regular text) for the socket.
 
This node creates a string value (regular text) for the socket.
Line 52: Line 56:
 
[[file:KorPython07.jpg]]
 
[[file:KorPython07.jpg]]
  
This node will reference a specific material and its texture for the script.
+
This node will reference a specific material and one of its textures for the script.
  
 
===Other Nodes===
 
===Other Nodes===
  
 
You may also need to use [[Korman:Logic Nodes|region sensor, clickable, and responder nodes]] for some scripts.
 
You may also need to use [[Korman:Logic Nodes|region sensor, clickable, and responder nodes]] for some scripts.
 
  
 
==Cyan Global Scripts==
 
==Cyan Global Scripts==
  
First, you will need PY files of Cyan's scripts.  You can find them at [https://github.com/H-uru/moul-scripts/archive/master.zip this link].
+
First, you will need Cyan's Python scripts.  You can find them in [https://github.com/H-uru/moul-scripts/archive/master.zip the moul-scripts repository].
  
Unzip this archive and export it into it's own folder, preferably an easy place you'll remember later.
+
Unzip this archive and export it into it's own folder, preferably an easy place you'll remember later.  You can bookmark the location in Blender's file-selection dialog for easier future access.
  
===Linking Books===
+
<blockquote>NOTE: PLEASE DO NOT MODIFY THESE SCRIPTSNot only may it break some functions with your Age, they are used extensively by the entire game and you may break other Ages as well.</blockquote>
 
+
NOTE: This node tree is incompleteIt will do everything up until the actual linking part and will cause your avatar to get stuck.
+
 
+
NOTE 2: This script is for Linking to Cyan's Ages. For Linking to fan Ages, see below.
+
  
 +
For a reference on more commonly-used scripts, see the [[Global Python Scripts]] page.  Most basic logical actions you need for creating puzzles can be done either with one of these scripts, or by composing several of them together, without the need to write custom logic for your Age.
  
  
 
===Journals===
 
===Journals===
 +
[[file:KorPython08.jpg|350px|right]]
 +
<blockquote>'''NOTE:''' Journal logic has been greatly simplified with the [[Korman:Journals|Journals modifier]], but this method will still work.</blockquote>
  
 
'''Script: xJournalBookGUIPopup.py'''
 
'''Script: xJournalBookGUIPopup.py'''
 
NOTE: This script is used for online shards.
 
 
[[file:KorPython08.jpg|250px]]
 
  
 
Key:
 
Key:
 
* Red node: your journal clickable object
 
* Red node: your journal clickable object
 
* Yellow node: the clickable region where the clickable is active
 
* Yellow node: the clickable region where the clickable is active
* Purple nodes: the numeric nodes that determine a book's width and height
+
* Purple nodes: the numeric nodes that determine a book's width and height (between 0 and 1.0)
 
* Green node: The location of the journal in your LOC file (see example below)
 
* Green node: The location of the journal in your LOC file (see example below)
 +
 +
The '''Book GUI Type''' uses a '''String''' node.  In the text field, type '''bkBook''' for regular book pages and '''bkNotebook''' for notebook pages.  If this isn't set, it will use bkBook by default.
  
 
You'll need to create a LOC file with [[Tools#PRP and Python Tools|PlasmaShop]], using what you entered into the green node.
 
You'll need to create a LOC file with [[Tools#PRP and Python Tools|PlasmaShop]], using what you entered into the green node.
Line 93: Line 93:
 
[[file:KorPython09.jpg|300px]]
 
[[file:KorPython09.jpg|300px]]
  
The LOC file should be saved into the '''dat''' folder of your URU installation.
+
<blockquote>NOTE: The journal cover, regardless of the type of image it started as (jpg, png, etc), it will export as '''DDS'''.</blockquote>
  
 +
The LOC file should be saved into the '''dat''' folder of your URU installation.
  
 
===Imagers===
 
===Imagers===
 
 
'''Script: xSimpleImager.py'''
 
'''Script: xSimpleImager.py'''
 +
 +
 +
====Postable====
  
 
Before you start, make sure the UV mapping looks something like this for proper centering:
 
Before you start, make sure the UV mapping looks something like this for proper centering:
Line 104: Line 107:
 
[[file:KorPython11.jpg|300px]]
 
[[file:KorPython11.jpg|300px]]
  
Also, the map needs to be upside down for proper export.  To do this, make sure the whole UV map is selected (press A until it's all orange), then, in the UV/Image Editor window, click '''UVs->Mirror->Y Axis'''.  It should look the same, but it's now flipped upside down.
 
 
====Postable====
 
  
[[file:KorPython10.jpg|300px]]
+
[[file:KorPython10.jpg|400px|right]]
  
 
'''Key:'''
 
'''Key:'''
Line 117: Line 117:
 
* Blue nodes: these numerical nodes will set how long an image is on screen before it switches to the next (in seconds) and how many images the imager can hold
 
* Blue nodes: these numerical nodes will set how long an image is on screen before it switches to the next (in seconds) and how many images the imager can hold
 
** For online shards, it is recommended to keep the number of images '''''at 10 or below'''.
 
** For online shards, it is recommended to keep the number of images '''''at 10 or below'''.
* Purple nodes: these boolean values determine if an imager is members only (best to keep this off) and if it can take pellet scores
+
* Purple nodes: these boolean values determine if an imager is members only (keep this off or you won't be able to post) and if it can take pellet scores
 
* Yellow node: the imager object itself
 
* Yellow node: the imager object itself
  
Line 126: Line 126:
 
[[file:KorPython13.jpg|300px]]
 
[[file:KorPython13.jpg|300px]]
  
Again, remember to flip it upside down by going into the UV/Image Editor, select all with '''A''', then click '''UVs->Mirror->Y Axis'''.
+
[[file:KorPython12.jpg|300px|right]]
 
+
[[file:KorPython12.jpg|300px]]
+
  
 
'''Key:'''
 
'''Key:'''
* Cyan node - The name of the imager
+
* Cyan node - The name of the imager (you'll need this for later)
 
* Green node - The material and associated texture of the imager.  Remember to leave the texture set to '''Type: Image or Movie''' and do not add a texture
 
* Green node - The material and associated texture of the imager.  Remember to leave the texture set to '''Type: Image or Movie''' and do not add a texture
 +
** Uncheck '''MIP Map''' and '''Interpolation''' under '''Image Sampling''' in the Textures tab.
 
* Red node - A placeholder for the region.  Since this imager won't receive posts, you can use a dummy object for this.
 
* Red node - A placeholder for the region.  Since this imager won't receive posts, you can use a dummy object for this.
 
* Blue nodes - These can be set to the defaults as the screen won't change.  Time = 10 and Max = 5.
 
* Blue nodes - These can be set to the defaults as the screen won't change.  Time = 10 and Max = 5.
Line 143: Line 142:
  
 
* Default PotS/CC version - [http://www.guildofmessengers.com/sites/default/files/user432/defaultpots.py_.txt]
 
* Default PotS/CC version - [http://www.guildofmessengers.com/sites/default/files/user432/defaultpots.py_.txt]
* Default MOUL version - [http://www.guildofmessengers.com/sites/default/files/user432/defaultpots.py_.txt]
+
* Default MOUL version - [http://www.guildofmessengers.com/sites/default/files/user432/defaultmoul.py_.txt]
  
 
You'll need [[Tools#PRP and Python Tools|Plasmashop]] to create PY files.  Open Plasmashop, click '''File->New''' and choose '''Python Script'''.
 
You'll need [[Tools#PRP and Python Tools|Plasmashop]] to create PY files.  Open Plasmashop, click '''File->New''' and choose '''Python Script'''.
Line 151: Line 150:
 
=====Modify the Files=====
 
=====Modify the Files=====
  
When you open the files in Plasmashop, there are a few things to change:
+
When you have the files pasted in Plasmashop, there are a few things to change:
  
 
* Change '''AgeName''' to the filename of your Age.
 
* Change '''AgeName''' to the filename of your Age.
Line 163: Line 162:
 
In all versions of the game, '''all''' files should be named after your Age file and put into the Python folder of your URU installation.
 
In all versions of the game, '''all''' files should be named after your Age file and put into the Python folder of your URU installation.
  
NOTE: The visitor imager will not come up in Destiny if you use the '''net.linktoage''' command.  To see it, you'll need to use the Nexus after the initial link.
+
<blockquote>'''NOTE''': Imagers will not work properly in Destiny if you use the '''net.linktoage''' command.  To see them, you'll need to use the Nexus after the initial link (under "Personal Ages").</blockquote>
 
+
 
+
==Custom Python Scripts==
+
 
+
 
+
''More to come!''
+
 
+
[[Category:Korman]] [[Category:Korman Tutorials]]
+

Latest revision as of 19:12, 21 February 2022

Disambig gray.png

This is a tutorial page.Versions available: PyPRP; 3ds Max; Korman.
 
KorPython01.jpg


This tutorial will show how to utilize various Python scripts in Korman to work in URU.


Introduction

Python scripts are what make most of the more dynamic actions in URU work, such as puzzles, Linking Books, journals, and more. Cyan has provided many default scripts to choose from for most common functions, but some instances will require a custom script.

In each case, a Python node in Korman will have sockets that will tell the script what it should be doing.


Types of Nodes

Python File Node

KorPython02.jpg

This is the node with which you'll want to start. Click Load Script to choose your Python script. The node will expand and add sockets for each function of the script. A copy of the full script will also be copied into your text editor for reference. Notice the different colors of the sockets when they appear. This will tell you which kinds of the following nodes will connect to that socket.

Boolean Attribute Node

KorPython03.jpg

Use this socket to set boolean functions of a script (true or false). Checking the box once it's connected will set the value to "true".

Drop Down List Node

KorPython15.jpg

This node controls any drop down menu function of a Python script.

Numeric Attribute Node

KorPython04.jpg

This node will set a numeric value for the connected socket.

Object Attribute Node

KorPython05.jpg

This node is used to reference an existing object in the blend file.

String Attribute Node

KorPython06.jpg

This node creates a string value (regular text) for the socket.

Texture Attribute Node

KorPython07.jpg

This node will reference a specific material and one of its textures for the script.

Other Nodes

You may also need to use region sensor, clickable, and responder nodes for some scripts.

Cyan Global Scripts

First, you will need Cyan's Python scripts. You can find them in the moul-scripts repository.

Unzip this archive and export it into it's own folder, preferably an easy place you'll remember later. You can bookmark the location in Blender's file-selection dialog for easier future access.

NOTE: PLEASE DO NOT MODIFY THESE SCRIPTS. Not only may it break some functions with your Age, they are used extensively by the entire game and you may break other Ages as well.

For a reference on more commonly-used scripts, see the Global Python Scripts page. Most basic logical actions you need for creating puzzles can be done either with one of these scripts, or by composing several of them together, without the need to write custom logic for your Age.


Journals

KorPython08.jpg
NOTE: Journal logic has been greatly simplified with the Journals modifier, but this method will still work.

Script: xJournalBookGUIPopup.py

Key:

  • Red node: your journal clickable object
  • Yellow node: the clickable region where the clickable is active
  • Purple nodes: the numeric nodes that determine a book's width and height (between 0 and 1.0)
  • Green node: The location of the journal in your LOC file (see example below)

The Book GUI Type uses a String node. In the text field, type bkBook for regular book pages and bkNotebook for notebook pages. If this isn't set, it will use bkBook by default.

You'll need to create a LOC file with PlasmaShop, using what you entered into the green node.

LOC file example:

KorPython09.jpg

NOTE: The journal cover, regardless of the type of image it started as (jpg, png, etc), it will export as DDS.

The LOC file should be saved into the dat folder of your URU installation.

Imagers

Script: xSimpleImager.py


Postable

Before you start, make sure the UV mapping looks something like this for proper centering:

KorPython11.jpg


KorPython10.jpg

Key:

  • Cyan node: The name of the imager that shows up in the KI
  • Green node: The material and texture of the imager. The texture should be set to Type: Image or Movie and should be left empty.
    • Uncheck MIP Map and Interpolation under Image Sampling in the Textures tab.
  • Red node: the region an avatar enters to bring the imager up in the KI
  • Blue nodes: these numerical nodes will set how long an image is on screen before it switches to the next (in seconds) and how many images the imager can hold
    • For online shards, it is recommended to keep the number of images at 10 or below.
  • Purple nodes: these boolean values determine if an imager is members only (keep this off or you won't be able to post) and if it can take pellet scores
  • Yellow node: the imager object itself

Visitor Log

The UV mapping for a visitor imager should look like this:

KorPython13.jpg

KorPython12.jpg

Key:

  • Cyan node - The name of the imager (you'll need this for later)
  • Green node - The material and associated texture of the imager. Remember to leave the texture set to Type: Image or Movie and do not add a texture
    • Uncheck MIP Map and Interpolation under Image Sampling in the Textures tab.
  • Red node - A placeholder for the region. Since this imager won't receive posts, you can use a dummy object for this.
  • Blue nodes - These can be set to the defaults as the screen won't change. Time = 10 and Max = 5.
  • Purple node - check the box for ImagerMembersOnly to further secure it from posting
  • Yellow node - set this to the imager object itself
Visitor Python Scripts

For the visitor imager to work, you will also need a separate, custom Python script.

  • Default PotS/CC version - [1]
  • Default MOUL version - [2]

You'll need Plasmashop to create PY files. Open Plasmashop, click File->New and choose Python Script.

Copy and paste the text from the text file of the version you would like.

Modify the Files

When you have the files pasted in Plasmashop, there are a few things to change:

  • Change AgeName to the filename of your Age.
  • Change 99999 to your unique sequence prefix (in your World tab of your Properties window)
  • Change any instances of <Imager String Name> to the name you entered in the Cyan (string) node above.

Save the modified file as YourAgeNameHere.py.

You will need UruPython 3.1 for the Path of the Shell version to pack the PY file into a PAK file.

In all versions of the game, all files should be named after your Age file and put into the Python folder of your URU installation.

NOTE: Imagers will not work properly in Destiny if you use the net.linktoage command. To see them, you'll need to use the Nexus after the initial link (under "Personal Ages").