modding:best_practices
Differences
This shows you the differences between two versions of the page.
modding:best_practices [2012/05/28 01:32] – created - in progress - not done star_weaver | modding:best_practices [2014/12/27 04:40] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | **//In progress --- if I don't finish this within a day or two, smack me in IRC --- need to take break --- StarWeaver //** | ||
+ | |||
+ | =====Naming===== | ||
+ | |||
+ | Consistant naming practices help people work on or with your code. This includes yourself, after you've not looked at your own code for a while. | ||
+ | |||
+ | Pick a short, perhaps 3-5 character ' | ||
+ | |||
+ | In the examples on the wiki, ' | ||
+ | |||
+ | ====Unids==== | ||
+ | |||
+ | George' | ||
+ | |||
+ | Using the unique modder tag on your unids makes it a little clearer where the types are coming from and lets other modders reference your unids with the same names you do, by just copying their entity definitions from the top of your file, and with no fear of name collisions. | ||
+ | |||
+ | The one exception is the unid for the extesnsion itself. You could make an appropriate name for each file if you like, but it's conventional otherwise to just use UNIDExtension for it. It's (// | ||
+ | |||
+ | [//todo: add table with each type, prefix george uses for it, and examples -wvr//] | ||
+ | |||
+ | ====Global Variables and Functions==== | ||
+ | |||
+ | The global variable and function namespace (functions are stored as variables in tlisp) is a messy, large, and rather disorganized space (just check the output of sysGlobals to see it). It contains | ||
+ | |||
+ | * All the builtin functions (list, objGetName) | ||
+ | * All of the system global variables (gPlayerShip) | ||
+ | * All the event variables (gScreen, aHitPos) which are left around without being cleared even when the event they were set for is over. | ||
+ | * All of George' | ||
+ | |||
+ | |||
+ | |||
+ | ===George' | ||
+ | Universal functions, list adapted from head of Code.xml:\\ | ||
+ | * **int** - Internal functions (may change from version to version) | ||
+ | * **math** - General math functions | ||
+ | * **obj** - General object functions | ||
+ | * **scr** - General functions relating to dock screens | ||
+ | * **str** - General string functions | ||
+ | * **sys** - General functions relating to star systems | ||
+ | |||
+ | Faction / entity specific functions | ||
+ | |||
+ | // todo - move this to a list of george' | ||
+ | |||
+ | * **arc** - (Iocrym) archive from Heretic | ||
+ | * **bam** - Battle Arena Maximus | ||
+ | * **chr** - Charon pirates | ||
+ | * **com** - Commonwealth | ||
+ | * **csc** - Commonwealth Star Carrier (from the fleet) | ||
+ | * **dom** - Domina | ||
+ | * **flt** - Commonwealth Fleet | ||
+ | * **her** - Heretic | ||
+ | * **hua** - Huari | ||
+ | * **kor** - Korolov Shipping | ||
+ | * **mil** - Commonwealth Militia | ||
+ | * **mrad** - MRAD probe from Heretic | ||
+ | * **mne** - Commonwealth Mining //(any idea what the acronym stands for? -wvr)// | ||
+ | * **neu** - Neurohack device from Heretic | ||
+ | * **srv** - Service? (used once in code.xml) | ||
+ | * **stk** - St. Katherine' | ||
+ | * **sun** - Sung Slavers | ||
+ | * **ter** - Teratons | ||
+ | |||
+ | |||
+ | // todo - temporary - need it's own page // | ||
+ | |||
+ | |||
+ | | (**arcQuestionHandler** qIndex) | ||
+ | | (**bamComputeArmorLevel** theObj) | ||
+ | | (**bamComputeOpponentList** baseObj arenaSkill arenaRep) | ||
+ | | (**bamComputePrize** playerSkill playerRep opponentSkill prizeBonus) | ||
+ | | (**bamComputeReputation** baseObj) | ||
+ | | (**bamComputeShieldLevel** theObj) | ||
+ | | (**bamComputeSkill** battleResults) | ||
+ | | (**bamComputeWeaponLevel** theObj) | ||
+ | | (**bamCreateGladiator** baseObj shipClass) | ||
+ | | (**bamCreateGladiatorBySkill** baseObj arenaSkill) | ||
+ | | (**bamCreateMeleeOpponents** sourceObj shipCount targetPlayerChance classFunc) | ||
+ | | (**bamDoorsClose** arenaObj) | ||
+ | | (**bamDoorsOpen** arenaObj) | ||
+ | | (**chrCancelRaiderOrders** frigateObj) | ||
+ | | (**chrComputeAmbushPos** fromObj toObj) | ||
+ | | (**chrCreateRaider** frigateObj pos) | CharonPirates.xml | ||
+ | | (**chrDeployFrigateRaid** transportObj originObj destObj cargoValue) | ||
+ | | (**chrDeployKronosaurus** ) | CharonPirates.xml | ||
+ | | (**chrGetPrimaryStronghold** sourceObj) | ||
+ | | (**chrOrderRaiders** frigateObj order orderTarget orderData) | ||
+ | | (**chrRaidTransport** transportObj originObj destObj cargoValue) | ||
+ | | (**comSealedContainerHack** ) | Commonwealth.xml | ||
+ | | (**comTrafficControl** homeObj maxTraffic) | ||
+ | | (**cscSquadronCreateShip** theCSC theClass) | ||
+ | | (**cscSquadronDeployShip** theCSC theClass) | ||
+ | | (**domGainXP** xpGain) | ||
+ | | (**domGetLevel** xp) | Domina.xml | ||
+ | | (**domGetTimeRequired** levelReq) | ||
+ | | (**domInitRelationship** ) | Domina.xml | ||
+ | | (**domInvokePower** levelReq) | ||
+ | | (**domShowPower** levelReq) | ||
+ | | (**fltOrderCheckPosition** theCSC) | ||
+ | | (**herAttackInProgress** theStation) | ||
+ | | (**herStatus** statusField) | ||
+ | | (**herStatusClear** statusField) | ||
+ | | (**herStatusSet** statusField theValue) | ||
+ | | (**huaCheckExperience** xp) | Huari.xml | ||
+ | | (**huaHuariDestroyed** theObj theDestroyer) | ||
+ | | (**huaIsGateToHuaramarca** nodeID gateID nodesChecked) | ||
+ | | (**huaSungDestroyed** theObj theDestroyer) | ||
+ | | (**intAmmoBoxOpen** theContents) | ||
+ | | (**intArmorEnhanceStatus** result) | ||
+ | | (**intArmorRepairAll** theShip repairTech alwaysRepair) | ||
+ | | (**intAsteroidOnMining** miningDifficulty) | ||
+ | | (**intAutoInstall** theSource theItem) | ||
+ | | (**intBarricadeUse** barricadeClass) | ||
+ | | (**intBlackMarketBuyPrice** thisItem) | ||
+ | | (**intBlackMarketOnDestroy** cost) | BlackMarket.xml | ||
+ | | (**intBlackMarketPromotion**) | ||
+ | | (**intBlackMarketSellPrice** thisItem) | ||
+ | | (**intBushidoArmorEnhancement**) | ||
+ | | (**intBushidoShieldEnhancement**) | ||
+ | | (**intBushidoWeaponEnhancement**) | ||
+ | | (**intBuyItems** itemCount itemCost) | ||
+ | | (**intCalcExplosionType** theObj) | ||
+ | | (**intCommonwealthCrime** severity description) | ||
+ | | (**intCommonwealthOnDestroy**) | ||
+ | | (**intCommonwealthOnInit** prevScreen) | ||
+ | | (**intComputeBuyPrice** thisItem) | ||
+ | | (**intComputeRandomEncounterCourse** theObj theTarget) | ||
+ | | (**intComputeRandomEncounterPos** theTarget) | ||
+ | | (**intComputeRandomEncounterPosEx** ) | Code.xml | ||
+ | | (**intComputeSellPrice** thisItem) | ||
+ | | (**intConsumeItem** theObj theItem) | ||
+ | | (**intContainerGetExplosionType** theObj) | ||
+ | | (**intContainerOnDamage** theObj damageHP) | ||
+ | | (**intCorporateCrime** severity description) | ||
+ | | (**intCorporateGenerateEnhancement** theItem) | ||
+ | | (**intCorporateOnDestroy**) | ||
+ | | (**intCorporateOnInit** prevScreen) | ||
+ | | (**intDestroyItems** theObj) | ||
+ | | (**intEnhanceWeaponUse** newMods damageType successText) | ||
+ | | (**intFieldCrystalInstall** enhancementType theLifetime) | ||
+ | | (**intFieldCrystalUse** newMods successText) | ||
+ | | (**intFleetCreateWingmen** aStation aCount theClass) | ||
+ | | (**intFleetCrime** severity description) | ||
+ | | (**intFleetDisperseWingmen** aStation aCount) | ||
+ | | (**intFleetPromotion**) | ||
+ | | (**intGetGateToSystem** theSource destSystem) | ||
+ | | (**intGetGlobalAchievements** ) | Code.xml | ||
+ | | (**intHPEnhancement1**) | ||
+ | | (**intHPEnhancement2**) | ||
+ | | (**intHPEnhancement3**) | ||
+ | | (**intInstallAfterPurchase** theItem theInstallCriteria theInstallMargin itemCost) | ||
+ | | (**intInstallDevicePrep** thisItem costToInstall isItemInCargo buyAndInstall varCanInstall varCost varDesc) | Compatibility10.xml | ||
+ | | (**intIsGateToSystem** nodeID gateID destSystem nodesChecked) | ||
+ | | (**intItemEnhanceStatus** result successText itemName) | ||
+ | | (**intJettisonItem** theObj theItem) | ||
+ | | (**intLootAllItems** theSource theDest criteria) | ||
+ | | (**intMakayevArmorEnhancement**) | ||
+ | | (**intMakayevWeaponEnhancement**) | ||
+ | | (**intMissionAchievementString** missionsCompleted missionsFailed) | ||
+ | | (**intMissionRewardPayment** theReward) | ||
+ | | (**intRandomMessage** source staticVar altVar) | ||
+ | | (**intRasiermesserArmorEnhancement**) | ||
+ | | (**intRasiermesserWeaponEnhancement**) | ||
+ | | (**intRingerBuyMargin** thisItem) | ||
+ | | (**intRingerCrime** severity description) | ||
+ | | (**intRingerInstallDevicePrep** thisItem costToInstall isItemInCargo) | ||
+ | | (**intRingerOnDestroy**) | ||
+ | | (**intRingerOnInit** prevScreen) | ||
+ | | (**intRingerSellMargin** thisItem) | ||
+ | | (**intRoundDown** value multiple) | ||
+ | | (**intRoundUp** value multiple) | ||
+ | | (**intSellItems** itemCount itemCost) | ||
+ | | (**intSetCompatibleFuel** fuelList) | ||
+ | | (**intSetCompatibleFuelEx** fuelList) | ||
+ | | (**intTaikonBuyMargin** thisItem) | ||
+ | | (**intTeratonBuyMargin** thisItem) | ||
+ | | (**intTeratonGetLevelCurve** value theItem) | ||
+ | | (**intTeratonGetValue** value theItem) | ||
+ | | (**intTeratonMugging** destination) | ||
+ | | (**intTeratonSellMargin** thisItem) | ||
+ | | (**intZoanthropeOnObjDestroyed**) | ||
+ | | (**intZoanthropeOnOrderChanged**) | ||
+ | | (**korComputePlayerLevel** ) | KorolovShipping.xml | ||
+ | | (**korEmptyFreighter** freighterObj) | ||
+ | | (**korEscortRecord** shipClass) | ||
+ | | (**korFillFreighter** freighterObj pricePerContainer) | ||
+ | | (**korFrigateDestroyed** ) | KorolovShipping.xml | ||
+ | | (**korInitialize** ) | KorolovShipping.xml | ||
+ | | (**korMissionFailure** transObj) | ||
+ | | (**korMissionStrongholdSuccess** missionXP destroyedByPlayer) | ||
+ | | (**korMissionSuccess** transObj missionXP) | ||
+ | | (**korMsgWelcome** playerLevel) | ||
+ | | (**korOnShipDestroyed** ) | KorolovShipping.xml | ||
+ | | (**mathProbTableLookup** probTable) | ||
+ | | (**milCanEnterCC** ) | CommonwealthMilitia.xml | | ||
+ | | (**milInit** ) | CommonwealthMilitia.xml | | ||
+ | | (**milMissionSuccess** ) | CommonwealthMilitia.xml | | ||
+ | | (**milShowPromotionScreen** returnScreen) | ||
+ | | (**mneAllTargetsDestroyed** sourceObj excludeObj) | ||
+ | | (**mradDisplay** probeObj anomalyPos displayField) | ||
+ | | (**neuConsumeCharge** ) | Code.xml | ||
+ | | (**neuGetCharges** ) | Code.xml | ||
+ | | (**objAddItemByValue** theObj theItem theValue theCurrency) | ||
+ | | (**objGetFitCount** theObj theItem) | ||
+ | | (**objTranslateX** theObj theMessage theDefault) | ||
+ | | (**sacrificeEffect** theObj) | ||
+ | | (**scrShowBuyScreen** itemsToSell returnScreen installOptions) | ||
+ | | (**scrShowSellScreen** itemsToBuy returnScreen screenOptions) | ||
+ | | (**srvFindRepairArmor** theSource maxDist minLevel) | ||
+ | | (**stkDistanceToStK** nodeID nodesChecked) | ||
+ | | (**stkFreshFoodPrice** theItem) | ||
+ | | (**stkFreshFoodStatus** theItem) | ||
+ | | (**stkFreshFoodUpdate** theSource theItem) | ||
+ | | (**strMassString** mass) | Code.xml | ||
+ | | (**strNumber** theValue) | ||
+ | | (**sunAttackTarget** theCarrier theShip theTarget) | ||
+ | | (**sunOrderWing** theCarrier theOrder theTarget) | ||
+ | | (**sysGetRandomOreType** ) | Code.xml | ||
+ | | (**terCreateDefender** theNest) | ||
+ | | (**useRepairArmor** theItem theSegment) | ||
+ | | (intInstallDevicePrepEx //fixme -wvr// | ||