Dynamic Types

Freeform discussion about anything related to modding Transcendence.
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:a few of functions that came from irc discussions (should I make tickets for each of these?)

(itmSetFrequency UNID frequency) ;sets the frequency of an item
(staSetLevelFrequency UNID levelFrequency) ;sets the level frequency of a station

this would allow us to remove old items and stations (both static and dynamic) without breaking the game

(shpSwapWeapon ship equippedItem itemToBeSwapped) -> the swapped out item ; you would use this to install the itemToBeSwapped preserving weapon selected

(shpSwapArmor ship equippedItem itemToBeSwapped) -> the swapped out item ; you would use this to install the itemToBeSwapped preserving hp without

(shpSwapShield ship equippedItem itemToBeSwapped) -> the swapped out item ; you would use this to install the itemToBeSwapped preserving hp
I don't quite get how itmSetFrequency and staSetLevelFrequency would help. We would still have to search all systems for the existing type to see if you're about to remove a type that is in use. [It's actually worse than that: some script may have hard-coded the type; when they try to create it they will get a runtime error. For example, imagine deleting the type for a Phobos--then the script for the CSC mission would fail. Or consider the a script that enumerates all types that match a criteria and saves those UNIDs somewhere--again, that would break.]

For the shpSwap* function, I would write a ticket for a single function that does the right thing depending on the type.
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

it wouldn't solve the problem I admit but it would certainly help, we would still have the old stuff in xml so that isn't a problem.
This isn't about removing them from the game, I would just like them not to randomly appear anymore.
Crying is not a proper retort!
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Betelgeuse wrote:it wouldn't solve the problem I admit but it would certainly help, we would still have the old stuff in xml so that isn't a problem.
This isn't about removing them from the game, I would just like them not to randomly appear anymore.
I like that. I'm already planning on adding code that controls that at the adventure-level. Might as well have a function to control it dynamically. Go ahead and add it as a ticket. It will probably be scheduled for 1.09.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

The point of the swap functions is to be able to transparently upgrade/change the players installed devices without any unwanted sideeffects. To clarify what Atarlost said, he already has tlisp code that handles shpSwapArmor, shpSwapShield and shpSwapWeapon. The only thing that we really need is the ability to determine and set currently selected weapon and set ammo for launchers. Also, to swap out armor, we damage the replacement segment until it matches the previous. All that is needed there is to be certain the red flashes are suppressed when damaging the segment in code.

So, seems like we need the following functions:

shpGetSelectedWeapon
shpSetSelectedWeapon
shpGetLauncherAmmo
shpSetLauncherAmmo

and perhaps a flag to suppress red flashes when damaging armor?
Get your own Galactic Omni Device
Get it now. It's free!!
Image
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

yay, dynamic types looks awesome!

@alterecco, don;t we already have getter functions for the currently used weapon and launcher ammo ?
User avatar
Atarlost
Fleet Admiral
Fleet Admiral
Posts: 2391
Joined: Tue Aug 26, 2008 12:02 am

digdug wrote:yay, dynamic types looks awesome!

@alterecco, don;t we already have getter functions for the currently used weapon and launcher ammo ?
The ticket isn't closed.
Literally is the new Figuratively
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

with 1.08 we could get a example xml showing how template type works. I can't seem to get it to work.
Crying is not a proper retort!
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

now that I have played with it some more I can't seem to get OnEval working. Is it called something else?


edit: found out it is called OnGlobalTypesInit
Crying is not a proper retort!
george moromisato
Developer
Developer
Posts: 2997
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

I'm sorry. I forgot that I renamed "OnEval" to "GetTypeSource". Remember that there are two ways to use dynamic types. Using templates is one way:

Code: Select all

<TemplateType UNID="&itRandomWeapon;">
   <StaticData>
      <Template><![CDATA[
         <ItemType
            name="%itemName%"
            ...
            >
            <Weapon
               damage="%itemDamage%"
               ...
               >
               %itemEffect%
            </Weapon>
         </ItemType>
      ]]></Template>
   </StaticData>

   <Events>
      <GetTypeSource><![CDATA[
           (subst (typGetStaticData &itRandomWeapon; "Template")
              {
                 itemName : (random '("Arguil cannon" "Brodian lancer" "Catapon weapon"))
                 itemDamage : (random '("damage='laser:3d6'" "damage='particle:1d8'"))
                 itemEffect : (random '(
                    "<Effect><Beam beamType='laser' primaryColor='255, 255, 0'/></Effect>"
                    "<Effect><Beam beamType='laser' primaryColor='0, 255, 255'/></Effect>"
                    ))
                 }
              )
      ]]></GetTypeSource>
   </Events>
</TemplateType>
The other way is to create the type using script. You can add a <OnGlobalTypesInit> to any type (not just TemplateType). Inside of OnGlobalTypesInit you can call typCreate as appropriate.

[Note: Inside of OnGlobalTypesInit you can call typCreate on existing type UNIDs (to override them); outside of it you can only call typCreate with new UNIDs created with typGetDynamicUNID.]
User avatar
Betelgeuse
Fleet Officer
Fleet Officer
Posts: 1920
Joined: Sun Mar 05, 2006 6:31 am

new problem I can't seem to get random to work in the struct definition.
itemDamage : (random '("damage='laser:3d6'" "damage='particle:1d8'"))
makes itemDamage an empty string
Crying is not a proper retort!
sdw195
Militia Captain
Militia Captain
Posts: 779
Joined: Wed Nov 18, 2009 1:01 am
Location: Still looking for the csc Antarctica
Contact:

this is so cool, build your own weapon lab, here I come!
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:

Betelgeuse wrote:new problem I can't seem to get random to work in the struct definition.
itemDamage : (random '("damage='laser:3d6'" "damage='particle:1d8'"))
makes itemDamage an empty string
Doh! Sorry about that. Looks like structs are not being evaluated properly.

BTW: If you want to test stuff like this you can now use TransData. Try:

Code: Select all

TransData /run
You will get a command prompt that evaluates TLisp expression.
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:
Betelgeuse wrote:new problem I can't seem to get random to work in the struct definition.
itemDamage : (random '("damage='laser:3d6'" "damage='particle:1d8'"))
makes itemDamage an empty string
Doh! Sorry about that. Looks like structs are not being evaluated properly.

BTW: If you want to test stuff like this you can now use TransData. Try:

Code: Select all

TransData /run
You will get a command prompt that evaluates TLisp expression.
O.O COOL!
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
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

george moromisato wrote: BTW: If you want to test stuff like this you can now use TransData. Try:

Code: Select all

TransData /run
You will get a command prompt that evaluates TLisp expression.
OMG. That is awesome. Thanks!
Get your own Galactic Omni Device
Get it now. It's free!!
Image
Post Reply