Cogito, ergo sum
Unreal Wiki:Scratchpad
From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 13:11, 28 August 2008 by OlympusMons (Talk | contribs)
This page is for pasting code you want to show someone as an example or to get assistance with. This allows you to easily collaborate with someone to solve a problem, and allows easy comparisons of the edits.
You are free to remove any existing code from below, and paste your code between the <uscript> </uscript> tags. If the page hasn't been edited in the last few hours (the last edit timestamp is 2008-08-28 13:11:52), you can assume it isn't needed anymore and can be removed. A full edit history will be available, so don't worry about losing anything you removed.
// put your code here
<?php /************************************************************************************* * uscript.php * --------------------------------- * Author: <name> (<e-mail address>) * Copyright: (c) 2004 <name> (<website URL>) * Release Version: 1.0.0 * CVS Revision Version: $Revision: 1057 $ * Date Started: <date started> * Last Modified: $Date: 2008-03-16 16:55:34 +0100 (So, 16 Mär 2008) $ * * <name-of-language> language file for GeSHi. * * <any-comments...> * * CHANGES * ------- * <date-of-release> (1.0.0) * - First Release * * TODO (updated <date-of-release>) * ------------------------- * <things-to-do> * ************************************************************************************* * * This file is part of GeSHi. * * GeSHi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GeSHi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GeSHi; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ************************************************************************************/ /************************************************************************************* * uscript.php * ---------- * Author: Graham Knop (haarg@beyondunreal.com) * Copyright: (c) 2007 Graham Knop * Release Version: 0.0.0.1 * Date Started: 2007/12/17 * * UScript language file for GeSHi. * ************************************************************************************/ $language_data = array ( 'LANG_NAME' => 'UnrealScript', 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), 'COMMENT_MULTI' => array('/*' => '*/'), 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, 'QUOTEMARKS' => array(1 => '"', 2 => "'"), 'ESCAPE_CHAR' => '\\', 'KEYWORDS' => array( 1 => array( 'within', 'while', 'void', 'vector4', 'vector2d', 'vector', 'vect', 'var', 'until', 'unreliable' , 'twovectors', 'true', 'travel', 'transient', 'tpov', 'then', 'texture', 'switch', 'super' , 'structdefaultproperties', 'struct', 'string', 'stop', 'static', 'state', 'sound', 'skip' , 'singular', 'simulated', 'showcategories', 'server', 'self', 'scriptconst', 'scale', 'safereplace' , 'rotator', 'rotation', 'rot', 'rng', 'return', 'repnotify', 'replication', 'removeitem', 'remove' , 'reliable', 'register', 'region', 'rangevector', 'range', 'quat', 'protected', 'private' , 'preoperator', 'postoperator', 'pointer', 'plane', 'placeable', 'perobjectlocalized' , 'perobjectconfig', 'out', 'optional', 'operator', 'nousercreate', 'notplaceable', 'notforconsole' , 'noteditinlinenew', 'nontransient', 'nontransactional', 'none', 'noimport', 'noexport', 'noclear' , 'new', 'nativereplication', 'native', 'name', 'mutable', 'model', 'mesh', 'matrix', 'long' , 'localized', 'local', 'linearcolor', 'length', 'latent', 'iterator', 'invariant', 'intrinsic' , 'intpoint', 'interpcurvepoint', 'interpcurve', 'interp', 'int', 'instanced', 'insertitem' , 'insert', 'input', 'init', 'inherits', 'import', 'implements', 'immutable', 'ignores', 'if' , 'hideparent', 'hidedropdown', 'hidecategories', 'guid', 'goto', 'globalconfig', 'global' , 'function', 'foreach', 'for', 'float', 'find', 'final', 'false', 'extends', 'exportstructs' , 'export', 'explicit', 'expands', 'exec', 'event', 'enumcount', 'enum', 'end', 'else', 'editoronly' , 'editinlineuse', 'editinlinenotify', 'editinlinenew', 'editinline', 'editfixedsize' , 'editconstarray', 'editconst', 'edfindable', 'each', 'duplicatetransient' , 'dontcollapsecategories', 'do', 'deprecated', 'dependson', 'delete', 'delegate' , 'defaultproperties', 'default', 'databinding', 'cylinder', 'coords', 'continue', 'const', 'config' , 'compressedposition', 'color', 'collapsecategories', 'coerce', 'client', 'class', 'catch', 'case' , 'cacheexempt', 'byte', 'break', 'boxspherebounds', 'box', 'boundingvolume', 'boundingbox', 'bool' , 'begin', 'automated', 'autoexpandcategories', 'auto', 'assert', 'arraycount', 'array', 'always' , 'additem', 'add', 'abstract' ) ), 'SYMBOLS' => array( '~=', '~', '||', '|', 'dot', 'cross', 'clockwisefrom', '^^', '^', '@=', '@', '>>>', '>>', '>=', '>' , '==', '<=', '<<', '<', '/=', '/', '-=', '--', '-', '+=', '++', '+', '*=', '**', '*', '&&', '&' , '%', '$=', '$', '!=', '!' ), 'CASE_SENSITIVE' => array( GESHI_COMMENTS => true, 1 => false, 2 => false, 3 => false, 4 => false, 5 => false, ), 'STYLES' => array( 'KEYWORDS' => array( 1 => 'color: #FF0000; font-weight: bold' # control structures ), 'COMMENTS' => array( 1 => 'color: #339966; font-style: italic;', 2 => 'color: #00FF00; font-weight: bold;', 'MULTI' => 'color: #339966; font-style: italic;' ), 'ESCAPE_CHAR' => array( 0 => '' ), 'BRACKETS' => array( 0 => '' ), 'STRINGS' => array( 1 => 'color: #808080;', 2 => 'color: #FF0000;' ), 'NUMBERS' => array( 0 => 'color: #FF00FF;' ), 'METHODS' => array( ), 'SYMBOLS' => array( ), 'REGEXPS' => array( ), 'SCRIPT' => array( ) ), 'URLS' => array( ), 'OOLANG' => true, 'OBJECT_SPLITTERS' => array( ), 'REGEXPS' => array( ), 'STRICT_MODE_APPLIES' => GESHI_NEVER, 'SCRIPT_DELIMITERS' => array( ), 'HIGHLIGHT_STRICT_BLOCK' => array( ), 'TAB_WIDTH' => 4 ); ?>
//=================================================== // Class: UTMutator_GameExpansion // Creation date: 06/12/2007 08:10 // Last updated: 18/08/2008 01:13 // Contributors: OlympusMons(/d!b\) //--------------------------------------------------- //SuperClass for all Game Expansion types //covers alot of the base functionality which will //be reused alot through these. //TODO: Can be used to auto assign groups based on what //adjustments are made. //=================================================== class UTMutator_GameExpansion extends UTMutator abstract; /** Version number for this Game Expasion Mutator. */ var int Mutator_VERSION; /** Controller for this Mutator. Not a good idea to use this unless you have to! */ var class<PlayerController> PCClass< SEMI > //var Controller aPlayer; /** Pawn for this Mutator. Not a good idea to use this unless you have to! */ var class<Pawn> PClass< SEMI > /** HUD for this Mutator. */ var class<HUD> HUDClass< SEMI > /** Class to use for this expansions player replication */ var class<UTLinkedReplicationInfo> LRIPath; /** GameRules for this Mutator. */ var class<GameRules> GRClass< SEMI > /** New InventoryType for Jumpboots Factory */ var class<Inventory> NewBootInventoryType; var class<UTCheatManager> CMClass< SEMI > //--------------------------------------------------- /** New Default inventory. Gets passed to Default Inventory array when bool is true! */ var bool bUseNewDefaultInventory; var array< class<Inventory> > NewDefaultInventory; var bool bAllowTranslocator; //--------------------------------------------------- //Info Actor Attachements struct ActorInfo { // var Actor AttachedToActor; var name AttachedToActor; var class<Info> AttachedInfo; }; var array<ActorInfo> Info_Attachments; //--------------------------------------------------- /** Factory Replacement/Per Map Factory Replacement */ var FactoryReplacer_Data FactoryReplacer; var class<FactoryReplacer_Data> FactoryReplacerDataClass< SEMI > /** This mutator uses Per Map Setting from the FactoryReplacer */ //var config bool bUsePerMapSettings; /** Name of the Loaded Map */ var string CurrentMap; //--------------------------------------------------- /** Logging */ var UTPawn LastLoggedPawn; var string LastLoggedMap; //--------------------------------------------------- //// function GetServerDetails(out GameInfo.ServerResponseLine ServerState) { local int i; Super.GetServerDetails(ServerState); i = ServerState.ServerInfo.Length; ServerState.ServerInfo.Length = i+1; ServerState.ServerInfo[i].Key = "MF Version"; ServerState.ServerInfo[i++].Value = "v0.4"; // ServerState.ServerInfo[i++].Value = ""$(Mutator_VERSION / 10)$"."$int(Mutator_VERSION % 10); } //// function InitMutator(string Options, out string ErrorMessage) { local UTGame Game; // local bool bInPerMapList; // local MapFactoryReplacementSettings NewPerMapFactorySettings; // local byte k; local int i, MapIndex; //j, //TODO: Update this so the linked list works better! /* WorldInfo.Game.AddGameRules(GRClass); if(WorldInfo.Game.GameRulesModifiers != None) for (GR = WorldInfo.Game.GameRulesModifiers; GR != None; GR = GR.NextGameRules) // if(RelicsRules(GR) != None) // SetRules(RelicsRules(GR)); */ CurrentMap = WorldInfo.GetMapName(true); if(LastLoggedMap != CurrentMap) { `log("Current Map: "$CurrentMap,,'GameExpansion'); LastLoggedMap = CurrentMap; } Game = UTGame(WorldInfo.Game); if(Game != None) { Game.bAllowTranslocator = bAllowTranslocator; if(PClass != None) { Game.DefaultPawnClass = PClass< SEMI > `log("Pawn: "$PClass.Name,,'GameExpansion'); } if(PCClass != None) { Game.PlayerControllerClass = PCClass< SEMI > `log("Controller: "$PCClass.Name,,'GameExpansion'); } if(HUDClass != None) { Game.HUDType = HUDClass< SEMI > `log("HUD: "$HUDClass.Name,,'GameExpansion'); } if(bUseNewDefaultInventory) { if(NewDefaultInventory.length > 1) { `logd("NewDefaultInventory",,'GameExpansion'); Game.DefaultInventory.length = NewDefaultInventory.length; for(i = 0; i < Game.DefaultInventory.length; i++) { Game.DefaultInventory[i] = NewDefaultInventory[i]; `logd("DefaultLoadout: "$Game.DefaultInventory[i]); /* i = Game.DefaultInventory.Length + 1; Game.DefaultInventory[i+1] = class'GravBelt.GravBelt';*/ } } } } if(GRClass != None) { WorldInfo.Game.AddGameRules(GRClass); //TODO: Search linkedlist and `log all GameRules `log("GameRules: "$GRClass.Name,,'GameExpansion'); } /* else if (InStr(WorldInfo.GetGameClass().name, "Invasion")!=-1) { WorldInfo.Game.PlayerReplicationInfoClass = class'BattlePRIInvasion'; } */ if(FactoryReplacerDataClass != None) FactoryReplacer = new(self) FactoryReplacerDataClass< SEMI > if(FactoryReplacer != None) { if(FactoryReplacer.bUsePerMapSettings) { `logd("Using Per Map Factory Replacement Settings!",,'GameExpansion'); //TODO: Parse commandline options for this? MapIndex = FactoryReplacer.PerMapFactorySettings.Find('Map', CurrentMap); if(MapIndex != INDEX_NONE) { FactoryReplacer.SetupPerMapData(MapIndex); } else { `logd("Using Global Factory Replacement Settings!",,'GameExpansion'); FactoryReplacer.AddDummyMapEntry(CurrentMap); } } } Super.InitMutator(Options, ErrorMessage); } //// //Replacement functions function bool CheckReplacement(Actor Other) { local UTPickupFactory_JumpBoots BootFactory; local int i, j, MapIndex, FactoryIndex; local UTPlayerController UTPlayer; UTPlayer = UTPlayerController(Controller(other)); if(UTPlayer != None && CMClass != None) { UTPlayer.CheatClass = CMClass< SEMI > } //Factory Replacement! TODO: Check for pathing issues with doing this // if(Other.IsA(PickupFactory)) // { if(FactoryReplacer != None) { for(j = 0;j < FactoryReplacer.Length();j++) { if(Other.IsA(FactoryReplacer.ReplacementFactories[j].ReplacedFactory) && !Other.IsA(FactoryReplacer.ReplacementFactories[j].ReplacedWithFactory)) { ReplaceWith(Other, FactoryReplacer.ReplacementFactories[j].ReplacedWithFactoryPath); `logd("Factory: "$Other$" Replaced With: "$FactoryReplacer.ReplacementFactories[j].ReplacedWithFactoryPath,,'Replacement'); return false; //NewFactory.InitializePickup(); } // else if(ReplacementFactories[j].ReplacedWithFactory ~= "Remove"){ // Factory.Deactivate(); //Deactivate Factory! // } } MapIndex = FactoryReplacer.PerMapFactorySettings.Find('Map', CurrentMap); if(MapIndex != INDEX_NONE) { //TODO: Will add entry for every factory in the map, do not want! FactoryIndex = FactoryReplacer.PerMapFactorySettings[MapIndex].FactoriesToReplace.Find('ReplacedFactory', PickupFactory(Other).Name); if(FactoryIndex == INDEX_NONE) { FactoryReplacer.AddPerMapEntry(MapIndex, PickupFactory(Other)); } else if(FactoryIndex != INDEX_NONE) { FactoryReplacer.UpdatePerMapEntry(MapIndex, PickupFactory(Other)); } } } if(UTVehicleFactory(Other) != UTVehicleFactory_TrackTurretBase(Other)) ReplaceVehicle(UTVehicleFactory(Other)); // ModifyVehicle(UTVehicle(Other)); //Replace Jumpboots with NewBootInventoryType! BootFactory = UTPickupFactory_JumpBoots(Other); if(BootFactory != None && NewBootInventoryType != None) { BootFactory.InventoryType = NewBootInventoryType; BootFactory.InitializePickup(); `logd("BootFactory: "$BootFactory$"."$BootFactory.InventoryType,,'Replacement'); } //Spawn/Attach Info's for(i = 0;i < Info_Attachments.Length;i++) { if(Other.IsA(Info_Attachments[i].AttachedToActor)) { Spawn(Info_Attachments[i].AttachedInfo, Other); `logd("Info: "$Info_Attachments[i].AttachedInfo$" Attached to: "$Info_Attachments[i].AttachedToActor,,'Info Attachment'); } } return true; } function ReplaceVehicle(UTVehicleFactory Factory) { if(Factory == None && Factory.VehicleClass == None) return; `logd("Factory: "$Factory$"."$Factory.VehicleClass,,'Replacement'); } //// //Modify functions function ModifyPlayer(Pawn Other) { local UTPawn P; P = UTPawn(Other); if(P != None) { ModifyPawn(P); //TODO: Support for Spawning PawnInfo's // Spawn(Class'HammerPlayerInfo', Other); // `logd("FireInfoSpawned",,'FastWeapSwitch'); } Super.ModifyPlayer(Other); } function ModifyPawn(UTPawn P) { if(P == None) return; if(LastLoggedPawn != P) { `logd("Pawn: "$P,,'Modify'); LastLoggedPawn = P; } } /*function ModifyVehicle(UTVehicle V) { V = UTVehicle(Other); if (V != None) { `log("Vehicle: "$V); } }*/ //// /** Added to allow Gametype hook to UTLinkedReplicationInfo. Similar to Info attachment method but instead links a replication info to the PRI.*/ //NOTE: Should be called from check replacement! function AddReplicationInfo(Actor Other) { local UTLinkedReplicationInfo LRI; local UTPlayerReplicationInfo PRI; // foreach dynamicactors(class'PlayerController', pc) { PRI = UTPlayerReplicationInfo(Other); if(PRI != None && LRIPath != None) { if(PRI.CustomReplicationInfo != None) { LRI = PRI.CustomReplicationInfo; // while(LRI.NextReplicationInfo != None) // { // LRI = LRI.NextReplicationInfo; // } LRI.NextReplicationInfo = Spawn(LRIPath, Other.Owner); `logd("NextReplicationInfo: "$LRI.NextReplicationInfo,,'GameExpansion'); } else { PRI.CustomReplicationInfo = Spawn(LRIPath, Other.Owner); `logd("CustomReplicationInfo: "$PRI.CustomReplicationInfo,,'GameExpansion'); } } } defaultproperties { FactoryReplacerDataClass=None PClass=None PCClass=None GRClass=None LRIPath=None HUDClass=None CMClass=None bUseNewDefaultInventory=False NewBootInventoryType=None }
class UTMutator_Bloodlust extends UTMutator_GameExpansion; defaultproperties { GroupNames(0)="VAMPIRE" GRClass=Class'Newtators.UTGameRules_Bloodlust' FactoryReplacerDataClass=Class'Newtators.Data_Bloodlust' // ReplacementFactories(0)=(ReplacedFactory="UTPickupFactory_UDamage", ReplacedWithFactory="UTPickupFactory_VDamage", ReplacedWithFactoryPath="Newtators.UTPickupFactory_VDamage") }
//=================================================== // Class: FactoryReplacer_Data // Creation date: 11/08/2008 15:39 // Last updated: 18/08/2008 01:13 // Contributors: OlympusMons(/d!b\) //--------------------------------------------------- //=================================================== class FactoryReplacer_Data extends Object Config(Factory_Data); // abstract; /** Map is not found on the list, create a new entry in the ini using the defaults. */ var bool bCheckMapFactoryList; struct FactoryReplace { var name ReplacedFactory; var name ReplacedWithFactory; var string ReplacedWithFactoryPath; // structdefaultproperties{iID=-1} }; struct MapFactoryReplacementSettings { var string Map; var array<FactoryReplace> FactoriesToReplace; }; /** Global Factories to replace */ var config array<FactoryReplace> ReplacementFactories; /** Factories to replace on a Per Map basis */ var config array<MapFactoryReplacementSettings> PerMapFactorySettings; /** This mutator uses Per Map Setting from the FactoryReplacer */ var config bool bUsePerMapSettings; //--------------------------------------------------- var bool bEditsMade; var int iVersion; //--------------------------------------------------- function EditMade() { bEditsMade = true; iVersion++; } /*function ClearList() { Maps.Length = 0; EditMade(); }*/ function SaveEdits() { if(bEditsMade) { bEditsMade = false; SaveConfig(); } } function int Length() { // if() return(ReplacementFactories.Length); // else // return(PerMapFactorySettings.Length); } /*static function int StaticLength() { return (default.Maps.Length); }*/ //TODO: Function which outs ReplacementFactories to ReplaceWith() in GameExpansion function SetupPerMapData(int MapIndex, out optional string Options) { local int k; //TODO: Parse commandline options for this? for(k=0; k < ReplacementFactories.length; k++) { //Moves Per Map Settings to the Global Array for use. ReplacementFactories[k].ReplacedFactory = PerMapFactorySettings[MapIndex].FactoriesToReplace[k].ReplacedFactory; ReplacementFactories[k].ReplacedWithFactory = PerMapFactorySettings[MapIndex].FactoriesToReplace[k].ReplacedWithFactory; ReplacementFactories[k].ReplacedWithFactoryPath = PerMapFactorySettings[MapIndex].FactoriesToReplace[k].ReplacedWithFactoryPath; } SaveConfig(); // EditMade(); } function AddDummyMapEntry(string CurrentMap) { local MapFactoryReplacementSettings NewPerMapFactorySettings; //Adds Map Name only entry if none is found! NewPerMapFactorySettings.Map = CurrentMap; PerMapFactorySettings.AddItem(NewPerMapFactorySettings); // bCheckMapFactoryList = True; SaveConfig(); // EditMade(); } function AddPerMapEntry(int MapIndex, PickupFactory Factory) { local FactoryReplace NewFactoriesToReplace; // local int FactoryIndex; if(Factory == None) return; //Factory is not in the list, add it! `logd("FactoryList: "$Factory.Name$" added to Per Map Factory List!",,'FactoryReplacer'); // if(VehiclesToReplace[Index].NewClassPath != "") NewFactoriesToReplace.ReplacedFactory = Factory.Name; // NewFactoriesToReplace.ReplacedWithFactory = ReplacementFactories[k].ReplacedWithFactory; // NewFactoriesToReplace.ReplacedWithFactoryPath = Factory.ReplacedWithFactoryPath; PerMapFactorySettings[MapIndex].FactoriesToReplace.AddItem(NewFactoriesToReplace); //TODO: Only need to save once all edits are made! This will be iterated! SaveConfig(); // EditMade(); } function UpdatePerMapEntry(int MapIndex, PickupFactory Factory) { // local FactoryReplace NewFactoriesToReplace; local int FactoryIndex; if(Factory == None) return; FactoryIndex = PerMapFactorySettings[MapIndex].FactoriesToReplace.Find('ReplacedFactory', Factory.Name); if(FactoryIndex == INDEX_NONE) { //Factory is in the list... Change it? :S `logd("FactoryList: "$Factory.Name$" Changed!",,'FactoryReplacer'); PerMapFactorySettings[MapIndex].FactoriesToReplace[FactoryIndex].ReplacedFactory = Factory.Name; // PerMapFactorySettings[MapIndex].FactoriesToReplace[FactoryIndex].ReplacedWithFactory = Factory.ReplacedWithFactory; // PerMapFactorySettings[MapIndex].FactoriesToReplace[FactoryIndex].ReplacedWithFactoryPath = Factory.ReplacedWithFactoryPath; } //TODO: Only need to save once all edits are made! This will be iterated! SaveConfig(); // EditMade(); } /** Map is not found on the list, create a new entry in the ini using the global settings. */ /*static function MapCreateEntry(string CurrentMap, PickupFactory Factory) { local FactoryReplace NewFactoriesToReplace; local int MapIndex, FactoryIndex; if(ReplacedFactory == None) return; //TODO: Move to UI? if(bCheckMapFactoryList) { MapIndex = PerMapSettings.Find('Map', CurrentMap); if(MapIndex != INDEX_NONE) { //TODO: Will add entry for every factory in the map, do not want! FactoryIndex = PerMapFactorySettings[MapIndex].FactoriesToReplace.Find('OldClassName', Factory.Name); if(FactoryIndex == INDEX_NONE) { //Factory is not in the list, add it! `logd("FactoryList: "$ReplacedFactory.Name$" added to Per Map Factory List!",,'FactoryReplacer'); // if(VehiclesToReplace[Index].NewClassPath != "") NewFactoriesToReplace.ReplacedFactory = Factory.ReplacedFactory; NewFactoriesToReplace.ReplacedWithFactory = Factory.ReplacedWithFactory; NewFactoriesToReplace.ReplacedWithFactoryPath = Factory.ReplacedWithFactoryPath; PerMapFactorySettings[MapIndex].FactoriesToReplace.AddItem(NewFactoriesToReplace); } else if(FactoryIndex != INDEX_NONE) { //Factory is in the list... Change it? :S `logd("FactoryList: "$ReplacedFactory.Name$" Changed!",,'FactoryReplacer'); PerMapFactorySettings[MapIndex].FactoriesToReplace[FactoryIndex].ReplacedFactory = Factory.ReplacedFactory; PerMapFactorySettings[MapIndex].FactoriesToReplace[FactoryIndex].ReplacedWithFactory = Factory.ReplacedWithFactory; PerMapFactorySettings[MapIndex].FactoriesToReplace[FactoryIndex].ReplacedWithFactoryPath = Factory.ReplacedWithFactoryPath; } } // SaveConfig(); // EditMade(); } }*/
//=================================================== // Class: Data_BloodLust // Creation date: 22/08/2008 05:21 // Contributors: OlympusMons(/d!b\) //=================================================== class Data_BloodLust extends FactoryReplacer_Data; defaultproperties { ReplacementFactories(0)=(ReplacedFactory="UTPickupFactory_UDamage", ReplacedWithFactory="UTPickupFactory_VDamage", ReplacedWithFactoryPath="Newtators.UTPickupFactory_VDamage") }