Triggering Console Commands - Doom Legacy Wiki

Triggering Console Commands

From Doom Legacy Wiki

Jump to: navigation, search

cogetortac

Editing Tutorials

FraggleScript can be used to trigger console commands using the runcommand function.


  • Example: Here we use a script to change the gravity setting when the player enters a sector.
script 1
{
     if(objsector(playerobj()) == 16)
     {
          runcommand("gravity 0.125\n");
     }
     wait(1);
}

startscript(1);


Important Notes

  • Because runcommand allows you full access to the console, it is open to abuse. This feature's existance is reliant on goodwill. It may be removed in the next version of Legacy and replaced with proper functions that dont affect the user settings.
  • If you use runcommand more than once, you must include \n at the end of the string (see example), otherwise it will not work.
  • With version 1.32, it is recommended that you store the previous value before setting your own. You can do this with checkcvar. Then you can use runcommand to restore the users original value.
Personal tools