mob/var/tmp
inmenu
menuaction
menuanswer
menupos=1
input_box=0
sleep_in_message
list/menulist = new()
list/text_list = new()
obj/onscreen/curser/curser
mob/proc
//common proc
screen_dialog(text,screen,refresh,quick)
if(!screen) screen="message"
if(!refresh) screen_background(2,16,12,16,0,0,10,screen)
screen_npctext(3,15.5,15,12,0,16,11,text,screen,quick)
screen_yesno(var/screen)
while(text_list) sleep(5)
inmenu="yesno"
screen_background(2,5,9,11,0,0,10,"yesno")
screen_text(3,5.5,10.5,10.5,0,0,10,"Yes","yesno")
screen_text(3,5.5,9.5,9.5,0,0,10,"No","yesno")
menuanswer=0
menupos=1
curser=new(client)
curser.screen_loc="2,10:8"
while(!menuanswer) sleep(5)
close_screen("yesno")
del(curser)
inmenu=screen
if(menuanswer==1) return 1
else return 0
//close proc
close_allscreen()
if(!client) return
for(var/obj/onscreen/O in client.screen) del O
menulist = list()
inmenu = null
menupos = 1
close_screen(var/screentag)
for(var/obj/onscreen/O in client.screen) if(O.screentag == screentag) del O
//listing proc
screentext2listl(var/text)
var/list/textlist = new()
for(var/a=1,a<=length(text),a++) textlist+=copytext(text,a,a+1)
return textlist
//*menu creation proc*
screen_background(XC1,XC2,YC1,YC2,XO,YO,layr,screentag)
for(var/XC=XC1,XC<=XC2,XC++)
for(var/YC=YC1,YC<=YC2,YC++)
var/obj/onscreen/back/BG=new(client,layr,screentag)
if(XC==XC1) BG.icon_state="l"
else if(XC==XC2) BG.icon_state="r"
else if(YC==YC1) BG.icon_state="b"
else if(YC==YC2) BG.icon_state="t"
if(XC==XC1&&YC==YC1) BG.icon_state="ll"
else if(XC==XC2&&YC==YC2) BG.icon_state="ur"
else if(XC==XC1&&YC==YC2) BG.icon_state="ul"
else if(XC==XC2&&YC==YC1) BG.icon_state="lr"
BG.screen_loc="[XC]:[XO],[YC]:[YO]"
//**NPC text we can use this for**
screen_npctext(XC1,XC2,YC1,YC2,XO,YO,layr,text,screentag,quick)
for(var/obj/onscreen/text/O in client.screen) if(O.screentag==screentag) del(O)
if(text) text_list = screentext2listl(text)
else if(text_list) for(var/L in text_list) text+=L
else return //nothing to display
var
XC=XC1
YC=YC1
if(!quick) sleep_in_message = 0
var/C=1
for(C,C<=length(text_list),C++)
//spacin', paragraph..
if(text_list[C]==ascii2text(35)){XC=XC1;YC-=1;continue}
else if(text_list[C]==ascii2text(32)) //a space
//do we have enough place for the next word? looking for '#' or ' '. x_x
var/space_left = (((XC2-XC1)-(XC-XC1))*2)
if(length(copytext(text,C+1,findtext(text,ascii2text(32),C+1,0)))>space_left&&length(copytext(text,C+1,findtext(text,ascii2text(35),C+1,0)))>space_left){XC=XC1;YC-=1;continue}
if(XC==XC1) continue //is it the beginning of a line? x_x
//paragraph
if(XC>XC2){XC=XC1;YC-=1}
if(YC<YC2)
text_list.Cut(1,C)
var/obj/onscreen/text/N = new(client,layr,screentag)
N.screen_loc="18,12"
N.icon_state=ascii2text(62)
sleep_in_message = 0
return
//creating the obj/icon
var/obj/onscreen/text/T = new(client,layr,screentag)
if(XC==round(XC)&&YC==round(YC)) T.screen_loc="[XC]:[XO],[YC]:[YO]"
else if(XC!=round(XC)&&YC==round(YC)) T.screen_loc="[XC-0.5]:[16+XO],[YC]:[YO]"
else if(XC==round(XC)&&YC!=round(YC)) T.screen_loc="[XC]:[XO],[YC-0.5]:[16+YO]"
else if(XC!=round(XC)&&YC!=round(YC)) T.screen_loc="[XC-0.5]:[16+XO],[YC-0.5]:[16+YO]"
T.icon_state = text_list[C]
//end of creation
if(sleep_in_message) sleep(1)
XC+=0.5
text_list = null
sleep_in_message = 0
//***This part is good for huds***
screen_text(var/XC1,XC2,YC1,YC2,XO,YO,layr,text,screentag)
var XC=XC1,YC=YC1
for(var/i=1,i<=length(text),i++)
var/C = copytext(text,i,i+1)
if(C==ascii2text(35)){XC=XC1;YC-=0.5;continue}
var/obj/onscreen/text/T=new(client,layr,screentag)
if(XC==round(XC)&&YC==round(YC)) T.screen_loc="[XC]:[XO],[YC]:[YO]"
else if(XC!=round(XC)&&YC==round(YC)) T.screen_loc="[XC-0.5]:[XO+16],[YC]:[YO]"
else if(XC==round(XC)&&YC!=round(YC)) T.screen_loc="[XC]:[XO],[YC-0.5]:[16+YO]"
else if(XC!=round(XC)&&YC!=round(YC)) T.screen_loc="[XC-0.5]:[XO+16],[YC-0.5]:[16+YO]"
T.icon_state="[C]"
XC+=0.5
if(XC>=XC2){XC=XC1;YC-=0.5}
if(YC<=YC2-0.5) break
and i dont understand that at all, its hardly (if at all) commented, and i dont understand it... did i mention i dont understand that? i mean im a good enough coder but i havent EVER wandered into making a hudded game, now i cant really progress with my game any more unless if i learn how to use that, because like everything revolves around the hud, battle/menu/invitory/status/equipment you name it FF has a hud for it...
anyone willing to teach me the way of the hud?