/mob/laugh()
set name = "Laugh"
set desc = "Have a good time!"
set category = "IC"
var/choice = input(src, "Choose a type of laughter!") in laughter_types
(...)
Problem description: First and foremost, hello and thank you for your time. Here's my question.
Let's say I have the verb above. Upon calling it, it displays an X amount of elements (laughter_types) in a list from which the user can pick.
However, if they click it 5 times, even after selecting one, another one then another list will appear. The only method I know how to negate the spam is to add an extra var to check if they are using it, a kind of a cooldown:
/mob/laugh()
set name = "Laugh"
set desc = "Have a good time!"
set category = "IC"
if(has_laughed) // Checks for cooldown
return
var/choice = input(src, "Choose a type of laughter!") in laughter_types
if(!choice) // No cooldown if they cancelled it
return
has_laughed = TRUE // Add a cooldown we reset elsewhere
(...)
My question is - is there a method to add a check for all verbs whether that specific verb is in use by the same user? Something like:
/mob/verb
if(busy)
return
busy = 1
//do the called verb
busy = 0
For more flexibility, you're asking for a way to tell if a specific verb is in use, because you want multiple different verbs to be able to queue up. As usual, going from "one" to "many" usually involves a list. Lists are variable in size, so you can store data about as many things as you want. Specifically, we can use an associative list to associate the name of the verb to its locked state.