1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[TOT] [TOTPP] The General Library

Discussion in 'Civ2 - Scenario Creation' started by Prof. Garfield, Jul 10, 2019.

  1. Prof. Garfield

    Prof. Garfield Chieftain Supporter

    Mar 6, 2004
    The General Library is a collection of relatively basic functions with wide potential use. The standard usage will be

    The General Library is currently under construction, so go to the last page of this thread to find the most recent version.

    If someone has a better name than "General Library" and gen., I'm open to it.

    You can contribute to the General Library in the following ways:

    1. Suggest functions for inclusion.

    Good candidates are functions that tell the end user most or all of what it does just by its usage specification line. For example,
    tells most of what you need to know about the function and how to use it. Maybe you need to check if farmland counts as irrigation, but otherwise it is obvious what the function does and how it is supposed to work.

    This is not a strict requirement. It may sometimes be desirable to include more complicated functionality in this Library, if it is likely to be used in a lot of places.

    If you make some suggestions, update the generalLibrary.lua file with the new functions, both in the List of Functions and by making a placeholder comment (with any extra details needed) in the implementation section.

    2. Testing functions

    Sometimes there will be a submission to the General Library that the author didn't have time (or desire) to test as thoroughly as it probably should have been. This will be noted in the function list.

    3. Submitting code

    If you have some time, you can implement some of the suggested functions for this library. Many of these will be relatively simple functions that would be good to practice on (and then test).

    Submission Guidelines:

    If you are working on the General Library, and someone else makes a submission before you finish, you must include all their changes into the version you post. If you don't want this to happen, make a post that you are modifying the events. In that case, it will be the other person's responsibility to merge the changes. If you have "claimed" the events for more than 4 days, we revert back to the earlier submission rule, unless you make an update. You can always comment out bad code and submit, if you want to return to it later.

    In the submission post, explain your changes. If you are proposing a function for inclusion (including if you have already written it), put its usage specification line in the post along with any other details necessary.

    P.S. This library will be referenced in my next Lua Lesson[/CODE]

    Attached Files:

  2. Prof. Garfield

    Prof. Garfield Chieftain Supporter

    Mar 6, 2004
    New Functions proposed and completed (may need testing)
    -- applyWonderBonus(wonderObject or integer,tribeObject or integer)-->boolean
    -- checks if the bonus for the wonder should be applied for the tribe
    -- gen.wonderModifiedMoves(unit)-->integer
    -- returns the movement allowance of a unit after
    -- taking into account nuclear power, wonders
    -- returns atomic movement points
    -- maxMoves(unit)--> integer
    -- gen.maxMoves(unit) --> integer
    -- returns movement allowance for a unit after taking damage
    -- into account, multiplied by the road/rail multiplier
    -- Helper Function (provided as both local function and in table
    -- gen.moveRemaining(unit)
    -- returns gen.maxMoves-unit.moveSpent

    Existing proposal completed
    -- gen.isCoastal(unitType)-->boolean

    Attached Files:

Share This Page