162 lines
7.3 KiB
Plaintext
162 lines
7.3 KiB
Plaintext
integer actual_seconds_passed = 15; // Counter for Seconds since last sip was taken, once it passes the minimum another can and this is reset
|
|
integer minimum_seconds_needed = 20; // Number of Seconds before a Sip can be take
|
|
float act_frequency = 0.3; // Frequency % of Sip to add RNG
|
|
|
|
integer full_level = 100; // Full size of drink, not really used
|
|
integer current_drink_level = 0; // Counter for the current drink value to help calc the alpha changes
|
|
list cawfeeLevelFaceInts = [4, 3, 2, 1]; // Array of face Integers on the mesh model
|
|
|
|
float animation_mid_point = 1; // Number of seconds to sleep during the animation to help it line up
|
|
string idle_anim = "cawfeeidle"; // Animation used for idle
|
|
string action_anim = "cawfeeswig"; // Animation used for swiggin
|
|
list no_cawfee_anims = ["cawfeenocawfeeA", "cawfeenocawfeeB"]; // Animation used for the worst outcome
|
|
list cawfee_reloaded_anims = ["cawfeerenewedA", "cawfeerenewedB"]; //
|
|
integer NO_CAWFEE = 0; // int for no cawfee, really its to check if we already did the no cawfee anim
|
|
integer NO_CAWFEE_WHICH = 0; // int to store which animation set is currently playing for the no cawfee
|
|
|
|
integer freeze_logic = 0; // 1 TRUE, 0 FALSE, Freezes the alpha script checks
|
|
|
|
integer sip_multiplier = 20; // Bigger number for bigger sips
|
|
string sip_sfx = "SipSFX"; // SFX used for sippin
|
|
float sip_sound_vol = 0.0; // Volume for Sip SFX
|
|
integer sip_do_sound = 0; // 1 TRUE, 0 FALSE, toggle for disabling the annoying sound
|
|
|
|
list particle_settings = [
|
|
PSYS_PART_MAX_AGE,1.50,
|
|
PSYS_PART_FLAGS, 259,
|
|
PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>,
|
|
PSYS_PART_END_COLOR, <1.0, 1.0, 1.0>,
|
|
PSYS_PART_START_SCALE,<0.15062, 0.15062, 0.00000>,
|
|
PSYS_PART_END_SCALE,<0.77423, 1.21800, 0.00000>,
|
|
PSYS_SRC_PATTERN, 2,
|
|
PSYS_SRC_BURST_RATE,0.00,
|
|
PSYS_SRC_BURST_PART_COUNT,3,
|
|
PSYS_SRC_BURST_RADIUS,0.00,
|
|
PSYS_SRC_BURST_SPEED_MIN,0.07,
|
|
PSYS_SRC_BURST_SPEED_MAX,0.35,
|
|
PSYS_SRC_ANGLE_BEGIN, 1.65,
|
|
PSYS_SRC_ANGLE_END, 0.00,
|
|
PSYS_SRC_MAX_AGE, 10.0,
|
|
PSYS_SRC_TEXTURE, "006d9758-81da-38a9-9be3-b6c941cae931",
|
|
PSYS_PART_START_ALPHA, 0.40,
|
|
PSYS_PART_END_ALPHA, 0.00,
|
|
PSYS_SRC_ACCEL, <0.00, 0.00, 1.14>
|
|
];
|
|
|
|
default
|
|
{
|
|
state_entry() {
|
|
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
|
|
llSetTimerEvent(1);
|
|
llStartAnimation(idle_anim);
|
|
}
|
|
|
|
on_rez(integer param) {
|
|
llResetScript();
|
|
current_drink_level = 0;
|
|
actual_seconds_passed = 0;
|
|
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 1.0, ALL_SIDES); // Reset alphas on touch
|
|
}
|
|
|
|
attach(key id)
|
|
{
|
|
integer perm = llGetPermissions();
|
|
|
|
if (id != NULL_KEY) {
|
|
if (!(perm & PERMISSION_TRIGGER_ANIMATION)) {
|
|
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
|
|
}
|
|
llStartAnimation(idle_anim);
|
|
} else {
|
|
llStopAnimation(idle_anim);
|
|
llStopAnimation(action_anim);
|
|
integer i = 0;
|
|
integer total_no_cawf_anims = llGetListLength(no_cawfee_anims);
|
|
for (i = 0; i < total_no_cawf_anims; ++i) {
|
|
llStopAnimation(llList2String(no_cawfee_anims, i));
|
|
llStopAnimation(llList2String(cawfee_reloaded_anims, i));
|
|
}
|
|
current_drink_level = 0;
|
|
actual_seconds_passed = 0;
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 1.0, ALL_SIDES); // Reset alphas on touch
|
|
|
|
}
|
|
}
|
|
|
|
moving_start()
|
|
{
|
|
if (NO_CAWFEE == 1) {
|
|
NO_CAWFEE = 0;
|
|
llStopAnimation(llList2String(cawfee_reloaded_anims, NO_CAWFEE_WHICH));
|
|
llStopAnimation(llList2String(no_cawfee_anims, NO_CAWFEE_WHICH));
|
|
actual_seconds_passed = -30;
|
|
}
|
|
}
|
|
|
|
touch(integer num_detected) {
|
|
current_drink_level = 0;
|
|
actual_seconds_passed = 0;
|
|
llParticleSystem(particle_settings);
|
|
|
|
llSleep(animation_mid_point); // Sleep so particle effect can start
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 1.0, ALL_SIDES); // Reset alphas on touch
|
|
|
|
if (NO_CAWFEE == 1) {
|
|
NO_CAWFEE = 0;
|
|
llSleep(10);
|
|
llStartAnimation(llList2String(cawfee_reloaded_anims, NO_CAWFEE_WHICH));
|
|
llSleep(2);
|
|
llStopAnimation(llList2String(no_cawfee_anims, NO_CAWFEE_WHICH));
|
|
}
|
|
|
|
}
|
|
|
|
timer() {
|
|
if (actual_seconds_passed >= minimum_seconds_needed) {
|
|
if ((current_drink_level < full_level)) {
|
|
float roll_dem_bones = llFrand(1.0);
|
|
if (roll_dem_bones <= act_frequency) {
|
|
llStartAnimation(action_anim);
|
|
actual_seconds_passed = 0;
|
|
|
|
if ((current_drink_level < full_level) && (freeze_logic != 1)) {
|
|
integer sip_size = llRound((llFrand(1.0) * sip_multiplier));
|
|
current_drink_level += sip_size;
|
|
|
|
llSleep(animation_mid_point); // Sleep to stop alpha going before the animation has touched face like
|
|
if (sip_do_sound == 1) {
|
|
llPlaySound(sip_sfx, sip_sound_vol);
|
|
}
|
|
if (current_drink_level >= 15 && current_drink_level < 35) {
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 0));
|
|
} else if (current_drink_level >= 35 && current_drink_level < 75) {
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 0));
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 1));
|
|
} else if (current_drink_level >= 75 && current_drink_level < 100) {
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 0));
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 1));
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 2));
|
|
} else if (current_drink_level >= 100) {
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 0));
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 1));
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 2));
|
|
llSetLinkAlpha(LINK_ALL_OTHERS, 0.0, llList2Integer(cawfeeLevelFaceInts, 3));
|
|
}
|
|
}
|
|
} else {
|
|
++actual_seconds_passed;
|
|
}
|
|
} else {
|
|
if (NO_CAWFEE != 1) {
|
|
NO_CAWFEE_WHICH = ((llRound(2.0 - llFrand(1))) - 1);
|
|
llStartAnimation(llList2String(no_cawfee_anims, NO_CAWFEE_WHICH));
|
|
NO_CAWFEE = 1;
|
|
}
|
|
}
|
|
} else {
|
|
++actual_seconds_passed;
|
|
}
|
|
}
|
|
}
|