ID:2703249
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
It would be cool if we could obtain a list of variables on a type without having to initialize it because it'd help with setting up debug tools by letting us more easily distinguish the variables of a specific type rather than needing to create an object, get the variables and then delete it which seems unnecessary and quite expensive to do especially when debugging happens whilst players are playing your game.

The syntax for this could be as simple as `initial(type.vars)` returning an array of variables in string form.
Would the object you're "debugging" not be the type in question not allowing you to just run for( v in vars ) inital(v)..?
The point is to be able to compare the variables that are unique to the object you are debugging instead of having to view every single variable.

It'd allow you to more easily separate variables based on type rather than having to instantiate an object just to compare the variables, which is inefficient and really not ideal.
Could easily maintain a list of the built-in variables to remove them from the loop list.

Would it not be worth it and typically pretty easy to just self-maintain a Vars variable containing a paramed list. I wouldn't expect any one type to have too many variables.

I understand you want something easier. But it sounds like something you can already easily do yourself. You'd rather it just be too easy, I do agree with you though.

Now I am not well versed on the inner-workings as much as I'd like. But I believe that would involve a lot more being saved/stored for something not "everyone" would be taking advantage of.
var list/initial_vars = new

proc/GenerateInitialVars()
var object
for(var/path in typesof(/obj))
initial_vars[path] = list()
object = new path
for(var/i in object:vars)
initial_vars[path][i] = object:vars[i]

obj
var/tmp
healing = 12
pie
healing = 13

mob/verb/Demo()
GenerateInitialVars()
world << initial_vars[/obj/pie]["healing"]


Can do something like this.
In response to Kozuma3
Kozuma3 wrote:
[snip snop]

Can do something like this.

WalterMeldron wrote:
It would be cool if we could obtain a list of variables on a type without having to initialize it
In response to Super Saiyan X
Super Saiyan X wrote:
[snop snip]

WalterMeldron wrote:
... rather than needing to create an object, get the variables and then delete it which seems unnecessary and quite expensive to do...

In response to Shadowkaroth
Shadowkaroth wrote:
Could easily maintain a list of the built-in variables to remove them from the loop list.

Would it not be worth it and typically pretty easy to just self-maintain a Vars variable containing a paramed list. I wouldn't expect any one type to have too many variables.

I understand you want something easier. But it sounds like something you can already easily do yourself. You'd rather it just be too easy, I do agree with you though.

Now I am not well versed on the inner-workings as much as I'd like. But I believe that would involve a lot more being saved/stored for something not "everyone" would be taking advantage of.

I'd rather it be more possible. There's no reason not to have this feature. It's possible but through shitcode and I don't like having to write shitcode especially when debugging on a live environment when players may be playing.

The idea of this feature request is to be able to get the a list of variables for a type, not separate out the built-in variables.

In any byond game, you may be dealing with a shit ton of types with many subtypes of subtypes and you don't want to maintain a list of every single one because otherwise it's going to be impossible to maintain or it's going to take forever to query. Being able to get the variables of the parent type recursively to split out the variables into different lists based on type would really help speed up debugging variables on an object.

I was speaking to lummox about this earlier and he said it was possible to get the info internally. I suggested that a syntax like initial(type.vars) could work for this.

Also people are misunderstanding the point of this feature request. This is already possible through hacky code, but it's about the ability to make good debugging tools without needing to use these hacky methods (e.g. initialising an object only to delete it afterwards to save on space) which is why this feature request was made.