Contents
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_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>
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) |
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) |
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) |
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. If the user didn't specify a unique name, the default of "OrganName:Index" will be used (IE: "Penis:0").
Organ Type | Properties |
---|---|
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).
1 #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)
2 #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.
3 #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.
4
5 #define api_version "2.0" //Do not change this. Doing so may break the script.
6
7 #define SIZE_CHECK
8
9 //Constants ----------------
10
11 /*
12 Note: The constant names and ID's will stay the same, but the parameters that are sent and received may change.
13 Please use the wiki as the official source: https://atlust.fandom.com/wiki/V2_API
14 */
15
16 //Commands ------------
17 //Level 1 API (Public)
18 #define atl_api_test 10001 //Test request.
19 #define atl_api_get_stats 10002 //Returns lust, arousal, sensitivity, health and sex status. (lust, arous, sens, health, sex)
20 #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)
21 #define atl_api_get_all_organs 10004 //Returns an object with all organ types and the ID's of each individual organ.
22 #define atl_api_get_organ_info 10005 //Returns an object with organ info (Requires: organ_type, index)
23 #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}])
24 #define atl_api_get_is_atlust 10007 //Returns true or false if the target has ATLust. (Requires: target)
25 #define atl_api_get_nearby_players 10008 //Returns a list of UUID's of all nearby ATLust players.
26 #define atl_api_get_conditions 10009 //Returns a list of condition names
27 #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)
28 #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)
29 #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)
30 #define atl_api_get_char_id 10013 //Returns the players active character ID. (Requires: player_id) (Returns: char_id, char_name)
31 #define atl_api_get_char_species 10014 //Returns the characters species. (Requires: player_id or char_id) (Returns: target, species)
32 #define atl_api_get_preg_count 10015 //Returns a key-value list of the number of pregnancies in each organ.
33 #define atl_api_get_breeding_ground 10016 //Returns the data of the breeding ground the player is currently on. (Returns: name, desc, active, players)
34 #define atl_api_get_pregnancy_progress 10017 //Returns a floating point value (0.0-1.0) of the highest pregnancy progress.
35 #define atl_api_get_dtf_status 10018 //Returns a key-value pair of the various DTF statuses (dtf, auto_partner, auto_rp, sex_doll)
36
37 //Level 2 API (API Key required)
38 #define atl_api_register_notifications 20000 //Registers the object to receive API notifications. Returns "OK" on success.
39 #define atl_api_change_char 20001 //Changes to the indicated character. (Requires: char_id)
40 #define atl_api_set_arousal 20002 //Changes the active characters arousal to the indicated value. (Requires: arous)
41 #define atl_api_set_lust 20003 //Changes the active characters lust ot the indicated value. (Requires: lust)
42 #define atl_api_get_infections 20004 //Returns a list of infection names that the active character has
43 #define atl_api_get_desires 20005 //Returns a list of desire names that the active character has
44 #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)
45 #define atl_api_get_relations 20007 //Returns a list of related characters to the player's current character. (Returns: char_id, relation_amount)
46 #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)
47 //Commands ------------
48
49 //Signals (API Notifications) ------------
50 #define atl_api_signal_stats 1000 //Stats update, automatically sent out every minute. (lust, arousal, sensitivity, health)
51 #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)
52 #define atl_api_signal_sex_stop 1002 //A sex action has stopped (action_id)
53 #define atl_api_signal_sex_stop_all 1003 //All sex actions stopped.
54 #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)
55 #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)
56 #define atl_api_signal_climax 1006 //Character climaxed (organ, other_organ, other_player, penetrative, rp_mode)
57 #define atl_api_signal_partner_climaxed 1007 //Partner's character climaxed (organ, other_organ, other_player, penetrative, rp_mode)
58 #define atl_api_signal_tease_action_given 1008 //Character teased another character (action_id, action_name, init_char, rec_char, init_agent, rec_agent)
59 #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)
60 #define atl_api_signal_preclimax_response 1010 //The player responded to the preclimax question. (response)
61 #define atl_api_signal_char_data_updated 1011 //The player changed their character data (type)
62 #define atl_api_signal_char_changed 1012 //The player changed their active character. (old, new)
63 #define atl_api_signal_item_used 1013 //The player used an item (item)
64 #define atl_api_signal_condition_gained 1014 //The character gained a new condition (name, mod)
65 #define atl_api_signal_condition_removed 1015 //The character lost a condition (name, mod)
66 #define atl_api_signal_titled_earned 1016 //The character earned a new title (name)
67 #define atl_api_signal_inseminated 1017 //The character has been inseminated (organ, species, amount, known, anonymous, rp_mode, partner_id)
68 #define atl_api_signal_impregnated 1018 //The character has been impregnated (species, due_time, father_char, father_anon, mother_char)
69 #define atl_api_signal_ovulated 1019 //The characters womb has released an ovum (expire)
70 #define atl_api_signal_gave_cum 1020 //The character inseminated another character (organ, amount, known, anonymous, rp_mode, partner_id)
71 #define atl_api_signal_received_eggs 1021 //The character has been oviposited into (organ, fertilized, source_char, source_player, rp_mode)
72 #define atl_api_signal_cum_on_body 1022 //The character has received cum on their body (organ, amount, rp_mode)
73 #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)
74 #define atl_api_access_response 1024 //The player responded to an API permissions request. (id, accept)
75 #define atl_api_venom_received 1025 //The character has been injected with venom
76 #define atl_api_venom_given 1026 //The character has injected another with venom
77 #define atl_api_gave_birth 1027 //The character has given birth or laid an egg.
78 //Signals (API Notifications) ------------
79
80 //Constants ----------------
81
82 integer api_request_chan;
83
84
85
86 /* Returns a request JSON object that can be used in the SendCommand function.
87 command_id: The command ID that you want to send.
88 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"}
89 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.
90 */
91 string GenerateRequest(integer command_id, list extra, integer request_id)
92 {
93 return llList2Json(JSON_OBJECT, ["cmd", command_id,
94 "id", request_id,
95 "extra", llList2Json(JSON_OBJECT, extra)]);
96 }
97
98
99
100 /* Sends a list of commands. Create the command data by using the GenerateRequest function.
101 This of course means you can send multiple commands in the same request.
102 Just be sure to use the ID function because this also means the response will be all in one message.
103 Responses may not be in order in which the requests were made.
104 */
105 SendCommand(list requests)
106 {
107 string body = llList2Json(JSON_ARRAY, requests);
108
109 //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.
110 string hash = "";//Only to be used with level 1/public API commands.
111
112 string msg = api_id + "/" + hash + "/" + api_version + "/" + body;
113
114 #ifdef SIZE_CHECK
115 //OPTIONAL. Checks to make sure the message isn't too long.
116 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.
117 {
118 llOwnerSay("WARNING: The last request sent may be too long!");
119 }
120 #endif
121
122 llRegionSayTo(llGetOwner(), api_request_chan, msg);
123 }
124
125
126
127 default
128 {
129 on_rez(integer start)
130 {
131 llResetScript();
132 }
133
134
135
136 state_entry()
137 {
138 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.
139
140 llListen(api_request_chan, "", "", "");
141
142 SendCommand([GenerateRequest(atl_api_test, [], 1), //Example of sending multiple commands in the same request.
143 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.
144 ]);
145 }
146
147
148
149 touch_start(integer num)
150 {
151 SendCommand([GenerateRequest(atl_api_get_is_atlust, ["target", llDetectedKey(0)], 3)]);
152 }
153
154
155
156 listen(integer chan, string name, key id, string msg)
157 {
158 if(llGetOwnerKey(id) != llGetOwner())//Filter out messages from other people.
159 {
160 return;
161 }
162
163 integer call_id = (integer)llJsonGetValue(msg, ["call_id"]);//Get the call_id key. If not present, this will be 0.
164
165 if(call_id)//If not 0, this is a signal. (Note, signals are sent out one-by-one, not grouped like command responses)
166 {
167 if(call_id == atl_api_signal_stats)
168 {
169 float lust = (float)llJsonGetValue(msg, ["lust"]);
170 float arousal = (float)llJsonGetValue(msg, ["arousal"]);
171 float sensitivity = (float)llJsonGetValue(msg, ["sensitivity"]);
172 float health = (float)llJsonGetValue(msg, ["health"]);
173
174 //Can get spammy, uncomment if you want to see stats every minute.
175 //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) + "%");
176 }
177
178 else if(call_id == atl_api_signal_item_used)
179 {
180 llOwnerSay("Item used: " + llJsonGetValue(msg, ["extra", "item"]));
181 }
182
183 else if(call_id == atl_api_signal_condition_gained)
184 {
185 llOwnerSay("Condition gained: " + llJsonGetValue(msg, ["extra", "name"]) + " (Modifier: " + llJsonGetValue(msg, ["extra", "mod"]) + ")");
186 }
187 }
188 else
189 {
190 if(llJsonValueType(msg, ["1"]) == JSON_STRING)
191 {
192 string response = llJsonGetValue(msg, ["1"]);
193
194 //If the result starts with "ERR/". That would indicate there was an error with the request we made.
195 //With requests that respond with normal strings and not JSON objects, we need to make sure the result doesn't contain error messages.
196 //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).
197
198 if(llGetSubString(response, 0, 3) != "ERR/")
199 {
200 llOwnerSay("Test response: " + response);
201 }
202 else
203 {
204 llOwnerSay("(DEBUG): " + llGetSubString(response, 3, -1));
205 }
206 }
207
208 if(llJsonValueType(msg, ["2"]) == JSON_OBJECT)
209 {
210 name = llJsonGetValue(msg, ["2", "target"]);
211
212 if(llJsonGetValue(msg, ["2", "ident"]) == "NOT_FOUND")
213 {
214 llOwnerSay(name + " was not found in ATLust");
215 }
216 else
217 {
218 if(llStringLength(name) == 36)//Check to see if the target was a character ID or player ID (Agent UUID)
219 {
220 name = llKey2Name(name);
221 }
222
223 llOwnerSay(name + "'s gender identity is: " + llJsonGetValue(msg, ["2", "ident"]));
224
225 if(llJsonGetValue(msg, ["2", "penis"]) == JSON_TRUE)
226 {
227 llOwnerSay(name + " has a penis");
228 }
229
230 if(llJsonGetValue(msg, ["2", "vag"]) == JSON_TRUE)
231 {
232 llOwnerSay(name + " has a vagina");
233 }
234 }
235 }
236
237 if(llJsonValueType(msg, ["3"]) == JSON_OBJECT)
238 {
239 if(llJsonGetValue(msg, ["3", "is_user"]) == JSON_TRUE)
240 {
241 llOwnerSay(llKey2Name(llJsonGetValue(msg, ["3", "target"])) + " is an ATLust user");
242 }
243 else
244 {
245 llOwnerSay(llKey2Name(llJsonGetValue(msg, ["3", "target"])) + " is NOT an ATLust user");
246 }
247 }
248 }
249 }
250 }
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");
}
}