User Tools

Site Tools


4rpl:overview

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
4rpl:overview [2021/01/17 15:41] Karsten754rpl:overview [2022/02/14 05:44] – [Scripting] Link to 3D coordinate explanation Karsten75
Line 1: Line 1:
  
 <=[[4rpl:start| 4RPL Scripting Language]] <=[[4rpl:start| 4RPL Scripting Language]]
 +
 +:!: To edit files you will need an editor. Read how to get started with [[creating and editing 4rpl scripts]].
  
 ====== Scripting ====== ====== Scripting ======
Line 25: Line 27:
 </code> </code>
  
-The code above puts 2 numbers on the stack, the ''add'' (or ''+'') command took the 4 and the 2 (last-in, first out) added them and pushed the result (6) back on the stack. [[4rpl:commands:traceAllSp|TraceAllSp]] pops (takes/removes) all elements on the stack, puts a space in between them and prints them to the Console. A "6" is now printed on the console. +The code above puts 2 numbers on the stack, the ''%%add%%'' (or ''%%+%%'') command took the 4 and the 2 (last-in, first out) added them and pushed the result (6) back on the stack. [[4rpl:commands:traceAllSp|TraceAllSp]] pops (takes/removes) all elements on the stack, puts a space in between them and prints them to the Console. A "6" is now printed on the console. 
  
 :!: Note that 4RPL is a //case-insensitive// language, meaning **__any and all capitalization is ignored__**. **TraceAllSP** may as well be written as **TRACEALLSP** or **traceallsp**, there is no difference. :!: Note that 4RPL is a //case-insensitive// language, meaning **__any and all capitalization is ignored__**. **TraceAllSP** may as well be written as **TRACEALLSP** or **traceallsp**, there is no difference.
Line 35: Line 37:
 </code> </code>
  
-Run this **once** in the console and then unpause the game and let the game simulation run a few frames. You will see a stack of 100 deep creeper at map coordinate x=12 and z=23 ((For more information on the game coordinate system and why we use **x** and **z** coordinates, see [[map coordinate system]])).+Run this **once** in the console and then unpause the game and let the game simulation run a few frames. You will see a stack of 100 deep creeper at map coordinate x=12 and z=23 ((For more information on the game coordinate system and why we use **x** and **z** coordinates, see [[cw4:custom_maps#Understanding the 3D Coordinate System]])).
  
  
Line 69: Line 71:
 endif endif
 </code> </code>
 +
 +
 +
 +Note: See [[4rpl:Data Types]] for comparison between dissimilar types and type conversion. 
 +
 +
  
 ===== Variables ===== ===== Variables =====
Line 77: Line 85:
 "3 plus 4 is" <-result TraceAllSP "3 plus 4 is" <-result TraceAllSP
 </code> </code>
 +
 +
 +
 +Note: See [[4rpl:Data Types]] for comparison between dissimilar types and type conversion. 
 +
 +
  
 ===== Functions ===== ===== Functions =====
Line 102: Line 116:
  
 \\ \\
 +
 +----
 +===== Working with CPACKs =====
 +When a CPACK is imported, it does not overwrite any scripts that might be on disk.   So if there are scripts on disk those will get jammed back into the CPACK whenever a compile is done (and a compile is done during finalization).  You can look on disk at a location like this: 
 +<WRAP width center twothirds>
 +<code>
 +%HOMEPATH%\Documents\My Games\creeperworld4\creeperworld4\editor\map2\cpacks\[CPACKNAME] 92415695-49d6-4e97-852b-64493e76233b\scripts\
 +</code> 
 +</WRAP>
 +
 +If you load map as a regular player and then enter edit mode, the game will stick the scripts into the _UNKNOWN project directory. If there are already matching scripts present at that location, they will not be overwritten (importing a CPACK is the only exception to this).  If you export, it will take the scripts on disk.  Basically, in the normal case there is a project directory on disk. When you open a project, that directory is where scripts are location on disk.  When you compile, those are the ones compiled. They get placed into the exported or finalized CPACK.  
 +
 +The case of on-the-fly opening the editor in a map you are playing is no different -with one exception: The game doesn't know what the project directory is, so it uses "_UNKNOWN" as the directory.  Everything else is the same after that.
 +
 +If you want to grab the scripts from a map (like an FPS map) and you want to make sure you have the latest scripts, you should either create a project for the map and open it from the project page, or you should clean your _UNKNOWN directory before you open the map on the fly.
 +
 +Basically, just deleting the _UNKNOWN directory is the easiest way to clean it
 +
  
 ---- ----
4rpl/overview.txt · Last modified: 2022/02/14 06:12 by serdalis