Scripts › Hug with Counter & Points
Overview
Give warm hugs to fellow chatters! Features persistent hug counters (1st, 2nd, 3rd) and integrates with Yip.chat Custom Loyalty Currencies.
script.sayl
# Command: !hug
# Description: A hugging script!

# Label: Sender
SET hugger = "{sender}"
SET target = "{Word1}"

# Hug count
READ hugCount FROM JSON "hug_counts.json" KEY "{sender}"
MATH newHugCount = {hugCount} + 1
WRITE {newHugCount} TO JSON "hug_counts.json" KEY "{sender}"

# Give Target Points (Option B: Uses configured currency setting)
CURRENCY "{reward_currency}" ADD {reward_amount} FOR "{target}"

IF {newHugCount} == 1 THEN
  SET countEnd = "st"
ELSE IF {newHugCount} == 2 THEN
  SET countEnd = "nd"
ELSE IF {newHugCount} == 3 THEN
  SET countEnd = "rd"
ELSE
  SET countEnd = "th"
END IF

REPLY "{hugger} hugs {target}! That's {hugger}'s {newHugCount}{countEnd} hug."
Reviews (0) 5.0 / 5.0
Sign in with Twitch to leave a review.
No reviews yet.
Download .zip
Clicking Install sends the package to your desktop app via the yip:// protocol.
Details
Settings
Reward Currency
Default: loyalty
Reward Amount
Default: 5