ID:962942
 
Code:
var/DeleteIt = alert(usr,"Would you like to delete this item?",,"Yes","No")
if(DeleteIt=="Yes")
del(i)
else
return


Problem description:

I want to get this line of code to run, however i want to use HUD objects. I am using forum_account's hud_group library.

The only thing i can really think of to get this to work would to be create somekind of loop that would wait for a hudobject with the name yes or no to be clicked. And when they are clicked it would act accordingly. However it doesnt seem like a simple thing to do, which i am finding so odd because the code itself is so simple.

Any help would be greatly appreciated.
You should look at Garthor's GetClick library.
I was thinking about action script last night, and the action listener procs. Perhaps the the getclick will work i will check it out.
if you are using HUD Groups then you dont need extra library because HUD Group automatically checks if you are clicking on HUDGroup or something else have a look at message_box demo in hud groups it tells you how to handle click rest depends on you
In response to Lord Kakarot
Hey i was looking at this but i didn't really see anything helpful. Could you perhaps include an example?]

I would really appreciated it
alert using Hud groups?
Font
TrebuchetMS
icon = 'trebuchet-8pt.dmi'

// see fonts.dm for descriptions of these vars
char_width = list(" " = 4, "a" = 5, "b" = 5, "c" = 5, "d" = 5, "e" = 5, "f" = 4, "g" = 6, "h" = 5, "i" = 2, "j" = 3, "k" = 5, "l" = 1, "m" = 7, "n" = 5, "o" = 5, "p" = 5, "q" = 5, "r" = 3, "s" = 4, "t" = 4, "u" = 5, "v" = 5, "w" = 7, "x" = 5, "y" = 5, "z" = 5, "A" = 5, "B" = 5, "C" = 6, "D" = 6, "E" = 5, "F" = 5, "G" = 6, "H" = 6, "I" = 1, "J" = 4, "K" = 5, "L" = 4, "M" = 7, "N" = 6, "O" = 7, "P" = 5, "Q" = 8, "R" = 6, "S" = 4, "T" = 5, "U" = 6, "V" = 7, "W" = 9, "X" = 6, "Y" = 7, "Z" = 5, "0" = 5, "1" = 3, "2" = 5, "3" = 5, "4" = 5, "5" = 4, "6" = 5, "7" = 5, "8" = 5, "9" = 5, "," = 2, "." = 1, "'" = 1, "\"" = 3, "?" = 4, "(" = 2, ")" = 2, "<" = 4, ">" = 4, "/" = 4, ";" = 2, ":" = 1, "-" = 3, "+" = 5, "=" = 4, "_" = 6, "!" = 1, "@" = 8, "#" = 6, "$" = 4, "%" = 7, "^" = 5, "&" = 7, "*" = 5)
descent = 2
spacing = 1
line_height = 13


MessageBox
parent_type = /HudGroup

icon = 'message-box-demo.dmi'
layer = MOB_LAYER + 5
font = new /Font/TrebuchetMS()

var
HudObject/text_object
HudObject/ok_button
list/optlist=list()
Choice=0
mob/owner

New(mob/m)
..()
if(m.client) owner=m
for(var/x = 0 to 5)
for(var/y = 0 to 3)
add(x * 32, y * 32, "[x],[y]")

// we use the "layer" parameter to make the button
// and text objects appear at a higher layer than
// the message box background objects.
// ok_button = add(82, 20, "ok-button", layer = layer + 1)
text_object = add(32, 100, layer = layer + 1)

Click(HudObject/object)
Choice=optlist[object]//

proc
show_message(msg)

// wrap the text so it fits within 128 pixel wide lines
msg = font.wrap_text(msg, 128)
text_object.set_text(msg)

show()
ShowAlert(msg,list/options=list())
if(!msg||!options.len) return
Choice=null
show_message(msg)
var/button_x = (/*width*/5 * 32) / 2 - (48 * options.len + 16 * ((options.len > 1) ? options.len - 1 : 0)) / 2
var/button_y = 16
for(var/i = 1 to options.len)
var/HudObject/A=add(button_x + i * 64 - 64, button_y, "Choiceleft", layer = layer + 1)
var/HudObject/B=add(button_x + i * 64 - 32, button_y, "Choiceright", layer = layer + 1)
var/HudObject/H=add(button_x + i * 64 - 64, button_y + 4, "", layer = layer + 2, maptext = "<text align=center>[options[i]]", maptext_width = 48)
optlist[A]=i//adding the buttons and the text in option
optlist[B]=i
optlist[H]=i
while(!Choice)//waiting for choice to become anything other then 0
sleep(1)//sleep so it dont lag game
hide()//hide it
return options[Choice]//return the option after finding out what was the origional name
mob
var
// each player has a message box
MessageBox/message_box

Login()
..()

src << "Bump into a dense turf to make a message box appear. Click the message box's OK button to close it."

// create a message box for this mob
message_box = new(src)

// position the message box so it'll be centered
// at the top of the screen
message_box.pos(80, 208)

// we want it to be hidden initially
message_box.hide()
src<<"You said [message_box.ShowAlert("How would you like to say hello",options=list("Hi","Hello","Sup"))] to everyone"//testing the proc

this is the best i could do for you
ty