Hey guys, i have a problem with this code string i got from Rae-kwon's demo, so far i have it so that u click word and some words pop up on the screen in a box. But what i would like is if you could walk up to a npc, click talk and the message the npc gives pops up. If possible, plz include a sound addition so when the text pops up sound is made when the text is being written. Below is Rae-Kwons code, and after that is my code for the usr thing. Plus the errors.
mob/proc
close_menu(){for(var/obj/text/O in client.screen)del O;for(var/obj/back/O in client.screen)del O}
TOSP(var/textonscreen){text1=list();for(var/ a=1,a<=length(textonscreen),a++){text1+=copytext(textonsc reen,a,a+1)}}
textonscreenbackground(var/XC1,YC1,XC2,YC2)
for(var/XC=XC1,XC<=XC2,XC++)
for(var/YC=YC1,YC<=YC2,YC++){var/obj/back/b=new(client);
if(XC==XC1)b.icon_state="l";if(XC==XC2)b.icon_state="r";if(Y C==YC1)b.icon_state="b";
if(YC==YC2)b.icon_state="t";if(XC==XC1&&YC==YC1)b.icon_state ="ll";
if(XC==XC2&&YC==YC2)b.icon_state="ur";if(XC==XC1&&YC==YC2)b. icon_state="ul";
if(XC==XC2&&YC==YC1)b.icon_state="lr";b.screen_loc="[XC],[YC]"}
textonscreenTEXT(var/XC1,XC2,YC1,YC2,T)
var{XC=XC1;YC=YC1}TOSP(T)
for(var/Y in text1){var/obj/text/C=new(client);
if(XC==round(XC)&&YC==round(YC)) C.screen_loc="[XC],[YC]";else if(XC!=round(XC)&&YC==round(YC))C.screen_loc="[XC-0.5]:16,[Y C]";else if(XC==round(XC)&&YC!=round(YC))C.screen_loc="[XC],[YC-0.5]: +16";
else if(XC!=round(XC)&&YC!=round(YC))C.screen_loc="[XC-0.5]:16,[Y C-0.5]:+16";C.icon_state="[Y]";
sleep(1) // Important. If you wish for the text to sleep leave it, otherwise remove sleep(1)!
XC+=0.5
if(XC==XC2)
XC=XC1;YC-=0.5
if(YC==YC2-0.5)break}
mob/var/text1
obj
back
icon='back.dmi'
layer=MOB_LAYER+4
New(client/C)C.screen+=src
text
icon='text.dmi'
layer=MOB_LAYER+5
New(client/C)C.screen+=src
mob
verb
Test()
textonscreenbackground(1,1,13,5)//Sets up hwo big you want the background to be.
textonscreenTEXT(1.5,12,5,1.5,"Hey there Stephen, sup.")// Sets up where the text will go, from which x to y and how far down.
sleep(5)
usr.close_menu()
//and heres the code i added
to the test ptoc
mob
guy
verb
Test()
textonscreenbackground(1,1,13,5)//Sets up hwo big you want the background to be.
textonscreenTEXT(1.5,12,5,1.5,"Hi there dude.")// Sets up where the text will go, from which x to y and how far down.
sleep(5)
usr.close_menu()
mob/guy
icon = 'guy.dmi'
density = 1
//Thanks
The Conjuror
Copyright © 2025 BYOND Software.
All rights reserved.
RaeKwon