[solved] low level command parser variable return

hi, i was wondering if it is at all possible to return a variable’s existence via a string in a command window. i have a few ideas how to do it but whether they will work or not is the real question. my command window is simple and only assists players who want to develop maps in my game in the future or just build things in a kind of creative mode, it supports up to 8 arguments, i didn’t write any code yet. i was thinking something like this without [and].

at command window:
/returnparam [varname]

at script level with a reference to the other script to have “scanned” for the variable type by name:
using get property / get member search the referenced script for anything that matches and if found do something, if not found say that it doesn’t exist

or

at command window using the above at scrpt level:
/returnparam [vartype] [varname]

i have looked at a few pages and they are all for java… i use c# and there is a lot of things java can do that c# can’t and c# looks to me like it is significantly faster than java so i stopped using java.

any help would be much appreciated.

thanks in advance.

You want reflection…

System.Reflection:

You can get the type from an object with the ‘GetType’ method. Then with the Type object, you can call ‘GetMember’ to search for a member on the type by name.

1 Like

hi, sorry for the long response time. i have a 14 hour work shift and work has been crazy lately, it just died down and now i can focus on my game again. this looks extremely useful and i will look into this on my time off. thanks for the reply :slight_smile:

hi again, i finally had some time to implement this and it works great, thanks for the reference.