More auton script help

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
dosbox-gamer
Commonwealth Pilot
Commonwealth Pilot
Posts: 66
Joined: Sat Apr 05, 2008 9:41 pm
Location: Utopia Planitia Fleet Yards

Hi all,
Does this look right:

(block Nil
(if (itmMatches (auton) "+Military;")
(setq gCost 10)
(setq gCost 0)
)
)

Thx in advance.
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

I am not too sure that (auton) will work as you have it.

Is it an itemStruct like: (itmMatches itemStruct criteria) ?
User avatar
dosbox-gamer
Commonwealth Pilot
Commonwealth Pilot
Posts: 66
Joined: Sat Apr 05, 2008 9:41 pm
Location: Utopia Planitia Fleet Yards

Scratch that. How about:

; Advanced autons cost more to fix.
(objGetItems gPlayership "*+MilitaryID")
>>>>>(setq gCost (add gCost (multiply 10 (gCost))))

where >>>>> equals indent


I just need to know if the script will work.
Thanks in advance.
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

So, is that military auton going to cost 11 times the original price ?
User avatar
dosbox-gamer
Commonwealth Pilot
Commonwealth Pilot
Posts: 66
Joined: Sat Apr 05, 2008 9:41 pm
Location: Utopia Planitia Fleet Yards

Uh, no. Multiply 5 is for the cost of repairing the autons. Right?
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

dosbox-gamer wrote: ; Advanced autons cost more to fix.
(objGetItems gPlayership "*+MilitaryID")
>>>>>(setq gCost (add gCost (multiply 10 (gCost))))
dosbox-gamer wrote: Uh, no. Multiply 5 is for the cost of repairing the autons. Right?
You can read the above script as:
gCost = gCost + (gCost * 10)

So, like digdug said, the item will end up costing 11 times more than the initial gCost.

Also, the way you use (objGetItems ...) is not right. The function merely returns a list, it does not iterate over it. However, it is not totally clear to me what you want to accomplish. With the above snippet, it looks more like you want to increase the items price if the player has a Military ID? Let us know more precisely what you want to do, and it will be easier to help...

.]
User avatar
dosbox-gamer
Commonwealth Pilot
Commonwealth Pilot
Posts: 66
Joined: Sat Apr 05, 2008 9:41 pm
Location: Utopia Planitia Fleet Yards

From the AutonDealer <repairautons> code:

In this case, gCost is the cost to repair autons. It starts at 0 (setq gCost 0), then is calculated by:

(enum gList auton
>>>>>(for i 0 (subtract (shpGetArmorCount auton) 1)
>>>>>>>>>>(setq gCost (add gCost (multiply 5 (objGetArmorDamage auton i))))
>>>>>>>>>>)
>>>>>)

So multiply 5 is on the armor damage points -- for standard (light) autons.
My multiply 10 would be for military (heavy) autons. Okay?
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

dosbox-gamer wrote:My multiply 10 would be for military (heavy) autons. Okay?
I see. In that case you would need to change the code a bit. What you are doing with this piece of code:

Code: Select all

(objGetItems gPlayership "*+MilitaryID") 
is get all items on the playership that have a MilitaryID attribute.

What you would want to do, is check if the auton you are getting the price for, has the Military attribute. Something like:

Code: Select all

(enum gList auton
    (if (itmHasAttribute auton 'Military)
        (setq gCost (multiply 10 gCost))
    )
) 
Hope that clears it up.
dosbox-gamer wrote:Okay?
Okay!

.]
User avatar
dosbox-gamer
Commonwealth Pilot
Commonwealth Pilot
Posts: 66
Joined: Sat Apr 05, 2008 9:41 pm
Location: Utopia Planitia Fleet Yards

Okay 8)
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
Post Reply