Page 1 of 1

Distro spawnSystem

Posted: Sat Mar 29, 2014 8:53 pm
by Ullr
Alright so I've got a runaway script in the distro spawner. From what I can tell it's due to an incorrect method, missing a parameter in spawnUtil.inc.

Here's the error:
Script Error in 'pkg/systems/spawnSystem/engines/npcFill/spawnCycle.ecl' PC=991:
Call to function ListStaticsAtLocation:
Parameter 3: Expected datatype Integer, got datatype String
Core notes from Shinigami:
07-04 Shinigami
2510: Changed : uo::ListStaticItemsAtLocation to uo::ListStaticsAtLocation( x, y, z, flags, realm )
06-01 Shinigami
Added : uo::ListStaticItemsAtLocation( x, y, flags, realm )
Added : uo::ListStaticItemsNearLocation( x, y, range, flags, realm )
creates an array of structures with Static and Multi Items at or around location.
you can specify via flags which Items you want to get. check IGNORE_* constants.
Code from Distro spawnerUtil where that gets called:

Code: Select all

function SS_IsValidCreationTile( x, y, z, realm )

        var landtiles_cfg := ReadConfigFile( "::landtiles" );
	var map_info := GetMapInfo( x, y, realm );
	var tile_elem := landtiles_cfg[Hex( map_info.landtile )];

	if( !tile_elem.MoveLand )
		var tiles_cfg := ReadConfigFile( "::tiles" );
		foreach static in ( ListStaticsAtLocation( x, y, z, realm ))
			if( static.z == z )
				if( tiles_cfg[Hex( static.objtype )].MoveLand )
					return 1;
				endif
			endif
			SleepMS(10);
		endforeach

		foreach item in ( ListItemsAtLocation( x, y, z, realm ))
			if( item.z == z )
				if( tiles_cfg[item.graphic].MoveLand )
					return 1;
				endif
			endif
			SleepMS(10);
		endforeach

		return 0;
	endif

	return 1;
endfunction
I assume it should read like this;

Code: Select all

function SS_IsValidCreationTile( x, y, z, flags, realm )

        var landtiles_cfg := ReadConfigFile( "::landtiles" );
	var map_info := GetMapInfo( x, y, realm );
	var tile_elem := landtiles_cfg[Hex( map_info.landtile )];

	if( !tile_elem.MoveLand )
		var tiles_cfg := ReadConfigFile( "::tiles" );
		foreach static in ( ListStaticsAtLocation( x, y, z, flags, realm ))
			if( static.z == z )
				if( tiles_cfg[Hex( static.objtype )].MoveLand )
					return 1;
				endif
			endif
			SleepMS(10);
		endforeach

		foreach item in ( ListItemsAtLocation( x, y, z, flags, realm ))
			if( item.z == z )
				if( tiles_cfg[item.graphic].MoveLand )
					return 1;
				endif
			endif
			SleepMS(10);
		endforeach

		return 0;
	endif

	return 1;
endfunction
Who can tell me about this flags parameter?

Re: Distro spawnSystem

Posted: Sat Mar 29, 2014 11:02 pm
by Turley

Re: Distro spawnSystem

Posted: Sun Mar 30, 2014 6:55 pm
by Ullr
Hrm, ok so I scripted in what I would think is a fix based on that page you just linked.

Function as follows:

Code: Select all

function SS_IsValidCreationTile( x, y, z, realm )
	var flags := 0x40000000;
	
        var landtiles_cfg := ReadConfigFile( "::landtiles" );
	var map_info := GetMapInfo( x, y, realm );
	var tile_elem := landtiles_cfg[Hex( map_info.landtile )];

	if( !tile_elem.MoveLand )
		var tiles_cfg := ReadConfigFile( "::tiles" );
		foreach static in ( ListStaticsAtLocation( x, y, z, flags, realm ))
			if( static.z == z )
				if( tiles_cfg[Hex( static.objtype )].MoveLand )
					return 1;
				endif
			endif
			SleepMS(10);
		endforeach

		foreach item in ( ListItemsAtLocation( x, y, z, flags, realm ))
			if( item.z == z )
				if( tiles_cfg[item.graphic].MoveLand )
					return 1;
				endif
			endif
			SleepMS(10);
		endforeach

		return 0;
	endif

	return 1;
endfunction
Still spams this error in my debug logs. Also found that this error appears to be caused due to too many spawn regions in the .cfg file. It appears to cap out at 97 regions. Anyone else run into this problem? We're running map0 and SMALL portion of Ilshenar so I'm curious if others have surpassed the 97 limit without concern?