ATLust Wiki
Advertisement

ATLust V2 API Information[]

The API for ATLust V2 has two major parts. The "Command" part, where your script sends commands to ATLust. And the "Signal" part (AKA, Notifications), in which ATLust notifies your script that something has happened. The API also has multiple levels. Level 1 being the public API which everyone can use, higher levels require an API Key.

API Commands[]

LSL Name: The constant name for the command ID

ID: The value that identifies the command to the server.

Description: A description of what the command does.

Requires: Values that are required to complete the command. (JSON Object)

Returns: The values that the command returns. (Most are returned as a JSON Object).


All returned values may be strings starting with "ERR/" if there was an error while processing the command. The text following "ERR/" will explain the error (IE: Missing required parameters). The entire response message from the HUD may also start with "ERR/" in the case of major errors.


LSL Name ID Description Requires Returns
atl_api_test 10001 Just a simple test request. "Hello, World!"
atl_api_get_stats 10002 Gets the lust, arousal, sensitivity, health and sex status (Having sex or not), of the players active character.
lust: (Float, 0.0 - 1.0)

arousal: (Float, 0.0 - 1.0)

sensitivity: (Float, 0.0 - 10.0)

health: (Float, 0.0 - 1.0)

sex: (Boolean, true if the player is having sex)

atl_api_get_partner_arousal 10003 Gets the arousal of the specified partner. target: (UUID) target: (UUID, the player's UUID)

arousal: (Float, 0.0 - 1.0. Will be -1.0 if not having sex)

atl_api_get_all_organs 10004 Gets all organ ID's in a JSON Object -> JSON Array format. JSON Object {(String) Organ Type: JSON Array[(String) Organ ID)]}
atl_api_get_organ_info 10005 Gets the information for a specific organ from an organ type + index value or organ ID. The organ type and index value can be used as an alternative to organ ID if the organ ID is not known. organ_type: (String)

index: (Integer)

-- OR --

organ_id: (String)

JSON Object (Varies, see "Organ Info" section)
atl_api_get_sex_actions 10006 Gets a list of all sex actions being performed on or by the player's active character. JSON Array of JSON Objects

init: (Boolean, true if the player is the initiator of the action)

other_player: UUID of the other player

id: (Integer, ID of the sex action being performed)

name: (String, name of the action being performed)

pen: (Boolean, true if the sex action involves penetration)

init_organ: (String, Name of the organ used by the action initiator)

rec_organ: (String, Name of the organ being used on the receiver)

atl_api_get_is_atlust 10007 Gets the ATLust ownership status of the target UUID. target: (String, player UUID) target: (UUID, The player UUID)

is_user: (Boolean, true if the target is an ATLust user)

atl_api_get_nearby_players 10008 Gets a list of all active ATLust players in the region. JSON Array of UUID's
atl_api_get_conditions 10009 Gets a list of all active conditions on the player's active character. JSON Array of Strings (Condition names)
atl_api_get_attraction_to 10010 Gets the level of attraction of the player's active character to the target character. player_id: (String, target player UUID)

--- OR ---

char_id: (Integer, target character ID)

target: (String or integer, The target player or character ID)

attraction: (Float, -1.0 - 1.0, The level of attraction to the target. The higher the number, the more attractive. Will be string "NOT_FOUND" if the target is invalid)

atl_api_get_gender 10011 Gets the target character's gender information. ATLust V2 doesn't have a simple male/female setting. So extra data is sent so your script can make the determination of how to proceed. player_id: (String, target player UUID)

--- OR ---

char_id: (Integer, target character ID)

target: (String or integer, The target player or character ID)

ident: (String, The character's gender identity. This is customizable, so it may not always say male, female or hermaphrodite)

bal: (Float, 0.0 - 1.0, The character's gender balance as determined by the gender transformation system. Closer to 0 means more female, closer to 1 means more male. Will be -1.0 if gender transformation is disabled)

penis: (Boolean, true if the character has a penis.)

vag: (Boolean, true if the character has a vagina.)

atl_api_get_name 10012 Gets the character's name and title. player_id: (String, target player UUID)

--- OR ---

char_id: (Integer, target character ID)

target: (String or integer, The target player or character ID)

name: (String, The character's name. "NOT_FOUND" if the target is invalid)

title: (String, The characters title. "NOT_FOUND" if the target is invalid)

atl_api_get_char_id 10013 Gets the target player's current active character ID and character name. player_id: (UUID, The Player's UUID) char_id: (Integer, The ID of the player's current active character. String "NOT_FOUND" if player ID is invalid.)

char_name: (String, The name of the player's current active character String "NOT_FOUND" if player ID is invalid.)

atl_api_get_char_species 10014 Gets the species of the target player ID or character ID. player_id: (String, target player UUID)

--- OR ---

char_id: (Integer, target character ID)

target: (String or integer, The target player or character ID)

species: (JSON Object, Species object of the target)

atl_api_get_preg_count 10015 a key-value list of the number of pregnancies in each organ. JSON Object <(String) Organ ID, (Integer) Number of pregnancies>
atl_api_get_breeding_ground 10016 Gets the data of the breeding ground the player is currently on name: (String, The name of the breeding ground. "NOT_BG" if the current parcel is not a breeding ground)

desc: (String, The description of the breeding ground. "NOT_BG" if the current parcel is not a breeding ground)

active: (Boolean, True if the breeding ground is active. An inactive breeding ground is when the sign has been removed and should not be treated as a breeding ground)

players: (Integer, The number of players in the region, not just on the breeding ground)

atl_api_get_pregnancy_progress 10017 Gets the highest pregnancy progress. If there is more than one pregnancy, the one with the highest progress is returned. float: 0.0 - 1.0
atl_api_get_dtf_status 10018 Gets the current DTF statuses of the player dtf: (String, The DTF state: no, yes_sub, yes_dom, yes_switch)

auto_partner: (Boolean, true if the player is automatically accepting partner requests)

auto_rp: (Boolean, true if the player is automatically accepting RP mode requests)

sex_doll: (Boolean, true if the player has indicated themselves as a sex doll)

atl_api_get_connected_portals 10019 Returns a list of all connected portals JSON Array of Strings (Portal ID's)
atl_api_get_organ_by_type 10020 Returns a list of all organs for the specified type organ_type: (String, the type of organ) JSON Array of Strings (Organ ID's)
atl_api_register_notifications 20000 Registers the requesting object to receive API notifications/signals. (Only necessary if needing signals that are not public, or if the script is not attached to the player) "OK" (If successful)
atl_api_change_char 20001 Switches the player's active character to the one specified. (You should receive the

atl_api_signal_char_changed signal shortly after if successful)

char_id: (Integer, The ID of the character) Boolean, true if successful.
atl_api_set_arousal 20002 Changes the player's active character's arousal to the indicated value. arous: (Float, 0.0-1.0) "OK"
atl_api_set_lust 20003 Changes the player's active character's lust to the indicated value. lust: (Float, 0.0-1.0) "OK"
atl_api_get_infections 20004 Gets a list of all infections the player's active character has. JSON Array of Strings (Infection name)
atl_api_get_desires 20005 Gets a list of all desires of the player's active character. JSON Array of Strings (Desire name)
atl_api_get_cum_list 20006 Gets a list of all cum inside of the player's active character. JSON Object <(String) Organ Name, JSON Object>


sources: (JSON Array, Character ID's of the source of the cum)

vol: (Float, The volume of the cum in ml)

known: (Boolean, True if the player is aware of the cum)

anon: (Boolean, True if the source of the cum is not known to the player)

pot: (Float, The current potency of the cum)

atl_api_get_relations 20007 Gets a key-value list of all the related characters to the player's active character. JSON Object <(Integer) Char ID, (Float, 0.0 - 1.0) Relation amount>
atl_api_get_pregnancy 20008 Gets a list of the pregnancies in the target organ. organ_type: (String, The organ type)

organ_index: (Integer, The index in the list of organs)

-- OR --

organ_id: (String, the ID of the organ)

JSON Array of JSON Objects

species: (JSON Object, The species of the baby)

due_time: (Integer, The unix time of when the pregnancy will be complete. This can be affected by items such as Preg Accel)

father_char: (Integer, The character ID of the father of the baby)

father_anon: (Boolean, True if the father is not known to the character)

mother_char: (Integer, The character ID of the mother, the originator of the ovum)

atl_api_mod_arousal 20009 Changes the active characters arousal by the amount specified arous: (Float, -1.0 - 1.0, The amount to change arousal by) "OK"
atl_api_mod_lust 20010 Changes the active characters lust by the amount specified lust: (Float, -1.0 - 1.0, The amount to change lust by) "OK"
atl_api_connect_portal 20011 Connects the indicated organ to the portal network. Returns the portal ID. organ_type: (String, The organ type)

organ_index: (Integer, The index in the list of organs)

-- OR --

organ_id: (String, the ID of the organ)

portal_id: (String, The ID of the portal, can be used by other commands that interact with portals.)
atl_api_disconnect_portal 20012 Disconnects the indicated organ from the portal network organ_type: (String, The organ type)

organ_index: (Integer, The index in the list of organs)

-- OR --

organ_id: (String, the ID of the organ)

"OK"
atl_api_begin_portal_sex 20013 Begins portal sex with the indicated portal connection. organ_type: (String, The organ type)

organ_index: (Integer, The index in the list of organs)

-- OR --

organ_id: (String, the ID of the organ)


portal_id: (String, the ID of the target portal)

"OK"
atl_api_disable_organ 20014 Disables the indicated organ for 5 minutes. organ_type: (String, The organ type)

organ_index: (Integer, The index in the list of organs)

-- OR --

organ_id: (String, the ID of the organ)

"OK"


Signals[]

API Signals (Or notifications) are sent out when something happens, such as the player using an item, or starting sex. All level 1 signals are sent automatically without the need to register, but they are only sent to scripts attached to the player. If you need to receive signals on a non-attached script, you will need to register (atl_api_register_notifications).

All parameters of the signal are in a JSON object form.

LSL Name ID Description Parameters
atl_api_signal_stats 1000 Stats sent out every minute by the HUD lust: (Float, 0.0 - 1.0)

arousal: (Float, 0.0 - 1.0)

sensitivity: (Float, 0.0 - 10.0)

health: (Float, 0.0 - 1.0)

atl_api_signal_sex_start 1001 A sex action has started action_id: (Integer, Sex action ID)

action_name: (String, Name of the sex action)

init_char: (Integer, The character ID which initiated the action)

rec_char: (Integer, The character ID which is receiving this sex action)

init_agent: (String, The player ID which initiated the action)

rec_agent: (String, The player ID which is receiving this action)

rec_species: (JSON Object, A species object of the character that is receiving this action)

init_species: (JSON Object, A species object of the character that initiated this action)

init_organ: (String, Organ ID of the organ the initiator is using for this action)

rec_organ: (String, Organ ID of the organ on the receiver that is being used by this action)

atl_api_signal_sex_stop 1002 A sex action has stopped action_id: (Integer, Sex action ID)
atl_api_signal_sex_stop_all 1003 The player, or the player's partner clicked the "Stop all" button, stopping all sex actions.
atl_api_signal_play_action_received 1004 The character was played with by another character. action_id: (Integer, Play action ID)

action_name: (String, Name of the sex action)

init_char: (Integer, The character ID which initiated the action)

rec_char: (Integer, The character ID which is receiving this play action)

init_agent: (String, The player ID which initiated the action)

rec_agent: (String, The player ID which is receiving this action)

rec_arousal: (Float, The receivers arousal level after being played with)

atl_api_signal_play_action_given 1005 The character played with another character. action_id: (Integer, Play action ID)

action_name: (String, Name of the sex action)

init_char: (Integer, The character ID which initiated the action)

rec_char: (Integer, The character ID which is receiving this play action)

init_agent: (String, The player ID which initiated the action)

rec_agent: (String, The player ID which is receiving this action)

rec_arousal: (Float, The receivers arousal level after being played with)

atl_api_signal_climax 1006 The character's character has climaxed organ: (String, The organ name that has climaxed)

other_organ: (String, The organ name on the partner that caused the climax)

other_player: (UUID, The Player ID of the partner that caused the climax)

penetrative: (Boolean, True if the action that caused the climax is penetrative)

rp_mode: (Boolean, True if the climax was caused by RP mode)

atl_api_signal_partner_climaxed 1007 The character's partner has climaxed organ: (String, The organ name that caused the climax)

other_organ: (String, The organ name on the partner that has climax)

other_player: (UUID, The Player ID of the partner that has climaxed)

penetrative: (Boolean, True if the action that caused the climax is penetrative)

rp_mode: (Boolean, True if the climax was caused by RP mode)

atl_api_signal_tease_action_given 1008 The character has teased another character. action_id: (Integer, Tease action ID)

action_name: (String, Name of the tease action)

init_char: (Integer, The character ID which initiated the action)

rec_char: (Integer, The character ID which is receiving this tease action)

init_agent: (String, The player ID which initiated the action)

rec_agent: (String, The player ID which is receiving this action)

atl_api_signal_tease_action_received 1009 The character has been teased by another character. action_id: (Integer, Tease action ID)

action_name: (String, Name of the tease action)

init_char: (Integer, The character ID which initiated the action)

rec_char: (Integer, The character ID which is receiving this tease action)

init_agent: (String, The player ID which initiated the action)

rec_agent: (String, The player ID which is receiving this action)

atl_api_signal_preclimax_response 1010 The character is about to climax and the player has chosen an option on the 'Pre-climax' dialog. response: (String, The option that the player chose: pullout, inside, cooldown or knot)
atl_api_signal_char_data_updated 1011 The player updated their character's data. type: (String, The type of data that was changed.)
atl_api_signal_char_changed 1012 The player changed to a different character. old_char: (Integer, The character ID of the old character)

new_char: (Integer, The character ID of the new character)

atl_api_signal_item_used 1013 The player used an item on their character. (Often followed by a atl_api_signal_condition_gained signal) item: (String, The name of the item used)
atl_api_signal_condition_gained 1014 The character has gained a new condition. name: (String, The name of the condition)

mod: (String, A modifier used to allow stacking of conditions. This will often times be a character ID if the condition is caused by another character)

atl_api_signal_condition_removed 1015 The character has lost a condition. name: (String, The name of the condition)

mod: (String, A modifier used to allow stacking of conditions. This will often times be a character ID if the condition is caused by another character)

atl_api_signal_titled_earned 1016 The character has earned a new title. name: (String, The name of the title)
atl_api_signal_inseminated 1017 The character has been inseminated. organ: (String, The organ name that was inseminated)

species: (JSON Object, The species of the cum)

amount: (Float, The amount of cum received in ML)

known: (Boolean, True if the character is aware of being inseminated)

anonymous: (Boolean, True if the origin of the cum is NOT known to the player)

rp_mode: (Boolean, True if the action was caused by RP mode)

partner_id: (UUID, The Player ID of the origin of the cum,)

atl_api_signal_impregnated 1018 The character has been impregnated. species: (JSON Object, The species of the baby)

due_time: (Integer, The unix time of when the pregnancy will be complete. This can be affected by items such as Preg Accel)

father_char: (Integer, The character ID of the father of the baby)

father_anon: (Boolean, True if the father is not known to the character)

mother_char: (Integer, The character ID of the mother, the originator of the ova)

atl_api_signal_ovulated 1019 The character's womb has released an ovum expire: (Integer, The unix time of when the ovum will expire)
atl_api_signal_gave_cum 1020 The character inseminated another character organ: (String, The organ name that was inseminated)

amount: (Float, The amount of cum given in ML)

known: (Boolean, True if the receiver is aware of being inseminated)

anonymous: (Boolean, True if the origin of the cum is NOT known to the receiver)

rp_mode: (Boolean, True if the action was caused by RP mode)

partner_id: (UUID, The Player ID of the receiver of the cum,)

atl_api_signal_received_eggs 1021 The character has been oviposited into organ_id: (String, The organ ID that received the eggs)

fertilized: (Boolean, True if the eggs have already been fertilized. This essentially means the character has been impregnated)

source_char: (Integer, The character ID of the one who gave the eggs)

source_player: (UUID, The Player ID of the one who gave the eggs)

rp_mode:( Boolean, True if the action was caused by RP mode)

atl_api_signal_cum_on_body 1022 The character has received cum on their body. organ: (String, The organ name that has received the cum)

amount: (Float, The amount of cum received in ML)

rp_mode: (Boolean, True if the action was caused by RP mode)

source_player: (UUID, The Player ID that created the cum)

atl_api_signal_knot_tied 1023 The character has been knotted, or knotted someone else. Once the knot givers arousal drops below 25%, the knot is released. knot_giver: (UUID, The Player ID of the one who has knotted)

knot_receiver: (UUID, The Player ID of the one who has been knotted)

atl_api_signal_api_access_response 1024 The indicated API ID has been grated access. (Can be used to determine if your script needs to retry its previous requests, since they may have been dropped due to not having permission) api_id: (Integer, the ID that has been responded to)

accepted: (Boolean, True if the API now has access. False if access was declined)

atl_api_venom_received 1025 The character has been injected with venom venom_type: (String, The type of venom that was received)

giver_player: (String, The player ID that gave the venom)

giver_char: (Integer, The character ID that gave the venom)

atl_api_venom_given 1026 The character has injected another with venom venom_type: (String, The type of venom that was given)

receiver_player: (String, The player ID that received the venom)

receiver_char: (Integer, The character ID that received the venom)

atl_api_gave_birth 1027 The character gave birth or laid an egg child_char_id: (Integer, The character ID of the child)

gender: (String, The gender identity of the child)

species: (JSON Object, The species of the character)

is_egg: (Boolean, True if the child is still in egg form. False if the child is from a live birth)

atl_api_portal_connected 1028 The character connected an organ to the portal network organ_id: (String, The ID of the organ that connected)

organ_type: (String, The type of organ that connected)

atl_api_portal_sex_began 1029 Portal sex has began organ_id: (String, The ID of the organ that connected)

organ_type: (String, The type of organ that connected)

other_organ_type: (String, The type of organ on the other end of the portal)

atl_api_portal_sex_ended 1030 Portal sex has ended organ_id: (String, The ID of the organ that connected)

organ_type: (String, The type of organ that connected)

other_organ_type: (String, The type of organ on the other end of the portal)

atl_api_portal_disconnected 1031 The character disconnected an organ from the portal network organ_id: (String, The ID of the organ that connected)

organ_type: (String, The type of organ that connected)

atl_api_portal_sex_progress 1032 Portal sex is in progress organ_id: (String, The ID of the organ that connected)

organ_type: (String, The type of organ that connected)

other_organ_type: (String, The type of organ on the other end of the portal)

arousal: (Float, The current arousal of the character)

atl_api_err_invalid_api_id -1 The API script provided an invalid API ID (Non-integer or ID doesn't exist) msg: (String, A message explaining the error in more detail)
atl_api_err_no_perms -2 The player hasn't given permission or has disabled permissions. msg: (String, A message explaining the error in more detail)
atl_api_err_checksum_mismatch -3 The hash failed verification. This can occur if the API key is invalid, the API ID doesn't match the one associated with the API key, or the API message was corrupted. msg: (String, A message explaining the error in more detail)
atl_api_err_internal_error -4 The server encountered and error while processing the request. msg: (String, A message explaining the error in more detail)


Organ Info[]

Each organ has its own unique properties. The ones accessible to the API are listed below. Every organ will return at least the "name" property, and interactable organs will return an "in_use" boolean and "disabled" boolean. If the user didn't specify a unique name, the default of "OrganName:Index" will be used (IE: "Penis:0").

Organ Type Properties
All name: (String, The unique name/ID given to the organ)
Interactable in_use: (Boolean, True if the organ is being used by a sex action)

disabled: (Boolean, True if the organ has been disabled)

Anus None
Belly None
Breasts cup: (String, The bra cup size of the breasts. AA - O)

size: (Float, The breast size in numerical form, 0.0 - 1.0)

Butt None
Ears None
Eyes r_color: (Vector, The right eye color)

l_color: (Vector, The left eye color)

Hair color: (Vector, The hair color)

bald: (Boolean, True if the character is bald)

Hands None
Legs None
Mouth None
None None
Ovipositor None
Penis length: (Float, The length of the penis in CM)

barbs: (Boolean, True if the penis has barbs)

knot: (Boolean, True if the penis has a knot)

flare: (Boolean, True if the penis has a flare)

Skin type: (String, The type of skin. User defined, but the defaults are Bare Flesh, Fur, Scales)

color: (Vector, The color the skin)

Stinger None
Tail None
Tentacles None
Testicles cum_cap: (Float, The total capacity of cum in ML)

cum_cur: (Float, The current level of cum available in ML)

refactory: (Integer, The unix time in which the cum will be at peak potency. Will be 0 if already at peak potency)

pot: (Float, The current cum potency. 0.0 - 1.0)

Vagina depth: (Float, The max depth of the vagina in CM)

elasticity: (Float, How easily the vagina can stretch. Unused for now)

Wings None
Womb cycle_time: (Integer, The number of days the cycle takes from start to finish. If 0, the womb only ovulates during heat or from other external factors such as pheromones)

ovum_avg: (Integer, The average number of ova that are released during the ovulation cycle)

gest_dur: (Integer, The number of days that a pregnancy lasts. This is only for ova produced by this womb. Surrogacy will be different)

xspec_comp: (Float, The cross-species compatibility of ova produced by this womb. 0.0 - 1.0. The higher the number, the more compatible)

mf_bal: (Float, The mother/father trait balance. The lower the number, the more likely traits from the mother are present in offspring. Higher will have more father traits)

cycle: (Float, The current progress of the fertility cycle. 0.0 - 1.0)

ovum_chance: (Float, How likely an ovum will be released. 0.0 - 1.0)

ova_present: (Boolean, True if there are ova in the womb)

bc_amnt: (Float, How effective birth control is at the moment. 0.0 - 1.0. This number will go down if the character stops using birth control. 0 will indicate they are not using)


Species Objects[]

Species into is returned in a JSON Array of JSON Objects form. If the array is too long to fit into the message, it will be returned as the string: ERR/Too long

classification: (String, The class that the species belongs to)

family: (String, The family within the classification that the species belongs to)

species: (String, The species within the family)

variation: (String, The variation of the species)

percent: (Float, How much of this species does the character contain)


Example Script[]

This script was created using the LSL Pre-processor. If your viewer or ID does not support the pre-processor, you must manually specify the constants. (Viewers such as Firestorm support the Pre-processor).

#define atnet_channel       "atnet" //The server channel that we are working with. (WARNING: All scripts must be on the same channel, otherwise they will not talk to each other)
#define api_key             "" //Your API key (Required to receive signals and send requests that start with numbers above 1). Can be left blank if only using public API.
#define api_id              "0"   //Your API ID. This is used to identify your scripts to the server. Must match the API key that was provided to you. Can be left as 0 if only using the public API.

#define api_version         "2.0"   //Do not change this. Doing so may break the script.

#define SIZE_CHECK

//Constants ----------------

/*
    Note: The constant names and ID's will stay the same, but the parameters that are sent and received may change.
    Please use the wiki as the official source: https://atlust.fandom.com/wiki/V2_API
*/

//Commands ------------
//Level 1 API (Public)
#define atl_api_test                    10001    //Test request.
#define atl_api_get_stats               10002    //Returns lust, arousal, sensitivity, health and sex status. (lust, arous, sens, health, sex)
#define atl_api_get_partner_arousal     10003    //Returns the arousal level of the specified partner. Returns -1.0 if not having sex with the target. (Requires: target) (Response: target, arousal)
#define atl_api_get_all_organs          10004    //Returns an object with all organ types and the ID's of each individual organ.
#define atl_api_get_organ_info          10005    //Returns an object with organ info (Requires: organ_type, index)
#define atl_api_get_sex_actions         10006    //Returns a list of objects with sex action info (Returns: [{init, other_player, id, name, pen, rec_organ, init_organ}])
#define atl_api_get_is_atlust           10007    //Returns true or false if the target has ATLust. (Requires: target)
#define atl_api_get_nearby_players      10008    //Returns a list of UUID's of all nearby ATLust players.
#define atl_api_get_conditions          10009    //Returns a list of condition names
#define atl_api_get_attraction_to       10010    //Returns the attraction amount to the target character/player. Returns NOT_FOUND if the target is not found. (Requires: char_id or player_id) (Returns: target, attraction)
#define atl_api_get_gender              10011    //Returns the gender info of the target character/player. (Returns: ident, bal, penis, vag) (Requires: char_id or player_id)
#define atl_api_get_name                10012    //Returns the target character's name and title. Returns NOT_FOUND if the target is not found (Requires: char_id or player_id) (Returns: name, title)
#define atl_api_get_char_id             10013    //Returns the players active character ID. (Requires: player_id) (Returns: char_id, char_name)
#define atl_api_get_char_species        10014    //Returns the characters species. (Requires: player_id or char_id) (Returns: target, species)
#define atl_api_get_preg_count			10015	 //Returns a key-value list of the number of pregnancies in each organ.	
#define atl_api_get_breeding_ground     10016    //Returns the data of the breeding ground the player is currently on. (Returns: name, desc, active, players)
#define atl_api_get_pregnancy_progress	10017	 //Returns a floating point value (0.0-1.0) of the highest pregnancy progress.
#define atl_api_get_dtf_status          10018    //Returns a key-value pair of the various DTF statuses (dtf, auto_partner, auto_rp, sex_doll)
#define atl_api_get_connected_portals   10019   //Returns a list of all connected portals (The portal_id)
#define atl_api_get_organ_by_type       10020   //Returns a list of all organ ID's for the specified type of organ. (Requires: organ_type)
//Level 2 API (API Key required)
#define atl_api_register_notifications  20000    //Registers the object to receive API notifications. Returns "OK" on success.
#define atl_api_change_char             20001    //Changes to the indicated character. (Requires: char_id)
#define atl_api_set_arousal             20002    //Changes the active characters arousal to the indicated value. (Requires: arous)
#define atl_api_set_lust                20003    //Changes the active characters lust ot the indicated value. (Requires: lust)
#define atl_api_get_infections          20004    //Returns a list of infection names that the active character has
#define atl_api_get_desires             20005    //Returns a list of desire names that the active character has
#define atl_api_get_cum_list			20006	//Returns a list of all cum in the player's current character. (Returns: sources, vol, known, anon, pot)
#define atl_api_get_relations			20007	//Returns a list of related characters to the player's current character. (Returns: char_id, relation_amount)
#define atl_api_get_pregnancy			20008	//Returns the pregnancies in the target organ. (Requires: organ_type, organ_index) (Returns: species, due_time, father_char, father_anon, mother_char)
#define atl_api_mod_arousal             20009   //Changes the active characters arousal by the amount specified (Requires: arous)
#define atl_api_mod_lust                20010   //Changes the active characters lust by the amount specified (Requires: lust)
#define atl_api_connect_portal          20011   //Connects the indicated organ to the portal network. Returns the portal ID (Requires: organ_type, index, or organ_id)
#define atl_api_disconnect_portal       20012   //Disconnects the indicated organ from the portal network. Returns "OK" (Requires: organ_type, index, or organ_id)
#define atl_api_begin_portal_sex        20013   //Begins portal sex with the indicated portal connection. Returns "OK" (Requires: portal_id and organ_type, index, or organ_id)
#define atl_api_disable_organ           20014   //Disables the indicated organ for 5 minutes.(Requires: organ_type, index, or organ_id)
//Commands ------------

//Signals (API Notifications) ------------
#define atl_api_signal_stats                    1000    //Stats update, automatically sent out every minute. (lust, arousal, sensitivity, health)    
#define atl_api_signal_sex_start                1001    //A sex action has started (action_id, action_name, init_char, rec_char, init_agent, rec_agent, rec_species, init_species)
#define atl_api_signal_sex_stop                 1002    //A sex action has stopped (action_id)
#define atl_api_signal_sex_stop_all             1003    //All sex actions stopped.
#define atl_api_signal_play_action_received     1004    //Another character played with your character (action_id, action_name, init_char, rec_char, init_agent, rec_agent)
#define atl_api_signal_play_action_given        1005    //Character played with another character (action_id, action_name, init_char, rec_char, init_agent, rec_agent)
#define atl_api_signal_climax                   1006    //Character climaxed (organ, other_organ, other_player, penetrative, rp_mode)
#define atl_api_signal_partner_climaxed         1007    //Partner's character climaxed (organ, other_organ, other_player, penetrative, rp_mode)
#define atl_api_signal_tease_action_given       1008    //Character teased another character  (action_id, action_name, init_char, rec_char, init_agent, rec_agent)
#define atl_api_signal_tease_action_received    1009    //Another character teased your character  (action_id, action_name, init_char, rec_char, init_agent, rec_agent)
#define atl_api_signal_preclimax_response       1010    //The player responded to the preclimax question. (response)
#define atl_api_signal_char_data_updated        1011    //The player changed their character data (type)
#define atl_api_signal_char_changed             1012    //The player changed their active character. (old, new)
#define atl_api_signal_item_used                1013    //The player used an item (item)
#define atl_api_signal_condition_gained         1014    //The character gained a new condition (name, mod)
#define atl_api_signal_condition_removed        1015    //The character lost a condition (name, mod)
#define atl_api_signal_titled_earned            1016    //The character earned a new title (name)
#define atl_api_signal_inseminated              1017    //The character has been inseminated (organ, species, amount, known, anonymous, rp_mode, partner_id)
#define atl_api_signal_impregnated              1018    //The character has been impregnated (species, due_time, father_char, father_anon, mother_char)
#define atl_api_signal_ovulated                 1019    //The characters womb has released an ovum (expire)
#define atl_api_signal_gave_cum                 1020    //The character inseminated another character (organ, amount, known, anonymous, rp_mode, partner_id)
#define atl_api_signal_received_eggs            1021    //The character has been oviposited into (organ, fertilized, source_char, source_player, rp_mode)
#define atl_api_signal_cum_on_body              1022    //The character has received cum on their body (organ, amount, rp_mode)
#define atl_api_signal_knot_tied                1023    //The character has been knotted, or knotted someone else. When the penetrative sex action stops is when the knot is released. (knot_giver, knot_receiver)
#define atl_api_access_response					1024	//The player responded to an API permissions request. (id, accept)	
#define atl_api_venom_received                  1025    //The character has been injected with venom
#define atl_api_venom_given                     1026    //The character has injected another with venom
#define atl_api_gave_birth			            1027    //The character has given birth or laid an egg.
#define atl_api_portal_connected                1028    //The character connected an organ to the portal network (organ_id, organ_type)
#define atl_api_portal_sex_began                1029    //Portal sex has began (organ_id, organ_type, other_organ_type)
#define atl_api_portal_sex_ended                1030    //Portal sex has ended (organ_id, organ_type, other_organ_type)
#define atl_api_portal_disconnected             1031    //The character disconnected an organ from the portal network (organ_id, organ_type)
#define atl_api_portal_sex_progress             1032    //Portal sex is in progress (organ_id, organ_type, other_organ_type, arousal)

#define atl_api_err_invalid_api_id              -1      //The API script provided an invalid API ID (Non-integer or ID doesn't exist)
#define atl_api_err_no_perms                    -2      //The player hasn't given permission or has disabled permissions for the API.
#define atl_api_err_checksum_mismatch           -3      //The hash failed verification
#define atl_api_err_internal_error              -4      //The server encountered and error while processing the request.
//Signals (API Notifications) ------------

//Constants ----------------

integer api_request_chan;



/*  Returns a request JSON object that can be used in the SendCommand function.
    command_id: The command ID that you want to send.
    id: A unique ID that will be used as the key-value pair in the response. IE: if the ID is 123, the response will look like {"123":"foo"}
    extra: A Key-Value list including any required info for the request. If the request doesn't require any data, this can be left blank.
*/
string GenerateRequest(integer command_id, list extra, integer request_id)
{
    return llList2Json(JSON_OBJECT, ["cmd", command_id,
                                     "id", request_id,
                                     "extra", llList2Json(JSON_OBJECT, extra)]);
}



/*  Sends a list of commands. Create the command data by using the GenerateRequest function.
    This of course means you can send multiple commands in the same request.
    Just be sure to use the ID function because this also means the response will be all in one message.
    Responses may not be in order in which the requests were made.
*/
SendCommand(list requests)
{
    string body = llList2Json(JSON_ARRAY, requests);
    
    //If using level 2 or higher API's, a cryptographic hash is required. You will receive the hash function once you receive higher level permissions.
    string hash = "";//Only to be used with level 1/public API commands.
    
    string msg = api_id + "/" + hash + "/" + api_version + "/" + body;
    
    #ifdef SIZE_CHECK
    //OPTIONAL. Checks to make sure the message isn't too long.
    if(llStringLength(body) > 2040)//If our message is longer than 2048 characters, it will get truncated when sent. If this happens, it will fail to be processed.
    {
        llOwnerSay("WARNING: The last request sent may be too long!");
    }
    #endif
    
    llRegionSayTo(llGetOwner(), api_request_chan, msg);
}



default
{
    on_rez(integer start)
    {
        llResetScript();
    }
    
    
    
    state_entry()
    {
        api_request_chan = llHash((string)llGetOwner() + "(C) Aozora Tech 2021 - ATLust API" + atnet_channel);  //Get the channel that we will listen for, and send API commands on.
        
        llListen(api_request_chan, "", "", "");
        
        SendCommand([GenerateRequest(atl_api_test, [], 1),      //Example of sending multiple commands in the same request.
                     GenerateRequest(atl_api_get_gender, ["player_id", llGetOwner()], 2) //Make sure each request has a unique ID so it can be identified in the response. If they're the same, the results will be overwritten.
        ]);
    }
    
    
    
    touch_start(integer num)
    {
        SendCommand([GenerateRequest(atl_api_get_is_atlust, ["target", llDetectedKey(0)], 3)]);
    }
    
    
    
    listen(integer chan, string name, key id, string msg)
    {
        if(llGetOwnerKey(id) != llGetOwner())//Filter out messages from other people.
        {
            return;
        }
        
        integer call_id = (integer)llJsonGetValue(msg, ["call_id"]);//Get the call_id key. If not present, this will be 0.
        
        if(call_id)//If not 0, this is a signal. (Note, signals are sent out one-by-one, not grouped like command responses)
        {
            if(call_id == atl_api_signal_stats)
            {
                float lust = (float)llJsonGetValue(msg, ["lust"]);
                float arousal = (float)llJsonGetValue(msg, ["arousal"]);
                float sensitivity = (float)llJsonGetValue(msg, ["sensitivity"]);
                float health = (float)llJsonGetValue(msg, ["health"]);
                
                //Can get spammy, uncomment if you want to see stats every minute.
                //llOwnerSay("Stats update: Lust: " + (string)llRound(lust * 100.0) + "% | Arousal: " + (string)llRound(arousal * 100.0) + "% | Sensitivity: " + (string)llRound(sensitivity * 100.0) + "% | Health: " + (string)llRound(health * 100.0) + "%");
            }
            
            else if(call_id == atl_api_signal_item_used)
            {
                llOwnerSay("Item used: " + llJsonGetValue(msg, ["extra", "item"]));
            }
            
            else if(call_id == atl_api_signal_condition_gained)
            {
                llOwnerSay("Condition gained: " + llJsonGetValue(msg, ["extra", "name"]) + " (Modifier: " + llJsonGetValue(msg, ["extra", "mod"]) + ")");
            }
        }
        else
        {
            if(llJsonValueType(msg, ["1"]) == JSON_STRING)
            {
                string response = llJsonGetValue(msg, ["1"]);
                
                //If the result starts with "ERR/". That would indicate there was an error with the request we made.
                //With requests that respond with normal strings and not JSON objects, we need to make sure the result doesn't contain error messages.
                //If the request is supposed to respond with a JSON Object, then if llJsonValueType doesn't test the response as an object, then it probably contains an error message (Which is just a normal string).
                
                if(llGetSubString(response, 0, 3) != "ERR/")
                {
                    llOwnerSay("Test response: " + response);
                }
                else
                {
                    llOwnerSay("(DEBUG): " + llGetSubString(response, 3, -1));
                }
            }
            
            if(llJsonValueType(msg, ["2"]) == JSON_OBJECT)
            {
                name = llJsonGetValue(msg, ["2", "target"]);
                
                if(llJsonGetValue(msg, ["2", "ident"]) == "NOT_FOUND")
                {
                    llOwnerSay(name + " was not found in ATLust");
                }
                else
                {
                    if(llStringLength(name) == 36)//Check to see if the target was a character ID or player ID (Agent UUID)
                    {
                        name = llKey2Name(name);
                    }
                    
                    llOwnerSay(name + "'s gender identity is: " + llJsonGetValue(msg, ["2", "ident"]));
                    
                    if(llJsonGetValue(msg, ["2", "penis"]) == JSON_TRUE)
                    {
                        llOwnerSay(name + " has a penis");
                    }
                    
                    if(llJsonGetValue(msg, ["2", "vag"]) == JSON_TRUE)
                    {
                        llOwnerSay(name + " has a vagina");
                    }
                }
            }
            
            if(llJsonValueType(msg, ["3"]) == JSON_OBJECT)
            {
                if(llJsonGetValue(msg, ["3", "is_user"]) == JSON_TRUE)
                {
                    llOwnerSay(llKey2Name(llJsonGetValue(msg, ["3", "target"])) + " is an ATLust user");
                }
                else
                {
                    llOwnerSay(llKey2Name(llJsonGetValue(msg, ["3", "target"])) + " is NOT an ATLust user");
                }
            }
        }
    }
}


Polling the server[]

The server updates data once a minute, so polling for new data more than once every 60 seconds is mostly pointless. Some values such as arousal and lust are changed immediately when players perform actions, but all other stats are not changed until the next server tick. Each server tick happens on the minute. It is recommended to synchronize your scripts polling timer so that it polls the server shortly after the minute changes. This will help ensure your script has the latest data as soon as it's available.

integer syncing;

default
{
    state_entry()
    {
        integer time = (60 - llGetUnixTime() % 60) + 5;//5 seconds after the minute changes, this gives the server time to settle down after it sends out updates to all of the HUD's.
        llSetTimerEvent(time);
        syncing = TRUE;//The initial timer event will be only for syncing. It will likely be less than 60 seconds.
    }

    timer()
    {
        if(syncing)
        {
            syncing = FALSE;
            llSetTimerEvent(60.0);//Now that we're at the desired time, set the timer to 60 seconds to sync with the server.
        }
        
        llOwnerSay("Tick");
    }
}
Advertisement