.*pilot ejected...

Freeform discussion about anything related to modding Transcendence.
Post Reply
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

in my efforts to restock stations I was calling ships to drop fuel at a fuel depot : THEN decided to try to get the rest of the ships to copy the action by ACTUALY dropping stuff that we all know they are supposed to be doing :

Code: Select all

(block (behavior newBehavior allDests dockedAt allWrecks allLoot)
               (setq behavior (objGetData gSource "behavior"))
               (setq dockedAt (shpGetDockObj gSource))
               
               ; If we're docked at an object, dump any loot that we found
               (if (and dockedAt
                     (objHasAttribute dockedAt "populated")
                     
                     ; Compose a list of all loot on board that the station
                     ; might want to buy from us.
                     
                     (setq allLoot (filter (objGetItems gSource "*~mf U") theItem
                        (objGetBuyPrice dockedAt theItem)
                        ))
                     )
                  (block Nil
                     (enum allLoot theItem (objRemoveItem gSource theItem))
                     (enum allLoot theItem (objAddItem dockedAt theItem))
                     )
                  )
this code : while it freaks out if you edit it badly ( like i do ) : actually does not work. but it is written properly which is the kicker.
I know this because I sat on a fuel depot ( the easiest station to watch ) after I emptied it and waited for traffic carrying stocked items on board to show up:
nothing.
I have 8 ships carrying items to drop : 2 are fuel carrying freighters.
While I CAN get them to drop the fuel or items at a specific station by adding code to the station : the traffic code dos not actually work.
I believe the " problem" is in the transfer of the item......

What I would like to see here is it's place is a WORKING code that gets the ships to actually make the drop in future versions.

I am back to editing my traffic codes to try to get this done: it probably will look like it will never work ( which is how I can be sure it's almost there :) )

** edits: sorry if I do type or sound worse then usual: it's Alaska and I heat with wood: so Im not exactly warm and it is both distracting and annoying : plus i hit my finger on a differential and the bandaide is an odd feeling on my finger
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

I can't really test it since i am on a new machine and have not set my T environment up yet, but I think your problem is with your enum... try this:

Code: Select all

(enum allLoot theItem (block nil
  (objAddItem docketAt theItem)
  (objRemoveItem gSource theItem)
)
Note: there are many more things that can be going wrong, and from the information you have given it is hard to tell what it could be. Is the code being run at all? Is gSource actually the ship? Does the ship actually have any items that pass the filter?
Personally I would stick a ton of dbgLog statements in there and watch their output.
Get your own Galactic Omni Device
Get it now. It's free!!
Image
speedofsquid
Commonwealth Pilot
Commonwealth Pilot
Posts: 55
Joined: Wed Aug 27, 2008 6:30 pm
Location: USA

I think you should be using objGetSellPrice instead of objGetBuyPrice.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

objGetSellPrice returns the price that the given object will sell the item for.
Get your own Galactic Omni Device
Get it now. It's free!!
Image
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

updated progress: ( originally the code "failed" because it took me awhile to realize the spelling error )

with suggested code ( spelling error fixed :) )......works perfectly , except on the fuel station ( the entire target of the mission that started this ).

for some reason the fuel station is not accepting items from traffic ; the primary station ( startonEridani) is taking the fuel i stocked in the freighters for the mission of restocking fuel supplies. I copied the code to regular traffic as well as my freighters: if my freighters are dropping stuff at Eridani I am sure the rest of the traffic is FINALLY doing the job as well.


THIS is for the comonwealth traffic ** note: i adjusted the item selection to "*U~m", it worked on my freighters with identifiable cargo so I just ran it to regular traffic so I could be sure it was working .

Code: Select all

	(block (behavior newBehavior allDests dockedAt allWrecks allLoot)
					(setq behavior (objGetData gSource "behavior"))
					(setq dockedAt (shpGetDockObj gSource))
					
					; If we're docked at an object, dump any loot that we found
					(if (and dockedAt
							(objHasAttribute dockedAt "populated")
							
							; Compose a list of all loot on board that the station
							; might want to buy from us.
							
							(setq allLoot (filter (objGetItems gSource "*U~m")
								(objGetBuyPrice dockedAt theItem)
								))
							)
						(block Nil
							(enum allLoot theItem (block nil
                          (objAddItem dockedAt theItem) 
                        (objRemoveItem gSource theItem) 
                                 )
							)
						)
						)
this is the version used in my freighter orders:

Code: Select all

(block (behavior newBehavior allDests dockedAt allWrecks allLoot)
					(setq behavior (objGetData gSource "behavior")) 
					(setq dockedAt (shpGetDockObj gSource)) 
					
					(if (and dockedAt
							(objHasAttribute dockedAt "populated")
							
							; Compose a list of all loot on board that the station
							; might want to buy from us.
							
							(setq allLoot (filter (objGetItems gSource "*U~m -Res;") theItem
								(objGetBuyPrice dockedAt theItem) 
								))
							)
						(block Nil
							(enum allLoot theItem (block nil
                          (objAddItem dockedAt theItem) 
                        (objRemoveItem gSource theItem) 
                                 )
							)
						)
						)
**
the -Res; on the freighters is because in 2380 the Scarab actually carries the Ore that the CSC mission tells you it is supposedly carrying.
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Not sure what is going wrong there... I have some restock code I used for a mod Prophet and I were building some time ago that seemed to work across the board. I can try and post it once i have access to my stuff again (soon, this weekend most likely)
Get your own Galactic Omni Device
Get it now. It's free!!
Image
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

alterecco wrote:Not sure what is going wrong there... I have some restock code I used for a mod Prophet and I were building some time ago that seemed to work across the board. I can try and post it once i have access to my stuff again (soon, this weekend most likely)
So far I believe I and everyone else that plays the game understood that the traffic was Never doing it's job completely.
I believe that with what I have learned from the many mods I tried and the lessons taught here in the forums with the advice given :
that we tracked down the " biggest bug" the Universe ever had.

So far the fuel station refuses to take cargo: several times it told me it does not understand " objadditem"......so I switched it to destroy and replace itself on a timer ( Korolov "revengecheck" carries the code used ) .

Otherwise every station I checked so far has taken the designated cargo: a few stations I added a " pilot resource" where the station holds the cargo for sale to the player : like the residential stations: I originally made them useful, NOW I added the resource so you can buy traffic dropped cargo as well :)

I can not do that with every station: some carry too much code and it does not fly well, others I gave other codes to so they can use the drops to manufacture stuff.....( spoiler ) .

So basically, in 2380, the Princess demands that every station restock, freighters deliver the goods and those that "can" WILL "do". :)
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
Post Reply