Create Your Own Give A Like HUD


I created this HUD last year for fun and shared copies with friends. I was really amazed how quickly it became popular and the overall engagement of people touching the HUD. This HUD was never released to the general public.

What makes this HUD unique?

The HUD stores the names of every avatar who has touched

The HUD increases the LIKE amount on each touch

There is a 15 second cool down between each touch

You can list the names of all avatars that touched the HUD

You can clear the list of avatar names

You can reset the HUD back to default (Zero Touches)

When you remove and re-add the HUD, the values do not get reset

Let’s Get Started:

Rez a prim

Add to your Avatar

Adjust the prim so it appears above the hair and head

Here are the specs used on the HUD I created:

The texture I used is the following:

You are free to use by clicking Here to download

NOTE: This script is copyrighted by me (Michael Sweet). I am allowing you to use this script to create your very own Give A Like HUD, however, the script is NOT to become a part of any item sold on Market Place. You are allowed to include this script in multiple prims and share with anyone wishing to create a Give A Like HUD.

Once you have your HUD placed, go to Edit and choose Contents. Click New Script.

Open the New Script.

You will replace all the code in the new script with the code found Give A Like Script.

Copy the code from the link above and PASTE into the New Script you created in the HUD.

Once pasted, click Save.

Exit EDIT.

You will need an alt or another avatar to touch the HUD to get a like. If you touch, you will get the menu to list names, clear names, reset HUD.

Let’s take a look at the CODE and see what it does:

key requestid;
integer listen_handle;
integer index;
integer channel;
key ToucherID;
list values;

string canGo;

integer TotalTouches;

integer giCountDownTime = 15;
float gfCountDownIncrements = 1;
integer giStartTime;
integer giRounds;
integer listenHandle;

remove_listen_handle()
{
llListenRemove(listenHandle);
}

integer random_integer( integer min, integer max )
{
return min + (integer)( llFrand( max – min + 1 ) );
}

string message = “Menu”;
list menu = [“List Names”, “Reset Names”, “Reset HUD”];

default
{

state_entry()
{

integer n1 = random_integer( 1, 9999 );
channel = n1;
llListen(n1, “”,””,””);
llSetText(“Give Me A Like!\n\nTotal Likes: 0”, <1.0, 1.0, 1.0>, 1.0);

}

touch_start(integer num_detected)
{

ToucherID = llDetectedKey(0);

if (canGo == “false”) {
return;
} else {
if (ToucherID == llGetOwner()) {
llDialog(llGetOwner(), message, menu, channel);
} else {

TotalTouches = TotalTouches + 1;

values += llKey2Name(ToucherID);

canGo = “false”;

llInstantMessage(ToucherID, “Thank you for your like!”);

llSetTimerEvent(gfCountDownIncrements);
giStartTime = llGetUnixTime();

}
}
}

listen(integer channel, string name, key id, string message)
{

if( message==”List Names”)
{

integer i;
integer length = llGetListLength(values);
do
llOwnerSay(llList2String(values, i) );
while(++i < length); llListenRemove(channel); } if( message=="Reset Names") { values = []; llOwnerSay("List Cleared"); llListenRemove(channel); } if( message=="Reset HUD") { llOwnerSay("HUD resetting. All data will be lost."); llResetScript(); } } timer() { if (llGetUnixTime() >= giStartTime +giCountDownTime) {
canGo = “true”;
gfCountDownIncrements = 1;
giCountDownTime = 15;
giRounds = 0;
llSetText(“Give Me A Like!\n\nTotal Likes: ” + (string)TotalTouches, <1.0, 1.0, 1.0>, 1.0);
} else {
giRounds++;
llSetText(“Give A Like In ” + (string)(giCountDownTime – giRounds) + ” seconds.”, <1.0, 1.0, 1.0>, 1.0);
}
}

}

When you first wear the HUD, it is set at default of zero. When another avatar touches the HUD, the touch event captures the avatars UUID then get’s the avatars name using llKey2Name. The name is stored in a list called values. Every time another avatar touches the HUD, their name is added to the list values. The avatar that touched the HUD is sent a instant message, thanking them for the LIKE. The touch event also checks to see if the owner of the HUD is touching the prim. If so, bring up the menu to allow the owner to list the names of every avatar that has touched the HUD. The owner can also clear the list and do a reset on the HUD, resetting everything back to default.

A string of canGo determines if an avatar can touch the HUD. Once the HUD has been touched, canGo is set to FALSE. A LIKE is now stored in the integer TotalTouches. Every time the HUD is touched, TotalTouches adds a 1 to the total. The HUD now goes into a 15 seconds cool down calling the timer. During this time, if anyone touches the HUD, no LIKES will be accepted. The HUD will show a countdown above the HUD. Once finished, the total LIKES is displayed and the HUD is now ready for touches and canGO is set to TRUE.

The video below is the how the HUD should perform once you have set up the PRIM and added the script.

What's Your Reaction?

WTF WTF
0
WTF
ROFL ROFL
0
ROFL
OMG OMG
0
OMG
LOVE LOVE
0
LOVE
LIKE LIKE
0
LIKE
CUTE CUTE
0
CUTE
ANGRY ANGRY
0
ANGRY

More From: scripting

Choose A Format
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Poll
Voting to make decisions or determine opinions
Story
Formatted Text with Embeds and Visuals
Video
Youtube, Vimeo or Vine Embeds
Audio
Soundcloud or Mixcloud Embeds
Image
Photo or GIF
%d bloggers like this: