Ok i have seen this in a few games now and it killing me not knowing how to do it..
the first game i have seen it in was console, were you could write progames to hack somone else's computer or what ever. I have also seen it in some robot games were you write scripts for you robot to run..
im making a comand line type game that i need to be able to have a programing lang in the game.. i know how to make command line commands but i would like to be able to write scripts that do what ever..
im not sure how to go about make a programing lang in DM
any help or input wold be great.. TY
ID:167365
Mar 23 2006, 10:53 am
|
|
In response to SJRDOZER
|
|
yeah i was talking to one of the ppl that has a programing lang in has game and he said summthing about praesing or whatever..
|
In response to Jex
|
|
no one know anythings esl about this??
|
Jex wrote:
im not sure how to go about make a programing lang in DM You just need to parse the text into commands and have functions that go through it one piece at a time. The following is a hasty and not nearly complete example that just shows how you might start to throw something together. #define GREATER 0 You could set up objects that do things based on what type of code they represent, similar to the above. Also, it would probably be easier to do it based on braces and semicolons than it would on indentation, as is done in other languages. Either way, you just set up a way to issue commands, and a way to represent it with text, then a way to convert the text into a set of the commands. Anyway, that's just something to kick-start the gears. |
If you wanted to make a code with procs(like in byond) for your robot, you'd have to find the (). Anything before on the same line or between brackets, or whatever would probably be the name. Any spaces beforehand are omitted if you use tabs for branching.
That's my best guess :\
Isn't that called parsing?
Oh yeah, above is a complex way but it's free form. Another way is just having the player choose what to put in the code, but you know exactly what is being inputted. The former is finding needles in haystacks and the latter says specifically "I'm making a proc", or "create this variable", probably using the statpanel or a cool GUI.