Fallout 4

Alternatively, we can let the UI drive the CommandHistory buffer limit, allowing users to configure it themselves.
To enable a new Console command called "SetConsoleHistoryBuffer (int)",  add the following yellow lines to your Console.as:

package
{
...   
   public class Console extends MovieClip
   {       
   ...      

// Leave this alone, we'll allow users to change it later.
private var HistoryCharBufferSize:uint = 8192; 

...

private const BUFFER_COMMAND:String = "setconsolehistorybuffer ";   

...

// Leave this alone, too.
// We will build on top of it and let users set this value.

public function set historyCharBufferSize(sz:uint) : *
   {
       this.HistoryCharBufferSize = sz;
}

...

// Make the same changes to AddHistory as in the Mod Description.
public function AddHistory(commandOutput:String) : *

...


public function onKeyUp(evt:KeyboardEvent) : *   
{
var param:String = ""; 
var asInt:int = 0; 

var hght:int = 0;
var ypos:int = 0;
         
if (evt.keyCode == Keyboard.ENTER || evt.keyCode == Keyboard.NUMPAD_ENTER)      
{         
if (this.Commands.length >= this.PREVIOUS_COMMANDS)
{
this.Commands.shift();
}         
this.Commands.push(this.CommandEntry.text);
if (this.CommandEntry.text.toLowerCase().indexOf(BUFFER_COMMAND) == 0)
{
// Validate a reasonable value was entered.
param = this.CommandEntry.text.substr(BUFFER_COMMAND.length);
asInt = parseInt(param);
if (!isNaN(asInt) && 0 < asInt && asInt < int.MAX_VALUE)
{ 
this.historyCharBufferSize = asInt;

}
}
else 
{

       this.BGSCodeObj.executeCommand(this.CommandEntry.text);
}
this.ResetCommandEntry();
}
else if (evt.keyCode == Keyboard.PAGE_UP)
{
hght = this.CommandHistory.bottomScrollV - this.CommandHistory.scrollV;
ypos = 
this.CommandHistory.scrollV - hght;
this.CommandHistory.scrollV = ypos > 0 ? ypos: 0;
}
else if (evt.keyCode == Keyboard.PAGE_DOWN)
   {
hght = this.CommandHistory.bottomScrollV - this.CommandHistory.scrollV;
ypos = this.CommandHistory.scrollV + hght;
this.CommandHistory.scrollV = ypos <= this.CommandHistory.maxScrollV ?
ypos : this.CommandHistory.maxScrollV;
}
   }

...

Article information

Added on

Edited on

Written by

charlieoctopus5000

0 comments