ship changeing ds issues

Freeform discussion about anything related to modding Transcendence.
Post Reply
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

basicly i am trying to and a name filter for ships so that you don't have to go searching throught all the player ships to find one you want

but all my code does is give errors

Code: Select all

<Action name="fliter" default="1">
(block Nil
(setq glist nil)
(setq flit (scrGetInputText gScreen) )

(objSetData gSource "shpfilter1" true)
(setq glist (setq test (unvUNID  flit)))
(setq list glist)
(dbglog test)
(dbglog glist)
(setq list1234 (typfind "s +isPlayerClass:true"))

(dbglog (enum list1234 shp 
(block (shpname)
(setq shpname (shpGetClassName shp 1))
(if (strFind shpname flit)
(block nil  (lnkAppend gList shp))
))
))
(dbglog glist "test1")
(lnkRemove glist 0 nil) 
(dbglog glist)
(lnkRemove glist 0 nil) 
(dbglog glist)
(lnkRemove glist 0 nil) 
(dbglog glist "test2")
(setq list1 glist)
(objSetData gSource "shpfilter" glist)
(scrShowScreen gScreen &dsShipbuy; "Default")
(dbglog glist)
)
</Action>
if

Code: Select all

flit
is phobos i get

Code: Select all

-805199320
and i cant ues

Code: Select all

shpGetClass
to get the unid of it to spawn it
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 . . .

I'm not sure, but it's possible that that number you got back IS the unid for a phobos. You seem to have some confusion going on between unid functions and extant object functions. I took a stab at cleaning up your code, but I haven't had a chance to test it yet:

Code: Select all

<Action name="filterStrer" default="1">
  ; You need to declare variables or they all become global
  (block (matchingShipUnids filterStr allPlayerShipUnids)
    (setq filterStr (scrGetInputText gScreen))

    ; No idea what this is about
    (objSetData gSource "shpfilter1" true)

    ; You had in here (setq list something), which
    ; was overriding a core function (list).

    ; Get list of playership unids
    (setq allPlayerShipUnids (typfind "s +isPlayerClass:true"))


    ; Filter out all the ones where filterStr not in name
    ; (filter list i (func i)) -> all items in list where
    ;    (func i) is true
    (setq matchingShipUnids (filter allPlayerShipUnids unid
      (if (not (eq nil ; strFind != nil means string found
        (strFind (typGetDataField unid name) filterStr)
      )) true)
    ))

    ; Not sure what you're doing here, but if you want to
    ; remove an item from a list and keep the item, you
    ; have to use item first because lnkRemove returns the
    ; whole list
        
    (dbgLog "List 1: " matchingShipUnids)

    (dbgLog "Item 1: " (item matchingShipUnids 0))
    (lnkRemove matchingShipUnids 0 nil)
    (dbgLog "Item 2: " (item matchingShipUnids 0))
    (lnkRemove matchingShipUnids 0 nil)
    (dbgLog "Item 3: " (item matchingShipUnids 0))
    (lnkRemove matchingShipUnids 0 nil)

    (dbgLog "List 2: " matchingShipUnids )


    ; I guess you're using shpfilter as a data source for
    ; dsShipBuy? 
    (objSetData gSource "shpfilter" matchingShipUnids)
    (scrShowScreen gScreen &dsShipbuy; "Default")
    (dbgLog matchingShipUnids)
  ) 
</Action>
Last edited by Star Weaver on Wed Dec 15, 2010 3:37 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:

tried it and get

Code: Select all

12/15/2010 21:31:38 Then expression expected Nil ### (if (not (eq Nil (strFind (typGetDataField unid name) filterStr)))) ###
as you can see by the time stamp i ain't (sorry wolfy :P ) doing anything on it tonight

:D
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:tried it and get

Code: Select all

12/15/2010 21:31:38 Then expression expected Nil ### (if (not (eq Nil (strFind (typGetDataField unid name) filterStr)))) ###
as you can see by the time stamp i ain't (sorry wolfy :P ) doing anything on it tonight

:D
Bah, stupid if statements requring then-clauses. Edited my post above and fixed it, I think :)
Post Reply