Why won't my code execute?

Freeform discussion about anything related to modding Transcendence.
Post Reply
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

This station is placed in a custom system. However, the <OnCreate> code does not execute. Why?

Code: Select all

<StationType UNID="&stIocrymBeacon;"
		name=				"Unknown Beacon"
		sovereign=			"&svIocrym;"
		dockScreen=			"&dsNavBeacon;"
		noMapLabel=			"true"
		beacon=				"true"
		mass=				"2500"

		noArticle=			"true"
		>

	<DockingPorts>
		<Port x="0"		y="24" />
		<Port x="0"		y="-24" />
		<Port x="24"	y="0" />
		<Port x="-24"	y="0" />
	</DockingPorts>

	<Ships>
		<Ship	count="1d4" class="&scModernIocrymCommandShip;" orders="guard"/>
	</Ships>

	<ImageVariants>
		<Image imageID="&rsNavBeacon;" imageX="0" imageY="0"   imageWidth="64" imageHeight="64" imageFrameCount="2" imageTicksPerFrame="120" flashTicks="3" />
		<Image imageID="&rsNavBeacon;" imageX="0" imageY="64"  imageWidth="64" imageHeight="64" imageFrameCount="2" imageTicksPerFrame="120" flashTicks="3" />
		<Image imageID="&rsNavBeacon;" imageX="0" imageY="128" imageWidth="64" imageHeight="64" imageFrameCount="2" imageTicksPerFrame="120" flashTicks="3" />
		<Image imageID="&rsNavBeacon;" imageX="0" imageY="192" imageWidth="64" imageHeight="64" imageFrameCount="2" imageTicksPerFrame="120" flashTicks="3" />
	</ImageVariants>

	<Events>
		<OnCreate>
			(block (ship)
				(setq ship (sysCreateShip &scModernIocrymCommandShip; gSource &svIocrym;))
				(shipOrderWait ship 1000)
				(plymessage gPlayer "hi")
			)
		</OnCreate>
	</Events>
</StationType>
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

you get this one:

Code: Select all

      <Ship   count="1d4" class="&scModernIocrymCommandShip;" orders="guard"/>
but not this one-?

Code: Select all

      <OnCreate>
         (block (ship)
            (setq ship (sysCreateShip &scModernIocrymCommandShip; gSource &svIocrym;))
            (shipOrderWait ship 1000)
            (plymessage gPlayer "hi")
         )
      </OnCreate>
shipOrderWait? I think you want shpOrderWait instead. (did you look in debug.log? You might have seen an error there such as 'unknown function: shipOrderWait' )

I think the oncreate triggers then the code encounters that shipOrder and an error happens.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

09/10/2008 16:03:46 OnCreate [Unknown Beacon]: Integer expected: 0xDFA20003 ### (sysCreateShip "0xDFA20003" gSource "0xDFA21000") ###
It doesn't get to shipOrder. That said, it really needs to be changed th shpOrderEscort in order to see any effect.
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

mmmhh, have you tried to use (objGetPos gSource) instead of gSource ?
The error is "Integer expected", and it seems that the shipclass UNID and sovereign UNID are correctly parsed, so maybe the problem is there.
F50
Fleet Officer
Fleet Officer
Posts: 1004
Joined: Sat Mar 11, 2006 5:25 pm

you usually don't have to do that for stations, but it seemed to work, now the ship is going out of the system. My guess is that is because gPlayerShip is not in system when <OnCreate> is called)

That's odd, it is only appearing sometimes, and I got rid of the <Ships> tags.

Code: Select all

<Events>
		<OnCreate>
			(block (ship)
				(setq ship (sysCreateShip &scModernIocrymCommandShip; (objGetPos gSource) &svIocrym;))
				(shpOrderEscort ship gPlayerShip)		
				(sysAddObjTimerEvent 30 gSource "Begin")
				(objSetObjRefData gSource "PlayerEscort" ship)
			)
		</OnCreate>
		<Begin>
			(block (ship)
				(setq ship (objGetObjRefData gSource "PlayerEscort"))
				(shpOrderWait ship 1000000)
			)
		</Begin>
	</Events>
Post Reply