[CLOSED] Ticket #535 "add a switch to syscerateship..."

These are old bug reports that have been closed.
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

I think there might be a better way to accomplish what you want.

In 1.04 I've added more data fields to ship classes so you should be able to get what you want. If not, feel free to suggest more data fields until you can accomplish everything with a raw ship class.

On the other hand, if you need to have a real object (instead of a ship class) then you probably need to keep the OnCreate? event because some classes may add devices/items in their OnCreate? call.
i dont think that it will work unless we can get items installed with typGetDataField.
I would reopen the ticket but the tracs broken :(
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

sdw195 wrote:I would reopen the ticket but the tracs broken :(
Trac works fine for me, but I just recently upgraded it, so there might be some problem.

Can you tell me what you are seeing?
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

sdw195 wrote:i dont think that it will work unless we can get items installed with typGetDataField.
I would reopen the ticket but the tracs broken :(
Can you be a little more specific? What are you trying to accomplish?
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

george moromisato wrote:
sdw195 wrote:I would reopen the ticket but the tracs broken :(
Trac works fine for me, but I just recently upgraded it, so there might be some problem.

Can you tell me what you are seeing?
We are asked to confirm our email address, but the email never gets sent.
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

alterecco wrote:
george moromisato wrote:
sdw195 wrote:I would reopen the ticket but the tracs broken :(
Trac works fine for me, but I just recently upgraded it, so there might be some problem.

Can you tell me what you are seeing?
We are asked to confirm our email address, but the email never gets sent.
Everyone in IRC is having trouble with it like this. TTech reports getting a "DATABASE LOCKED" error, as well.
Last edited by Star Weaver on Mon Dec 20, 2010 10:33 pm, edited 1 time in total.
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

george moromisato wrote:
Can you be a little more specific? What are you trying to accomplish?
i am trying to make a dock screen that displays all player ships and allows you to change to them but atm we have to create the ship to get the unids of devices installed on the ship to display there names in the DS so the player knows what they are getting with the ship (eg the battle arena where the weapons, launchers and shields are displayed so the player know what there are fighting)

Edit:

I am trying to make a dock screen that displays all player ships and allows you to change to them. At the moment we have to create the ship to get the unids of devices installed and display the names in the DS (so the player can see what equipment the ship has installed) The issue is that when creating the ship, the OnCreate event can do all kinds of things, like spawn other ships. What I would like is some way to prevent this from happening.
Last edited by sdw195 on Mon Dec 20, 2010 10:47 pm, edited 1 time in total.
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

alterecco wrote:
george moromisato wrote:
sdw195 wrote:I would reopen the ticket but the tracs broken :(
Trac works fine for me, but I just recently upgraded it, so there might be some problem.

Can you tell me what you are seeing?
We are asked to confirm our email address, but the email never gets sent.
Thanks--I disabled email confirmation. It should work now, but let me know otherwise.
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

yep working
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

sdw195 wrote:I am trying to make a dock screen that displays all player ships and allows you to change to them. At the moment we have to create the ship to get the unids of devices installed and display the names in the DS (so the player can see what equipment the ship has installed) The issue is that when creating the ship, the OnCreate event can do all kinds of things, like spawn other ships. What I would like is some way to prevent this from happening.
As I said in the ticket, I think a better solution is to add data fields that can return all the information that you need from the type (so you don't have to create the ship).

If you could list out the data fields that you need and add them to a ticket, I would be happy to schedule it.
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

george moromisato wrote:
sdw195 wrote:I am trying to make a dock screen that displays all player ships and allows you to change to them. At the moment we have to create the ship to get the unids of devices installed and display the names in the DS (so the player can see what equipment the ship has installed) The issue is that when creating the ship, the OnCreate event can do all kinds of things, like spawn other ships. What I would like is some way to prevent this from happening.
As I said in the ticket, I think a better solution is to add data fields that can return all the information that you need from the type (so you don't have to create the ship).

If you could list out the data fields that you need and add them to a ticket, I would be happy to schedule it.
I think the issues he's worried about are

(a) the information in the <devices> tag section is complex and can be layered with subtables, and

(b) the information in the <devices> tag section can be randomized, and he wants to display a specific randomized configuration and the present it

Basically, he's trying to do (objEnumItems "*I" ...) on a ship that dosen't exist yet, and then, if needed, create the ship with the item list returned the first time.

Perhaps a middle of the road option would be to add a flag to (sysCreateShip) that creates a ship pre-disabled, and the provision that ships created in this way do not run their <oncreate> script until they are first enabled? Then they could never enter play without oncreate happening.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Star Weaver wrote: Perhaps a middle of the road option would be to add a flag to (sysCreateShip) that creates a ship pre-disabled, and the provision that ships created in this way do not run their <oncreate> script until they are first enabled? Then they could never enter play without oncreate happening.
That is a good idea. Ships could be created Suspended, and not have their OnCreate run until they were Resumed (care should be taken to not run OnCreate every time a ship was resumed).

The one problem I can see (related to the idea behind this whole problem) is that the equipment can be changed once the OnCreate is run, so the player really has no guarantee anyway.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I really would like OnCreate to be like a constructor. It has to be called before the object is valid. Otherwise, you introduce the complexity of half-created ships.

It's going to be impossible to create a dock screen that works with every conceivable kind of ship. As I said, skipping OnCreate just means that the dock screen will fail for ships that create devices in OnCreate. All you are doing is choosing to support a certain set of ship classes at the expense of a different set of ship classes.

Why not try to restrict to a set of ship classes that follow a certain set of rules?
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

after a chat with alterecco i decided that

Code: Select all

[list]
(typGetDataField Shipclass weapons) returns list of weapon unids
(typGetDataField Shipclass shield)   returns shield unid 
(typGetDataField Shipclass armor)  returns list of armor unids if they are not all the same
[/list]


should do what I want
Image
Image
Image
Image
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
User avatar
Star Weaver
Militia Commander
Militia Commander
Posts: 311
Joined: Sun Nov 07, 2010 10:20 pm
Location: . . . between the stars and the warm black sky . . .

sdw195 wrote:after a chat with alterecco i decided that

Code: Select all

[list]
(typGetDataField Shipclass weapons) returns list of weapon unids
(typGetDataField Shipclass shield)   returns shield unid 
(typGetDataField Shipclass armor)  returns list of armor unids if they are not all the same
[/list]


should do what I want
Should it return one random set of possible unids, for the ones with tables? (That way you could create all the data for an instance, wipe the ship, and make all your own items presto. Detailed Ship Config has a 'wipe everything but armor from ship' function if you need it :))
User avatar
Prophet
Militia Captain
Militia Captain
Posts: 826
Joined: Tue Nov 18, 2008 6:09 pm

The real issue is that you can't have it both ways.

Either you must create the ships and query the ACTUAL items installed (especially ships with device tables) or George might add some data fields to typGetDataField for a very rare case.

What about creating the ship and objSuspend it. Once created you can remove all the devices and install some basic stuff or leave it empty. Then, in your DS, add the option to move your current equipment over when purchased (if switching) or install equipment from your cargo hold?
sdw195 wrote:The issue is that when creating the ship, the OnCreate event can do all kinds of things, like spawn other ships. What I would like is some way to prevent this from happening.
Couldn't you move the scripts that spawn ships into a new event and have them trigger after a short delay with some added logic?

I'm thinking the OnCreate runs a timed event (45 ticks should be fine) and if the ship is not the playership, spawn the extra ships, otherwise do nothing.

This way you can sysCreate the ship and suspend it immediately (halting the delayed event). you can query the items, modify equipment etc, If the player switches to that ship, it will be objResumed at which point the event will fire, find it is the playership and NOT spawn ships.

Just a though :P
Coming soon: The Syrtian War adventure mod!
A Turret defense genre mod exploring the worst era in Earth's history.
Can you defend the Earth from the Syrtian invaders?
Stay tuned for updates!
Locked