onscreentext
var/width=15
var/height=14
var/list/objlist = list()
var/mob/C
proc/add2screen()
for(var/X in src.objlist)
C.client.screen += X
proc/choice_bg(msg,choice,choice2,choice3,choice4)
for(var/i=1,i<src.height,i++)
for(var/l=1,l<src.width,l++)
if(i==1)
if(l==1)
var/obj/other/HUD/textbox/leftbottomcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
if(l==src.width)
var/obj/other/HUD/textbox/lefttopcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
else
var/obj/other/HUD/textbox/bottom/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
if(i==height)
if(l==src.width)
var/obj/other/HUD/textbox/righttopcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
if(l==1)
var/obj/other/HUD/textbox/rightbottomcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
else
var/obj/other/HUD/textbox/top/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
if(i==round(height/3)) //This is the added portion for the choices
if(l==src.width)
var/obj/other/HUD/textbox/righttopcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
else if(l==1)
var/obj/other/HUD/textbox/lefttopcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
else
var/obj/other/HUD/textbox/top/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
else
var/obj/other/HUD/textbox/middle/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
src.add2screen()
proc/plain_bg(msg)
for(var/i=1,i<src.height,i++)
for(var/l=1,l<src.width,l++)
if(i==1)
if(l==1)
var/obj/other/HUD/textbox/leftbottomcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
C.client.screen+=H
if(l==src.width)
var/obj/other/HUD/textbox/lefttopcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
else
var/obj/other/HUD/textbox/bottom/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
if(i==height)
if(l==src.width)
var/obj/other/HUD/textbox/righttopcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
if(l==1)
var/obj/other/HUD/textbox/rightbottomcorner/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
else
var/obj/other/HUD/textbox/top/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
else
var/obj/other/HUD/textbox/middle/H=new()
H.screen_loc="[i],[l]"
src.objlist.Add(H)
src.add2screen()
proc/create_background(var/mob/c,msg,choice,choice2,choice3,choice4)
if(!choice)
src.plain_bg(msg)
else
src.choice_bg(msg,choice,choice2,choice3,choice4)
New(var/mob/c,var/msg="",var/width=15,var/height=7,var/choice,var/choice2,var/choice3,var/choice4)
C=c
if(!width>src.width)
src.width=width
if(!height>src.height)
src.height=height
src.create_background(msg,choice,choice2,choice3,choice4)
Del()
for(var/x in src.objlist)
C.client.screen -= x
..()
Problem description:
I'm trying my hand at OO programming. The idea here is to create onscreen text through a HUD. The problem I'm having is that I know it's adding to C's screen when I test it with a for loop, but the screen objs simply aren't showing up. Does this have to do with BYOND's pass-by-value rule? Do I have to use the mob directly? Please help!
I'm not sure, but it may be creating those as images, in which case you want to add some kind of
thingy, which will output them to the user's screen. Otherwise, I have no idea...