ID:147792
 
I'm using s_admin's old "Edit" command from back in the day (I don't like the browser based on - too laggy). But, I wish to remove certain variables from the list, which I did but now I've got a small problem which could turn ugly for my Admins who may use it. It says the variable's type is undetermined. But, since I know the type of variable it is whether it be text, num, etc. My admins won't and they could get lost and give it the wrong type of value. Any help or tips on problems you see?

            Edit(atom/O as obj|mob|turf|area in world)
set category="Admin"
set hidden=0
set desc="(target) Edit a target item's variables"
var/L[0]
var/i
var/list/Removables=list("overlays","underlays","Horizontal","Vertical",\
"screen_x","screen_y","counter","expanded","expandable","expandable",\
"Open","Expandables","lifecycle_delay","movement_probability","version",\
"key","admin","ishost","loggedin","target","killer","killed","meter1",\
"meter2","meter3","meter4","PlBar","KiBar","HpBar","jailed","verbs",\
"vars","contents","loc","client","group","gender")
for(i=1,i<=O.vars.len,i++)
if(O.vars[i] in Removables)
continue
L.Add(O.vars[i])
// L["[O.vars[i]]"]=O.vars[i]
var/variable=input("Which var?","Var") in L
var/default
var/typeof=L[variable]
var/dir
if(isnull(typeof))
usr<<"Unable to determine variable type."
else if(isnum(typeof))
usr<<"<b>Variable appears to be <b>NUM</b>."
default="num"
dir=1
else if(istext(typeof))
usr<<"<b>Variable appears to be <b>TEXT</b>."
default="text"
else if(isloc(typeof))
usr<<"<b>Variable appears to be <b>REFERENCE</b>."
default="reference"
else if(isicon(typeof))
usr<<"<b>Variable appears to be <b>ICON</b>."
typeof="\icon[typeof]"
default="icon"
else if(istype(typeof,/atom) || istype(typeof,/datum))
usr<<"<b>Variable appears to be <b>TYPE</b>."
default="type"
else if(istype(typeof,/list))
usr<<"<b>Variable appears to be <b>LIST</b>."
default="cancel"
else if(istype(typeof,/client))
usr<<"<b>Variable appears to be <b>CLIENT</b>."
default="cancel"
else
usr<<"<b>Variable appears to be <b>FILE</b>."
default="file"
usr<<"<b>Variable contains: [typeof]</b>"
if(dir)
switch(typeof)
if(1)
dir="NORTH"
if(2)
dir="SOUTH"
if(4)
dir="EAST"
if(8)
dir="WEST"
if(5)
dir="NORTHEAST"
if(6)
dir="SOUTHEAST"
if(9)
dir="NORTHWEST"
if(10)
dir="SOUTHWEST"
else
dir=null
if(dir)
usr<<"<b>If a direction, direction is: [dir]</b>"
var/class=input("What kind of variable?","Variable Type",default) in list("text",
"num","type","reference","icon","file","restore to default","cancel")
switch(class)
if("cancel")
return
if("restore to default")
O.vars[variable]=initial(L[variable])
if("text")
var/Text=input("Enter new text:","Text",\
L[variable]) as text|null
if(!Text)
return 0
else
O.vars[variable]=Text
if("num")
var/N=input("Enter new number:","Num",\
O.vars[variable]) as num|null
if(!N)
return 0
else
O.vars[variable]=N
if("type")
var/T=input("Enter type:","Type",L[variable]) \
in typesof(/obj,/mob,/area,/turf)
if(!T)
return 0
else
O.vars[variable]=T
if("reference")
var/atom/movable/A=input("Select reference:","Reference",\
L[variable]) as mob|obj|turf|area in world
if(!A)
return 0
else
O.vars[variable]=A
if("file")
var/F=input("Pick file:","File",L[variable]) \
as file|null
if(!F)
return 0
else
O.vars[variable]=F
if("icon")
var/icon/I=input("Pick icon:","Icon",L[variable]) \
as icon|null
if(!I)
return 0
else
O.vars[variable]=I