Listing of New Script Stuff
Listing of New Script Stuff
This list is a compilation of the stuff mit has posted in the numerous update topics in the general forum.
If there is a (?) before the description it is because I am taking a guess as to what it means. Mit would have to confirm
================================
- Events
"BuildingDemolished" - (?) Runs when the specified building is demolished
"UseSkill" - (?) Runs when the player uses the specified skill
"PlayerRespawn" - (?) Runs when the player respawns
"BattleSurrender" - (?) Runs when the player surrenders during battle
"BattleLeave" - (?) Runs when the player leavs a battle (log off maybe?)
"ItemAdded" - (?) Runs when the specified item is added to inventory
"ItemRemoved" - (?) Runs when the specified item is removed from inventory
"BuildingProductionRun" - (?) Runs when the building goes thre a production cycle
"TaskStart" - (?) Start of a task
"TaskComplete" - (?) Runs when a task is finished
"RobocrowKilled" - (?) Runs when somebody kills you in a crow
"RobocrowKill" - (?) Runs when you kill somebody in a crow
"PlayerBirthday" - (?) Runs on the anniversary days of the players joining or respawning after death
"PlayerDeath" - USed to run when your killed by another player, now means when you die naturally
"PlayerKilled" - Runs when your killed by another player
"AccessBuilding" - (?) Runs when a player hits Control at a building to access it
"NewPlayer" - Runs before PlayerLogin when a new user record is created
- Variables
$gBuildingNum - alternative to $gBuildingAccessNum
$gBuildingX, $gBuildingY - gets the current buildings map position
$gBuildingCode - Gets the current buildings type
$gNearestBuildingCode - Gets the nearest buildings type
$gBuildingOwnerID - gets the ID of the owner for the current building
$gPlayerNumSkills - (?) The number of skilsl the player has
$gPlayerUsage - (?) The players usage
$gPlayerVar and $gPlayerTimeVar for consistency. ($PlayerVar etc will be deprecated)
$gPlayerAuth - (?) Auth level of the player
$gPlayerIsMember - (?) equals 1 if the player is a paying member
$gPlayerNumDeaths - (?) number of deaths the player has had
$gBuildingVar[1-16] - 16 vars that are per building instance, are associated with the building that activates the script
$gBuildingTimeVar[1-16] - 16 vars that are per building instance, are associated with the building that activates the script
$gPlayerFollowing - (?) ID of the person who the player is following (ie, the tribe leader)
$gPlayerNumFollowing - (?) Number of people following the player (ie, they are a tribe leader)
$gBuildingAccessNum - (?) The map id of the building accessed
$gPlayerID - Gets the billing ID of the player
$gPlayerHunger - (?) Players hunger
$gPlayerThirst - (?) Players Thirst
$gPlayerMaxHealth - (?) Maximum health value for the player
$gPlayerAge - (?) Age of the player
$gTaskItem1 - (?) Item needed for a task
$gTaskItem2 - (?) Item needed for a task
$gTaskItem3 - (?) Item needed for a task
$gBuildingScriptParam - Returns the value set by *buildingparam [BuildingRecordNum] [Param (0-255)]
$gPlayerRobocrowKills - (?) Number of times the player has killed somebody else in a robocrow
$gPlayerRobocrowDeaths - (?) Number of times the player has been killed in a robocrow
$gParams[1-16]
$gPlayerX - Gets the players map coordinates (0-255)
$gPlayerY - Gets the players map coordinates (0-255)
$gPlayerWorldX - Gets the players world coordinates (1-1048k, 4096 per tile)
$gPlayerWorldY - Gets the players world coordinates (1-1048k, 4096 per tile)
- Variable Functions ( $variable = function )
sysIsInTown - (?) Town the player is in (name I assume)
sysRealTime - (?) Real time of the player
Rand renamed to sysRand - Sets a variable to a specified randum number and can now take variables as parameters
sysGetBuyPrice(item) - (?) Tells the buy price of the specified item in the building that activates the script
sysGetSellPrice(item) - (?) Tells the sell price of the specified item in the building that activates the script
sysAmountInStocks("ItemName") - (?) Tells the quantity of the specified item in the building that activates the script
sysIsBuildingPositionValid - Equals 1 if its possible to build in this position, 0 if not
sysGetTextEntry - returns the text entered into a OSDTEXTENTRY dialog
AddToInventory("ITEM_NAME") - Equals 0 if the item couldn't be added
- Names
%TARGET% - Name the player has highlighted in the player menu
If there is a (?) before the description it is because I am taking a guess as to what it means. Mit would have to confirm
================================
- Events
"BuildingDemolished" - (?) Runs when the specified building is demolished
"UseSkill" - (?) Runs when the player uses the specified skill
"PlayerRespawn" - (?) Runs when the player respawns
"BattleSurrender" - (?) Runs when the player surrenders during battle
"BattleLeave" - (?) Runs when the player leavs a battle (log off maybe?)
"ItemAdded" - (?) Runs when the specified item is added to inventory
"ItemRemoved" - (?) Runs when the specified item is removed from inventory
"BuildingProductionRun" - (?) Runs when the building goes thre a production cycle
"TaskStart" - (?) Start of a task
"TaskComplete" - (?) Runs when a task is finished
"RobocrowKilled" - (?) Runs when somebody kills you in a crow
"RobocrowKill" - (?) Runs when you kill somebody in a crow
"PlayerBirthday" - (?) Runs on the anniversary days of the players joining or respawning after death
"PlayerDeath" - USed to run when your killed by another player, now means when you die naturally
"PlayerKilled" - Runs when your killed by another player
"AccessBuilding" - (?) Runs when a player hits Control at a building to access it
"NewPlayer" - Runs before PlayerLogin when a new user record is created
- Variables
$gBuildingNum - alternative to $gBuildingAccessNum
$gBuildingX, $gBuildingY - gets the current buildings map position
$gBuildingCode - Gets the current buildings type
$gNearestBuildingCode - Gets the nearest buildings type
$gBuildingOwnerID - gets the ID of the owner for the current building
$gPlayerNumSkills - (?) The number of skilsl the player has
$gPlayerUsage - (?) The players usage
$gPlayerVar and $gPlayerTimeVar for consistency. ($PlayerVar etc will be deprecated)
$gPlayerAuth - (?) Auth level of the player
$gPlayerIsMember - (?) equals 1 if the player is a paying member
$gPlayerNumDeaths - (?) number of deaths the player has had
$gBuildingVar[1-16] - 16 vars that are per building instance, are associated with the building that activates the script
$gBuildingTimeVar[1-16] - 16 vars that are per building instance, are associated with the building that activates the script
$gPlayerFollowing - (?) ID of the person who the player is following (ie, the tribe leader)
$gPlayerNumFollowing - (?) Number of people following the player (ie, they are a tribe leader)
$gBuildingAccessNum - (?) The map id of the building accessed
$gPlayerID - Gets the billing ID of the player
$gPlayerHunger - (?) Players hunger
$gPlayerThirst - (?) Players Thirst
$gPlayerMaxHealth - (?) Maximum health value for the player
$gPlayerAge - (?) Age of the player
$gTaskItem1 - (?) Item needed for a task
$gTaskItem2 - (?) Item needed for a task
$gTaskItem3 - (?) Item needed for a task
$gBuildingScriptParam - Returns the value set by *buildingparam [BuildingRecordNum] [Param (0-255)]
$gPlayerRobocrowKills - (?) Number of times the player has killed somebody else in a robocrow
$gPlayerRobocrowDeaths - (?) Number of times the player has been killed in a robocrow
$gParams[1-16]
$gPlayerX - Gets the players map coordinates (0-255)
$gPlayerY - Gets the players map coordinates (0-255)
$gPlayerWorldX - Gets the players world coordinates (1-1048k, 4096 per tile)
$gPlayerWorldY - Gets the players world coordinates (1-1048k, 4096 per tile)
- Variable Functions ( $variable = function )
sysIsInTown - (?) Town the player is in (name I assume)
sysRealTime - (?) Real time of the player
Rand renamed to sysRand - Sets a variable to a specified randum number and can now take variables as parameters
sysGetBuyPrice(item) - (?) Tells the buy price of the specified item in the building that activates the script
sysGetSellPrice(item) - (?) Tells the sell price of the specified item in the building that activates the script
sysAmountInStocks("ItemName") - (?) Tells the quantity of the specified item in the building that activates the script
sysIsBuildingPositionValid - Equals 1 if its possible to build in this position, 0 if not
sysGetTextEntry - returns the text entered into a OSDTEXTENTRY dialog
AddToInventory("ITEM_NAME") - Equals 0 if the item couldn't be added
- Names
%TARGET% - Name the player has highlighted in the player menu
Last edited by zaroba on Wed Jun 13, 2012 10:05 am, edited 2 times in total.
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
Re: Listing of New Script Stuff
Pretty much look all good at first glance, i left the ones that need expounding on..zaroba wrote:If there is a (?) before the description it is because I am taking a guess as to what it means. Mit would have to confirm
- Events
"ItemAdded" - (?) Runs when the specified item is added to a building
"ItemRemoved" - (?) Runs when the specified item is removed from a building
"
"PlayerBirthday" - (?) Runs on the anniversary days of the players joining or respawning after death
$gPlayerWorldX - Gets the players map coordinates (0-255)
$gPlayerWorldY - Gets the players map coordinates (0-255)
itemadded and remove, are when a new item name is placed in inventory. Only the first item kicks this..
I assume Itemremoved is just the opposite.
Birthday event is like the old school birthday announcement except an event.
$gPlayerWorldX and Y, give more points of refrence.. there are I believe 4096 points to each of the 256 tiles, for more fine tuned placement of things. goes from 0 - to like 1048k+
good stuff, all of it.
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
can you both bump me an email to remind me to get you accounts set up on the wiki, then you can edit that yourselves. (At work atm and don't have access to all my admin stuff). I also need to do it when i get home and check email, rather than when i've started coding and met you in game, by which point setting up admin accounts on wikis is not an acceptable use of my time ;]
That's assuming you're happy to update the wiki for us, of course
That's assuming you're happy to update the wiki for us, of course
p.s. with regard to all the (?) items.. nothing majorly wrong with any of those assumptions (Which is obviously a good sign, as they should be mostly self-evident where possible).
Few little notes :
$gPlayerUsage is usage in hours.
$gTaskItem1, $gTaskItem2 etc are the item currently being 'used' in a task, and are also used as task codes in some of the other tasking mechanisms.
e.g. Some of the civ building scripts do this kinda thing :
the '3' is used as a code to identify the task, and the 'TaskComplete' event picks that up like:
TaskComplete comes in 3 flavours atm..
Type 0 = Combining multiple items together (like revelations)
Type 1 = 'Standard' scripted tasks triggered using *dotask
Type 2 = Building tasks triggered using *dobuildingtask
The tasking system(s) need their own comprehensive documentation page, and i'll probably add new variable names to avoid the duplication of use.
sysIsInTown returns 1 or 0 dependin on whether you're currently in town limits or not. (Its mostly intended for custom construction scripts atm.. may be more useful if it returned the town ID num or 0).
AddToInventory is now sysAddToInventory. (the 'sys' bit will be reserved for all system calls, to avoid me fecking up your scripts by adding in a new system function name that you might happen to have been using for your own custom function).
Latest additions by the way (not yet on the wiki or release notes..)
System values
$gBuildingNumEmployees
$gBuildingMaxEmployees
$gBuildingSalePrice
$gPlayerNumJobs
$gGameDay
Events:
AccessConstruction
BuildingDemolished
UseSkill
BuildingOwnerDied
SkillAdded
SkillRemoved
System functions
sysGetPlayerName
sysGetItemName
sysGetSkillName
sysGetEmployeeID
which should all be pretty much self-explanatory, right?
Few little notes :
$gPlayerUsage is usage in hours.
$gTaskItem1, $gTaskItem2 etc are the item currently being 'used' in a task, and are also used as task codes in some of the other tasking mechanisms.
e.g. Some of the civ building scripts do this kinda thing :
Code: Select all
*dobuildingtask %PLAYER% $gBuildingAccessNum 3 Baking some bread
Code: Select all
// Type 2 = Building tasks (*dobuildingtask)
Event( "TaskComplete", "2" )
{
if ( $gTaskItem1 == 3 )
{
$ret = BakeryTaskComplete()
}
}
Type 0 = Combining multiple items together (like revelations)
Type 1 = 'Standard' scripted tasks triggered using *dotask
Type 2 = Building tasks triggered using *dobuildingtask
The tasking system(s) need their own comprehensive documentation page, and i'll probably add new variable names to avoid the duplication of use.
sysIsInTown returns 1 or 0 dependin on whether you're currently in town limits or not. (Its mostly intended for custom construction scripts atm.. may be more useful if it returned the town ID num or 0).
AddToInventory is now sysAddToInventory. (the 'sys' bit will be reserved for all system calls, to avoid me fecking up your scripts by adding in a new system function name that you might happen to have been using for your own custom function).
Latest additions by the way (not yet on the wiki or release notes..)
System values
$gBuildingNumEmployees
$gBuildingMaxEmployees
$gBuildingSalePrice
$gPlayerNumJobs
$gGameDay
Events:
AccessConstruction
BuildingDemolished
UseSkill
BuildingOwnerDied
SkillAdded
SkillRemoved
System functions
sysGetPlayerName
sysGetItemName
sysGetSkillName
sysGetEmployeeID
which should all be pretty much self-explanatory, right?
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
dotask is:
with the task events getting a param of 1 and the TASK_CODE stored in $gTaskItem1, i.e.
which'd be triggered by something like
SetContext is immensely useful but only works for some variables atm and may need its format changing later (hence why its not currently documented). Setting the context changes the current 'player' being referenced, so you can do things like this:
Which gets you the kudos/wisdom of the player who started a challenge and the target of that challenge.
Currently this only applies to $gPlayer... variables. SetBuildingContext (and RestoreBuildingContext) are on the list.
Code: Select all
*dotask [PLAYER_ID] [TASK_CODE] [TEXT]
Code: Select all
Event( "TaskComplete", "1" )
{
if ( $gTaskItem1 == 101 )
{
$ret = ClayMakingPotTaskComplete()
}
}
Code: Select all
*dotask %PLAYER% 101 Making a clay pot
Code: Select all
Event( "InitChallenge", "" )
{
$challengerWisdom = $gPlayerKudos
SetContext( $gTargetID )
$targetWisdom = $gPlayerKudos
RestoreContext()
Currently this only applies to $gPlayer... variables. SetBuildingContext (and RestoreBuildingContext) are on the list.
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am
yeh, %PLAYER% is the player name in the example.
Task time is set in the TaskStart event using PlayerTaskStartSetTime with the param indicating the number of seconds the task will take, e.g.
Task time is set in the TaskStart event using PlayerTaskStartSetTime with the param indicating the number of seconds the task will take, e.g.
Code: Select all
Event( "TaskStart", "1" )
{
if ( $gTaskItem1 == 101 )
{
PlayerTaskStartSetTime(20)
}
}
- morbydvisns
- Posts: 1889
- Joined: Sun Jan 30, 2005 12:51 am