ID:260448
 
I need a thing implemented so that like, i can do the following, make a verb bring up a text box, and u type like density=1 and density = 0 or anything else in the world such as like for(var/T in world) if(T == "whatever"
then do whatever...

currently there is no way to do any of this, and there isnt any way to make tabs actually do tabs in any text box or anything, so that part needs to be implemented to, or somehow something added or changed that will allow this, as that is the only way i can really code.


this thing would be used to debug things while the game is on, such as if a guys icon was wrong, and i didnt have a change icon verb, i can just type up the code to change his icon, and then itll send it through the parser part.
You're going to have to explain what you mean, because what you have right now makes no sense.
In response to Popisfizzy
He wants to dynamically reference a variable during run-time and change its contents. I've never really tried this, and I don't know if it's really feasible, but I recommend looking up vars(list) in the reference. It's a DM-generated variable that contains a list of all the variables belonging to an object.
In response to Popisfizzy
just being able to type in a text box a verb brings up, like density = 0 and then it changes your density to 0 and stuff.

i dont wanna make a thing so if the textarea = "whatever text"

i want it so i can type in any code in the textarea and it will actually EXECUTE(RUN) that line of code i put in, instead of me having to make an actual thing that will actually look through all the code and do what its supposed to.
In response to Evre
Yea, it's entirely possible. The fact that any map loading can be made works on this premise.
In response to Super Silly Stuart
You can't run newly defined DM code at run-time. It needs to be compiled first. The best you're going to get is to be able to dynamically change variables at run-time.

If you want DM-like capabilities in your game, you may want to look into implementing an in-game scripting language. Although, this might be out of your league at the moment.
In response to Super Silly Stuart
As far as I know, this isn't feasible. DS is a virtual machine, and to modify what's in that virtual machine at runtime would be a rather risky thing to do. You can, though, write a parser for a scripting language to do this. Seeing as how that is possible (I've made some simple ones, as have other people, and I'm currently working on making one that's far more complex.) and that something like this seems like it's only a niche thing, it doesn't seem to likely this'll be put in.
In response to Evre
i know how i could do an in-game one easily, but i want one that i type code in, in the actual game, and it will actually execeute(run) that piece of code i put in.

either way why would it need to be compiled first? as i meen really, as long as you manually make sure it has no errors in the code, it would always work fine, so it shouldnt be any trouble to adding this feature to byond if it doesnt already somehow exist.
In response to Super Silly Stuart
Compiling does more than simple error checking. It turns human readable text into a binary that the computer can understand and execute.

Even if this were possible, I don't think they could pull it off without Dan, since he was the guy who handled the really core mechanics of the compiler. I don't think it is, though. Go read up on how compilers work if you still don't see why it doesn't seem likely.
In response to Evre
ok, then they can simply make it run through the compiler of DM and then allow it to use it then, right? so what would be wrong with that theory of mine now?
In response to Super Silly Stuart
The fact that there would be absolutely unpredictable problems in modifying code in something that is currently running. It's essentially like this. Say your math teacher gives you a long math problem with the variables x, y, and z. You start doing the problem, and when you finish it and show it to her, she says it's wrong because she changed the values of x, y, and z, but you didn't know this. This is essentially the same problem that would arise by modifying code that is currently being run.
mob/admin/verb/ChangeVar(atom/a in world)
var/v = input("Which variable would you like to modify?") as text
var/k = input("What would you like to set the variable to?) as text
a.vars[v]=k


You can fiddle with that a bit to make it work for numbers, null, and other such things.
In response to Jp
mob/admin/verb/ChangeVar(atom/a in world)
var/v = input("Which variable would you like to modify?") as text
var/k = input("What would you like to set the variable to?") as text
a.vars[v]=k


That's better.
In response to Ir0nm4n
Ir0nm4n wrote:
 mob/admin/verb/ChangeVar(atom/a in world)
var/v = input("Which variable would you like to modify?") as null|anything in a.vars
if(!v) return
var/k = input("What would you like to set the variable to?") as text
if(!k) return
a.vars[v]=k




That's better better.
In response to Super Silly Stuart
Super Silly Stuart wrote:
either way why would it need to be compiled first?

Yes. Since .dm files can be created at runtime, this is technically possible. However, it gets messy rather fast and will always require a reboot of the world.

What you'll need to do:

1) Create a uniquely-named (and probably randomly generated) .dm file, which you then also have to make sure to edit the .dme to include. This has to be done through code you've added yourself beforehand.

2) Create a command that sends what you input into that uniquely-named .dm file.

3) Recompile the world through a shell() command

4) Reboot the world
Super Silly Stuart wrote:
I need a thing implemented so that like, i can do the following, make a verb bring up a text box, and u type like density=1 and density = 0 or anything else in the world such as like for(var/T in world) if(T == "whatever"
then do whatever...

currently there is no way to do any of this, and there isnt any way to make tabs actually do tabs in any text box or anything, so that part needs to be implemented to, or somehow something added or changed that will allow this, as that is the only way i can really code.


this thing would be used to debug things while the game is on, such as if a guys icon was wrong, and i didnt have a change icon verb, i can just type up the code to change his icon, and then itll send it through the parser part.

i don't know if this will actually be able to do what you need, but there's an undocumented proc called eval that takes a string and executes it as code. i happened to stumble upon it by naming a proc of my own eval only to find out that its a reserved word. according to [link] it uses DM Script, which doesn't seem to have a well-documented syntax, so i'm not sure if this would be able to do what you need it to but it might help.
In response to Evre
Evre wrote:
You can't run newly defined DM code at run-time. It needs to be compiled first. The best you're going to get is to be able to dynamically change variables at run-time.

Wrong -- you can make your own scripting language that communicates with your code. i.e. set verbs or call another objects' procs.

-- Data
In response to Android Data
i dont know, but if that function can execute a piece of code i would type in such as density=0 it would be exactly what im looking for, can someone test it?
In response to Super Silly Stuart
You can easily change variables, but as Data said, you can't change the code itself unless you have another language communicating with the game...

Data, do you know anyone who can do that? :/
In response to Kaiochao2536
Kaiochao2536 wrote:
You can easily change variables, but as Data said, you can't change the code itself unless you have another language communicating with the game...

No, you can't change the code itself. You can make a scripting language parser that will interpret new code, but you can't change the DM code.
Page: 1 2