ID:2960825
 
Code:
proc/start_dialogue(var/player/player, var/npc/npc, var/dialogue, var/list/choice=list("Close"))
if(winget(player, "dialogue", "is-visible")=="true") return
player.choice = null
winset(player, null, "dialogue.title=\"[npc.name]\"")
var/posx = copytext(winget(player, "default", "pos"), 1, findtext(winget(player, "default", "pos"), ","))
var/posy = copytext(winget(player, "default", "pos"), findtext(winget(player, "default", "pos"), ",")+1)
winset(player, null, "dialogue.pos=\"[text2num(posx)+100]x[text2num(posy)+300]")
player << output(dialogue, "grid:1,1")

for(var/i=1, i<=choice.len, i++)
var/obj/button = new/d_button(choice[i])
player << output(button, "button:[i],1")

winshow(player, "dialogue", 1)

while(!player.choice)
sleep 1
if(!player) return
return player.choice


Problem description:
So I'm trying to get a multiple choice dialogue working here but for some reason the choices created are being duplicated. Duplication is not happening with 2 choices but 3 or more then it does duplicate.

Also the Click() proc isn't working on the odd number options i.e option 1, 3, 5 etc.

Not sure why it does this but only when created a new object. If I try to output it as a text string then there's no issues with printing options

Login to reply.