mob
var/tmp/selected_emote // Stores the selected emote icon
verb
Emote()
set name = "Emote"
set category = "Communication"
// Display the emote selection window
var/html = "<html><body>"
html += "Select an emote:<br>"
// Define available emote states from the emotes.dmi file
var/list/emotes = list("Alert", "Shocked", "Upset", "Awkward")
// Create buttons for each emote
for (var/emote_name in emotes)
html += "<button onclick='.?set_emote=[emote_name]'>[emote_name]</button><br>"
html += "</body></html>"
// Show the HTML to the player
src << browse(html, "window=emote_selection")
proc
HandleTopic(href)
if (!href) return // Ensure href is valid
if (findtext(href, "set_emote=")) // Check for the set_emote key
var/emote_name = copytext(href, findtext(href, "set_emote=") + 10)
// Validate the emote selection
var/list/emotes = list("Alert", "Shocked", "Upset", "Awkward")
if (emote_name in emotes)
selected_emote = icon('Icons/emotes.dmi', emote_name) // Select the icon state
src.overlays += selected_emote // Add the selected emote icon as an overlay
src << "You selected the [emote_name] emote."
else
src << "Invalid emote selection."
world
Topic(href, href_list[])
..() // Call the built-in Topic for other handling
// Debug: Print the received href to ensure the button click is working
if (href)
world << "Topic href: [href]"
// Forward the Topic call to the appropriate player mob
for (var/mob/m in world)
if (istype(m) && m.client)
m.HandleTopic(href)
Problem description:
At the moment the verb works as follows
Click emote
a window opens displaying buttons for each emote
Clicking the button does nothing at the moment.
Preview:
https://i.imgur.com/BJS60qn.png
What I'd like it to do
I'd like to be able to input the command /emote "state name"
and the state within the icon file display above the players head.
I'd like players to be able to input this command in Say and OOC as well and get the same functions.
I'd like /emote by itself to display a tutorial for the command in the chat.
I'm pretty sure this code would be remade to display the emote said in the chat or command window but I wouldnt know how to go about it.
Can anyone help me achieve this?