I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Legacy:UTPatcherProject

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

The UTPatcher Project is an attempt at coming up with something quick and easy to act as a replacement for the umod system, as it doesn't seem to work on about 50% or machines with ut2004 installed. Surprisingly it wasn't very easy to find something that could handle making the package entry in the ut2004.ini file and i eventually went with an event driven language that used to be on the Amiga called GUI4CLI. There was specific reason for choosing this language other than it was the first one i found that might be able to do the job quickly and simply after 3hrs of hunting around on google for something suitable + its FREE!.

The script revision III ....no more to come.[edit]

After a few hours of poking about i found the right bits of script and put a working program together. . At the moment the person compiling the executable in has to enter the name of the package they want an entry made for in thie ut2004.ini file before compiling the program into a standard executable. Although Gui4cli looks slightly dated I'm certain it could be programmed to search the installation directory when installing a map with a .u file and use that to make the entry. This would then mean i only have to make 1 of them and everyone happy.

Here's a quick rundown of the language;-

GUi4Cli for uscripters


Variables

  • You don't have to declare new variables at all in this language rather like 'basic'. so anything the program dosent recognise it will think is a variable.
  • A variable can hold a 1234 or "text".
  • There are 3 types of variables that can be used
  • Global variable can be used everywhere, in all guis.
  • GUI can be seen from anywhere inside the GUI its written in
  • local a Local variable can be used only within a given event.
  • Apart from this there is no other difference between them.
  • variables can be passed between different guis simply by putting the name of the gui you want to send them to in front

differentgui.yourVariable.

  • variable sort of have 2 states ie. Variable or $variable.

The first is used for assigning;- ANumber = 5

The second is for reading;- AnotherNumber = $ANumber

Variable=100
if $Variable = 100
Variable = 0

Internal variables[edit]

  • Internal variables hold info.
  • They cant be assigned and have $$ infront rather than just $.

Subroutines[edit]

Xroutine

  • Use these the same way as functions are used in uscript.
  • you can pass variables to them and they can return data back.
  • the amount of data that can be returned is limited to 1 variable. But theres no reason why you cant just assign it to a new variable that can be seen anywhere in the gui.
  • Anything you want to return just place after the 'return' which forces the subroutine to stop execution.The data is then assigned to an internal (i think global) variable called $$Return.
Gosub #This DemoSubRoutine $Anumber
$Anumber=$$Return
 
XRoutine DemoSubRoutine Anumberpassed
if $Anumberpassed= $NewBlankVariable         // a way to check if the variable is empty
   $Anumberpassed+ 5
Return $Anumberpassed
G4C Vitals ut2004.ini Patcher
 
// ===========================================================
// by VitalOverdose 2006 http://www.vitaloverdose.com
// To replace the UMOD as a method of installing .u files into the ut2004\system directory
// and making the right alterations in the 2004.ini file.
// THIS IS NOT uscript. This will NOT work in unrealed.
// the programming language Gui4cli can be downloaded at Http://www.gui4cli.com
// and is Free!!
// ===========================================================
 
WINDOW 117 78 329 226 'Vitals ut2004.ini Patcher'
	winattr style resize
	winattr background color 200/200/200
 
//////////////////////////////////////////////// Opening and closing
 
XONLOAD
 
	capheight = $($$sys.capheight / 2)          // for the last button we create a font, based on the height of the window's caption.
	loadfont 'wingdings/$capheight' wdFont
	GuiOpen #this
   IniPath=":ut2004.ini"
 
////////////////////////////////////////////////// Ending the program //////////////////////////////////////////
 
XONCLOSE
	GuiQuit #this                                // Closes the gui when finished 
	freefont wdFont                              // ??
 
////////////////////////////////////////////////// Defining the buttons ///////////////////////////////////////
 
////////////////////////////////////////////////// Unpatch Button
 
 
//////////////////////////////////////////////////  button ////// About
 
xBorderButton ICON "g4c/2"                        
attr help 'About'                                
 MsgBox 'Would you like to go to the homepage at http://www.vitaloverdose.com?' YESNO/QUESTION "The UT2004.ini Patcher V1.0. By Vitaloverdose 2006"
if $$choice = YES
 gosub #this Loadwebpage 
endif
 
//////////////////////////////////////////////////  button ////// UN-Patch
 
xBorderButton ICON "g4c/5"                     
attr help 'UN-Patch Ut2004.ini'                    
gosub #this delIniKey  "CutdownPackages=Core" EditPackages    
 
//////////////////////////////////////////////////  button ////// Patch                                               
 
 
////////////////////////////////////////////////// button ////// Patch
 
xBorderButton ICON "g4c/10"                     
attr help 'Patch The UT2004.ini File'                    
gosub #this AddIniKey  "CutdownPackages=Core" EditPackages  
 
////////////////////////////////////////////////////  button ////// Install
 
xBorderButton ICON "g4c/11"                           
 attr help 'Locate The .U file To Install'                      
 attr font wdFont                               
 attr color "255/255/0"                         
 
 gosub #this PickTheFile                            
 
 
 
////////////////////////////////////////////////////////////// listview //////////////////////////////////////////////
 
xListview 0 0 0 0 '' '' var                    
 attr ID lv                                       
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////// Subroutines /////////////////////////////////////////////////////////
 
xroutine loadwebpage
 
   use browser #this MyBrowser
	browser goto "www.fataloverdose.copperstream.co.uk/onlinehelp/utpatcher2.html"
 
////////////////////////////////////////////////////////////// browser ////////////////////////////////////////////
 
//////////////////////////////////////////////////// A quick routine to display a help file
 
xRoutine PickTheFile                               
gosub #this locating 
 
///////////////////////////////////////////////////////////////// AddIniKey
 
xRoutine AddIniKey SectionName Key testempty
 
 if $PackageName=$checkempty  
     gosub #this Locating                    
     if $$return = "F"
         MsgBox 'No .u file has been selected so nothing was patched.You may may sellect again when you are ready..' OK/WARN "Warning"
         return
     endif
 endif
 
 use lv #this lv                                
 lv load $IniPath                              
 gosub #this AddKey $SectionName $Key $packagename    // do the changes..
 lv save $IniPath                               // re-save it..
 Return                                         // A forced return. I probably dont need this
 
///////////////////////////////////////////////////////////////// AddKey 
 
xRoutine AddKey SectionName Key             // This is the routine that does the actual work for this button. 
 local string/k/v/pos                            // setting up local variable V
 lvsearch $SectionName first                     // find the section
 lv insert '$Key=$packagename'                         // inserts the txt
 return                                          // finished..
                                                 // (still part of the while command so code cotinues.
 string = $$lv.text                              // split the line into key and value
 searchvar string "=" first
 if $$search.pos > ''// -- >> -- >> ---   <-<-< // An if statement must have a matching endif.
    k = $string[0][$$search.pos]     //         // K = contents of 'string' in colum 0 reading 'serch.pos' charecters
    extract k clean                  //         // trim spaces..
    if $k = $key  // >> --------     //   <-<-< // 'If' must have a matching endif.?found the key, set it..
       %rec = '$Key=$packagename'   //     //         // %rec means the 1st lv column..
        return                //     //         // finished..
      endif  //------- << ------     //   <-<-< // An if statement must have a matching endif
    endif   //-- << -------- <<--------   <-<-< // An if statement must have a matching endif
 
////////////////////////////////////////////////// DelIniKey /////////////////////////////////
 
xRoutine delIniKey SectionName Key checkempty
 
 if $PackageName=$checkempty  // 'packagename' is tested the locally created (empty so far) 'checkempty' variable to check for null
     gosub #this Locating                     // go to and run subroutine findmodname
     if $$return = "F"
         MsgBox 'No .u file has been selected so nothing was deleted. You may select again when you are ready' OK/WARN "Warning"
         return
     endif
 endif
 
 use lv #this lv                                // load the ini file into the above listview
 lv load $IniPath                               // do the changes..
 gosub #this delkey $SectionName $Key           // goto subroutine . pass variables
 lv save $IniPath                               // re-save it..
 
////////////////////////////////////////////////// delkey ///////////////////////////////////
 
xRoutine DelKey SectionName Key                 // This is the routine that does the actual work for this button.
 
  fullLine='$SectionName=$PackageName'
  lvsearch $fullLine first                     // find the section
  lv delete current                            // delete current line
 
////////////////////////////////////////////////// Finding the filename ////////////////////////////////////////
 
xroutine Locating 
 
 ReqFile MULTI "Please locate the .U file you wish to install" ":" fileloc ".U MOD files/*.u"       // request open file in directory "root"
 if $fileloc = $CheckEmpty          // the unassigned check empty variable to check for null
    return                          // if null return
 endif
                                    // if not null the code will continue ...
 Extract fileloc NOEXT              // extract with no extension    
 Extract fileloc file               // extract all but the last part of the file location
 
 gosub #this CheckGenericThePackage $fileloc                  // check for generic conflict
 if $$Return="F"                                              // if false continue..
    gosub #this checkdetails $fileloc                         // user validation
    if $$Return="T"                                           // If happy with the details continue..
       PackageName=$fileloc         // make the global variable 'pakagename' = the local 'fileloc'
    endif
 endif
                                                                     // extract the end filename 
 ///////////////////////////////////////////////////////////////////////////////////
 
Xroutine checkdetails Thedetails 
 
MsgBox 'You Have sellected $Thedetails ,are you happy with the selection' YESNO/QUESTION/DEF1
    if $$choice = YES
		   Return "T"
		endif
Return "F" 
 
/////////////////////////////////////////////////////////////////// check for a generic package
xroutine CheckGenericThePackage ThePackage
 
if $ThePackage='Core' 
or $ThePackage='Engine' 
or $ThePackage='Fire' 
or $ThePackage='Editor' 
or $ThePackage='UnrealEd'
or $ThePackage='IpDrv' 
or $ThePackage='UWeb' 
or $ThePackage='GamePlay' 
or $ThePackage='UnrealGame'
or $ThePackage='XGame_rc'
or $ThePackage='XEffects'
or $ThePackage='XWeapons_rc'
or $ThePackage='XPickups_rc'
or $ThePackage='XPickups'
or $ThePackage='XGame'
or $ThePackage='XWeapons'
or $ThePackage='XInterface'
or $ThePackage='XAdmin'
or $ThePackage='XWebAdmin'
or $ThePackage='Vehicles'
or $ThePackage='BonusPack'
or $ThePackage='SkaarjPack_rc'
or $ThePackage='SkaarjPack'
or $ThePackage='UTClassic'
or $ThePackage='UT2k4Assault'
or $ThePackage='Onslaught'
or $ThePackage='GUI2K4'
or $ThePackage='UT2k4AssaultFull'
or $ThePackage='OnslaughtFull'
or $ThePackage='xVoting'
or $ThePackage='StreamlineFX'
or $ThePackage='UTV2004c'
or $ThePackage='UTV2004s'
or $ThePackage='OnslaughtBP'
   MsgBox 'This is a UT2004 system ThePackage and should NOT be modified. Are you sure you absolutley sure you wish to proceed' YESNO/QUESTION/WARN/DEF2 "W A R N I N G !!!"
   if $$choice = NO
		Return 'T'
   endif 
endif
return 'F'

Here is a download for the executable [1]

El Muerte: Uhm... umod works on all system unless the user breaks it. If the user broke it it can easily be fixed using some tools (forgot the name). You new system doesn't work on any system unless it's installed in the first place. That already makes it less suitable than umod in the first place.

Vitaloverdose ..oh well,. guess thats the end of that then no point wasting any time on something no one gonna use.

-You dont need to have anything installed to run a program made with gui4cli it compiles;-

"It will use a copy of Gui4Cli.exe itself as a host for the resource. It has the advantage that the resulting executable is completely self sufficient. No dlls or other files are needed. It produces however the largest files (if UPX is used, Gui4Cli.exe will pack down to about 200k, plus whatever size your data is after being compressed)."

Wormbo: What about a tool that installs ZIP files with maps/mods/whatever and integrates them into manifest.ini as if a UMOD had been installed? That would be useful because the mod or map would be listed in the game's own uninstaller.

vitaloverdose should be easy enough i guess. If its just a simple entry to a text file then its just a case of changing a few variables. The language is decptivley powerfull its really a cross between basic and Windows. Im suprised on the lack of resources for it.

vitaloverdose ...so its a single text entry for each mod? I havent used the manifest.ini for anything yet.

vitaloverdose if you tell what needs to be done i'll have a go at coding it.