This page shows how to create a very simple developer console script that accepts commandline parameters.
The very basic syntactically correct script consists of just a void main. This script does nothing but can be invoked from the console for … no effect.
void main() { }
The easiest method for putting out small text is to create a floaty on the player is to use the following command:
void DisplayFloatyMessage ( object oCreature, string sMessage, int nStyle = FLOATY_MESSAGE, int nColour = 16777215, float nDuration = 0.5 )
The following script will output some text for 30 seconds on top of the player
void main() { DisplayFloatyMessage(OBJECT_SELF,"Test", FLOATY_MESSAGE, 1677215/*0xffffff white*/,30.0f); }
To run this script, type
runscript scriptname
and you should see the output
"test"
The easiest way to parse input parameters is to import the “core_h” library and use the GetRunScriptArgs function to retrieve the parameters passed into the runscript call
#include "core_h" void main() { string[] args = GetRunscriptArgs(); DisplayFloatyMessage(OBJECT_SELF,args[0]+"="+args[1], FLOATY_MESSAGE, 1677215/*0xffffff white*/,30.0f); }
To run this script type
runscript scriptname test123 456
and you should see the output
"test123=456"