Spawning Ships with the debug Console ?

Freeform discussion about anything related to modding Transcendence.
Post Reply
Hunterfanta
Anarchist
Anarchist
Posts: 16
Joined: Fri Jun 14, 2013 3:10 pm

I saw people doing this, but I have no idea how.
I know how to open the debug console.
(testShipClass 'phobos) for example wont work for me .
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

hello Hunterfanta,
testShipClass is a function contained in the original extension made by George.
You can find a copy here:
http://xelerus.de/index.php?s=mod&id=66

This is a short guide on how to install mods (in short, just unzip the extension in the folder Extensions)
http://transcendence.kronosaur.com/wiki ... stall_mods

the function to create ships "manually" is sysCreateShip; this function has the following syntax:
(sysCreateShip shipclass position sovereign [controller])
where:
shipclass: UNID of the ship to create
position: a position or a spaceobject to take the position from, or nil (works as system origin vector)
sovereign: UNID of the new ship's sovereign
[controller]: optional: AI type string, UNID of behaviour class to inherit, or behaviour lambda

creating a ship like that in the console will cause the ship to simply go to the nearest gate and disappear, because the created ship will have no orders. If you want the ship to stay around, you have to give it an order.

This is an example of a simple global lambda function that will create a EI100 ship that will stay put where created.

Code: Select all

(setq intcreatem (lambda Nil
	(block (theCreatedShip)
	 
	 (setq theCreatedShip (sysCreateShip &scEI100M; (objGetPos gPlayership) (objGetSovereign gPlayership)))
	 (shpOrderHold theCreatedShip)
	 

)))
If you put this function in a <Globals>, you can simply type (intcreatem) in the console to run it. Global lambda functions are very powerful because it can be executed anywhere in the code.

For example, I have this in my copy of George's debug code:

Code: Select all

(setq intCreateShip (lambda (shipName quantity)
	(block Nil
		(for i 0 quantity (testShipClass shipName))
	)
))
sometimes, when I'm bored, I just type this in the console (intCreateShip 'phobos 50) :shock: :shock:

If you have more question, don't hesitate to ask :D
Hunterfanta
Anarchist
Anarchist
Posts: 16
Joined: Fri Jun 14, 2013 3:10 pm

digdug wrote:hello Hunterfanta,
testShipClass is a function contained in the original extension made by George.
You can find a copy here:
http://xelerus.de/index.php?s=mod&id=66

This is a short guide on how to install mods (in short, just unzip the extension in the folder Extensions)
http://transcendence.kronosaur.com/wiki ... stall_mods

the function to create ships "manually" is sysCreateShip; this function has the following syntax:
(sysCreateShip shipclass position sovereign [controller])
where:
shipclass: UNID of the ship to create
position: a position or a spaceobject to take the position from, or nil (works as system origin vector)
sovereign: UNID of the new ship's sovereign
[controller]: optional: AI type string, UNID of behaviour class to inherit, or behaviour lambda

creating a ship like that in the console will cause the ship to simply go to the nearest gate and disappear, because the created ship will have no orders. If you want the ship to stay around, you have to give it an order.

This is an example of a simple global lambda function that will create a EI100 ship that will stay put where created.

Code: Select all

(setq intcreatem (lambda Nil
	(block (theCreatedShip)
	 
	 (setq theCreatedShip (sysCreateShip &scEI100M; (objGetPos gPlayership) (objGetSovereign gPlayership)))
	 (shpOrderHold theCreatedShip)
	 

)))
If you put this function in a <Globals>, you can simply type (intcreatem) in the console to run it. Global lambda functions are very powerful because it can be executed anywhere in the code.

For example, I have this in my copy of George's debug code:

Code: Select all

(setq intCreateShip (lambda (shipName quantity)
	(block Nil
		(for i 0 quantity (testShipClass shipName))
	)
))
sometimes, when I'm bored, I just type this in the console (intCreateShip 'phobos 50) :shock: :shock:

If you have more question, don't hesitate to ask :D

Wow, thanks for the response !
If I enable Godmode( so I don't get destroyed ,lol) and I spawn 20 phobos, and then 20 aquilla, will they fight each other ?

also the wiki sais that the unid of the Ares Dreadnought is &scPhobos; and the UNID of the Aquila is &scAquilaCruiser;
but is the code to spawn these ships then
(intCreateShip 'AquilaCruiser 20) ?

Also where do I have to enter YOUR code ? (would be cool if you could upload your debugcode.xml on mediafire or something)
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

There is no real godmode in Transcendence, but mods can easily supply for that:
download and install this mod http://xelerus.de/index.php?s=mod&id=799
It's probably one of the best and easiest godmode mods.

There are others on Xelerus, that can offer more or less features, depending on what you need.

for the Aquila Cruiser, the command would be:
(intCreateship 'Aquila 1)

that is because the function testShipClass written by George accepts "ship names" and not UNIDs.
:)

[EDIT]
Also, I moved the thread here in Shipyards, as it's related to modding.
Hunterfanta
Anarchist
Anarchist
Posts: 16
Joined: Fri Jun 14, 2013 3:10 pm

digdug wrote:There is no real godmode in Transcendence, but mods can easily supply for that:
download and install this mod http://xelerus.de/index.php?s=mod&id=799
It's probably one of the best and easiest godmode mods.

There are others on Xelerus, that can offer more or less features, depending on what you need.

for the Aquila Cruiser, the command would be:
(intCreateship 'Aquila 1)

that is because the function testShipClass written by George accepts "ship names" and not UNIDs.
:)

[EDIT]
Also, I moved the thread here in Shipyards, as it's related to modding.

cool thanks ! but I still have no idea where to put the code you gave me >.>
can you make a download of your debugcode.xml ?
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

cool thanks ! but I still have no idea where to put the code you gave me >.>
download George's debugcode mod from xelerus.

Open it with notepad.

you will see a bunch of code. you are interested in the lines starting with <GLobals> and ending with </Globals>
That is the space where you can place any lambda global function to run later in the console.

As you can see, testshipclass is a lambda global function :D (that uses sysCreateShip as discussed before)

so, you will see this:

Code: Select all

	<Globals>
		(block Nil
			(setq help (lambda (term)
so you do:

Code: Select all

	<Globals>
		(block Nil
         [PASTE CODE HERE FOR NEW LAMBDA FUNCTIONS]
			(setq help (lambda (term)
for example, if you want to use the function that I gave you before simply do:

Code: Select all

	<Globals>
		(block Nil
(setq intCreateShip (lambda (shipName quantity)
   (block Nil
      (for i 0 quantity (testShipClass shipName))
   )
))
(setq help (lambda (term)
the best way to learn is to fiddle with the code ! :)


So, just to review what I explained until now:
- Mods can have <Globals>
- Globals code can be used to run stuff from the console using lambda functions and do cool stuff.


Of course to have a deeper understanding of what you are doing, you probably should learn a bit about LISP syntax. Transcendence uses a homebrew variant of LISP for scripting and XML for mods templates.

I wrote here a very basic introduction to LISP syntax for non-programmers. (it's really really basic!) http://forums.kronosaur.com/viewtopic.php?f=5&t=5817
Hunterfanta
Anarchist
Anarchist
Posts: 16
Joined: Fri Jun 14, 2013 3:10 pm

digdug wrote:
cool thanks ! but I still have no idea where to put the code you gave me >.>
download George's debugcode mod from xelerus.

Open it with notepad.

you will see a bunch of code. you are interested in the lines starting with <GLobals> and ending with </Globals>
That is the space where you can place any lambda global function to run later in the console.

As you can see, testshipclass is a lambda global function :D (that uses sysCreateShip as discussed before)

so, you will see this:

Code: Select all

	<Globals>
		(block Nil
			(setq help (lambda (term)
so you do:

Code: Select all

	<Globals>
		(block Nil
         [PASTE CODE HERE FOR NEW LAMBDA FUNCTIONS]
			(setq help (lambda (term)
for example, if you want to use the function that I gave you before simply do:

Code: Select all

	<Globals>
		(block Nil
(setq intCreateShip (lambda (shipName quantity)
   (block Nil
      (for i 0 quantity (testShipClass shipName))
   )
))
(setq help (lambda (term)
the best way to learn is to fiddle with the code ! :)


So, just to review what I explained until now:
- Mods can have <Globals>
- Globals code can be used to run stuff from the console using lambda functions and do cool stuff.


Of course to have a deeper understanding of what you are doing, you probably should learn a bit about LISP syntax. Transcendence uses a homebrew variant of LISP for scripting and XML for mods templates.

I wrote here a very basic introduction to LISP syntax for non-programmers. (it's really really basic!) http://forums.kronosaur.com/viewtopic.php?f=5&t=5817
There is a big code inside the global section, and I kinda don't know what I should do with yours . should I copy it inside these lines ? should I delete the first code and past yours ?

im sorry that my brain can't get along with the willing and really nice made tutorial ;D
Post Reply