Alright, i want to be able to do this.
Is it possible to make a text string, which, when a verb is pressed, will turn it into code and make it work?
Eg:
NeonJ writes something* onto the whiteboard.
NeonJ presses button
hullo
*Note: The something explained would be this
mob/verb
Button()
[WORDS TYPED GO HERE - In this case (world << "hullo")]
ID:158183
Oct 15 2009, 5:23 am
|
|
Yes, this is possible, but the code written on the blackboard would not be written in the DM language. DM is a compiled language, meaning that the compiler must take the code you write and turn it into byte code which BYOND understands. By itself, BYOND can't do anything with the original text code.
What you would have to do is invent a scripting language and then write a system to understand and execute this script. Several libraries exist which address the issue with varying levels of success. I know Nickr5 is currently working on one, though I don't know how complete it is right now. Hazman made a language called "MAESTRO" along with a library for interpreting it, but I can't find that library on the hub anymore. |
In response to Calus CoRPS
|
|
No, that's not it at all.
I want the code to actually EXECUTE when typed Well, it's hard to explain, but i want a thing that will actually execute code when it's typed. Eg: Type..." mob/verb/walkaround() if(usr.stop == 0) step_rand(usr) sleep(50) usr.walkaround() " Then, once you pressed "GO" on the machine, that code will become availible to you and all other mobs. (And perhaps if you press "STOP", the string will become empty and that code will become unavailible again.) |
In response to IainPeregrine
|
|
So I pretty much have to make it myself?
If so, what exactly would it be called? You said there were a few libs on it.. |
In response to NeonJ
|
|
Search the forums for "Scripting Language". The two libraries that I know of I already gave you all the information I have for finding them.
|
In response to IainPeregrine
|
|
I don't actually want it to be a different code, though. I want it to be BYOND code...
|
In response to NeonJ
|
|
You want the code as it's written to appear in world?
I'm not sure how to do that, but if this is what you mean... You seem pretty new to DM, so I'll add some comments to explain this. var/txt // set the variable Am I on the right track? |
In response to NeonJ
|
|
I fear you missed some part of what Iain told you there...
IainPeregrine wrote: DM is a compiled language, meaning that the compiler must take the code you write and turn it into byte code which BYOND understands. By itself, BYOND can't do anything with the original text code. |
In response to Schnitzelnagler
|
|
No, I understood it completely. Just thought it could be possible to make a code thingy which understands the EXACT same code BYOND actually uses.
|
In response to Stereo
|
|
That's exactly what the other guy said. It's not right at all.
|
In response to NeonJ
|
|
NeonJ wrote:
That's exactly what the other guy said. It's not right at all. Can you be a little more forthright with what you mean? I'm not sure anyone understands what you mean by pressing a "machine button"? Do you want the code to be actually PASTED into the world's output? |
In response to NeonJ
|
|
What you're asking for is impossible. Consider the type/path system. When your game is compiled, all the objects you've defined are compiled into a tree structure with /datum at the top. If it were possible to have a DM scripting language which supported all aspects of the DM language (in other words, it is "the same") then it would have to be able to define new objects, like so:
mob/my_new_object_definition The problem is that once compiled the object tree cannot be modified, so you cannot define new objects which will behave "just like DM" and be interchangeable between DM and the DM script. If you want a "text to code" function in your game, it must use a scripting language, and that scripting language must deviate from DM in some basic ways. |
In response to IainPeregrine
|
|
Alright, I understand.
Well, thanks anyway! --CASE CLOSED-- |
In response to Stereo
|
|
I believe that what he wants is to be you enter dm code
e.g. obj/blah/icon = 'blah.dmi' into a "whiteboard" or a "post" and the code is added to a section of his game and, the code becomes availible inside game so, if he had some kind of create verb he could now make "blah" and click on "blah", correct? or maybe my english is failing again |
In response to Gigimoi
|
|
sorry about bump but....
Maybe you could make it so they could import thier own code? dunno, just pitching out ideas... |
In response to NeonJ
|
|
Impossible
No game can do this. At all. Not just to BYOND; either. |
In response to Mista-mage123
|
|
GCC (the C compiler) is written in C. Now lay a brick.
|
In response to IainPeregrine
|
|
The library's more than usable now (as the demo shows), although some basic functionality is missing, ie there's a while loop but no break or continue statement. The main reason I haven't released it, though, is because it's a little tricky to figure out how to use and I'm still working on the documentation. If anyone wants to see it early, contact me via the pager and I'll definitely send it to you.
|
I'm having a hard time understanding what you need. Perhaps my guess is correct:
http://www.byond.com/docs/ref/info.html#/proc/input