Scripts to make multi.txt and multi.uoa files

Post your Custom Scripts or Packages.

Moderator: POL Developer

Post Reply
Tomi
POL Developer
Posts: 475
Joined: Tue Feb 21, 2006 5:08 pm

Scripts to make multi.txt and multi.uoa files

Post by Tomi » Mon Mar 02, 2009 1:15 pm

Text Command to make a multi.uoa in the same format as UO Architect uses. ( Now also UOFiddler support this format for import and export )

Working with Pol097 & Pol098 at least, probably if you change the += in the script it will work with 096 aswell. And remove the realm parameters I suppose it can work with Pol095 too.

Code: Select all

use uo;
use os;
use file;

program textcmd_createmultiuoa( who, filename )

	if ( !filename )
		SendSysMessage( who, "Usage: .createmultiuoa <nameofthefile>." );
		return 0;
	endif

             filename := filename + ".uoa";
  
	SendSysMessage( who, "Target the center point." );

	var trg := TargetCoordinates( who );

	if ( !trg )
		SendSysMessage( who, "Cancelled." );
		return 0;
	endif
  
	SendSysMessage( who, "Target the upper left corner." );

	var up := TargetCoordinates( who );

	if ( !up )
		SendSysMessage( who, "Cancelled." );
		return 0;
	endif
  
	SendSysMessage( who, "Target the lower right corner." );

	var low := TargetCoordinates( who );

	if ( !low )
		SendSysMessage( who, "Cancelled." );
		return 0;
	endif
  
	var area	 := ListObjectsInBox( up.x, up.y, -128, low.x, low.y, 127, trg.realm );
	var items	 := array;
	var num		 := 0;

	foreach item in area
		if ( item.IsA( POLCLASS_ITEM ) )
			items.append( CInt( item.graphic ) + " " + CInt( item.x - trg.x ) + " " + CInt( item.y - trg.y ) + " " + CInt( item.z) + " 1" );
			num += 1;
		endif
		Sleepms( 2 );
	endforeach

	items := { "6 version", "1 template id", "-1 item version", num + " num components" } + items;
  
	var file := WriteFile( filename, items );

	if (file)
		SendSysMessage( who, "Done. " + num + " components added." );
	else
		SendSysMessage( who, "Error: " + file );
	endif

endprogram
Last edited by Tomi on Sun May 03, 2009 4:27 pm, edited 5 times in total.

Tomi
POL Developer
Posts: 475
Joined: Tue Feb 21, 2006 5:08 pm

Re: Script to make a multi.txt in UO Architect format

Post by Tomi » Sun May 03, 2009 4:23 pm

Text Command to make a multi.txt in the same format as Mulpatcher uses. ( Now also UOFiddler support this format for import and export )

Working with Pol097 & Pol098 at least, probably if you change the += in the script it will work with 096 aswell. And remove the realm parameters I suppose it can work with Pol095 too.

Code: Select all

use uo;
use os;
use file;

program textcmd_createmultitxt( who, filename )

	if ( !filename )
		SendSysMessage( who, "Usage: .createmultitxt <nameofthefile>." );
		return 0;
	endif

	filename := filename + ".txt";
  
	SendSysMessage( who, "Target the center point." );

	var trg := TargetCoordinates( who );

	if ( !trg )
		SendSysMessage( who, "Cancelled." );
		return 0;
	endif
  
	SendSysMessage( who, "Target the upper left corner." );

	var up := TargetCoordinates( who );

	if ( !up )
		SendSysMessage( who, "Cancelled." );
		return 0;
	endif
  
	SendSysMessage( who, "Target the lower right corner." );

	var low := TargetCoordinates( who );

	if ( !low )
		SendSysMessage( who, "Cancelled." );
		return 0;
	endif
  
	var area	 := ListObjectsInBox( up.x, up.y, -128, low.x, low.y, 127, trg.realm );
	var items	 := array;
	var num		 := 0;

	foreach item in area
		if ( item.IsA( POLCLASS_ITEM ) )
			items.append( Hex( item.graphic ) + " " + CInt( item.x - trg.x ) + " " + CInt( item.y - trg.y ) + " " + CInt( item.z) + " 1" );
			num += 1;
		endif
		Sleepms( 2 );
	endforeach
  
	var file := WriteFile( filename, items );

	if (file)
		SendSysMessage( who, "Done. " + num + " components added." );
	else
		SendSysMessage( who, "Error: " + file );
	endif

endprogram

Harley
Forum Regular
Posts: 313
Joined: Sat Mar 18, 2006 1:41 am
Location: Germany

Re: Scripts to make multi.txt and multi.uoa files

Post by Harley » Mon Jun 02, 2014 2:42 pm

It's awesome, Tomi! Thank u!
More such works will be great for each shard!

Post Reply