ID:152910
 
You know, Ive been wondering about this for awhile now, and ive been thinking...

It would be cool to allow players to build their own custom items and actully code on the server and upload it. Or perhaps.

Didnt someone here awhile back design a code language for working inside of a byond game?
I belielive Nick was working on something like this, I know it's on the hub.
I think it's called Patch and Reboot or something.
Shades wrote:
You know, Ive been wondering about this for awhile now, and ive been thinking...

It would be cool to allow players to build their own custom items and actully code on the server and upload it. Or perhaps.

Didnt someone here awhile back design a code language for working inside of a byond game?

Exadv1 did for his game console. Also, I think Hazman made one in library format.
In response to Flame Sage
Theres a new game called Bot Duel where you can code your own bot, really good game.
In response to DaGoat787
hub://Deadron/XML


If you learn how to use that, than it'll be easy to customize/create/etc stuff.. examples of some games using this XML library (thank god for Deadron's libs :S) are: hub://DBOTeam/SevenStarsANewDawn (in alpha.. seen when editing NPC or Skills), hub://Crispy/YetAnotherGenericSpace-AgeConquestGame , and hub://Gerdan/BotDuel (in which DaGoat mentioned earlier)
In response to Jon88
Ahh, yes. The old Maestro. It needs updating, really, but the code is so awful that every time I start to work on it I think, "Hmmm. This code is awful" and give up.
I s'pose I could start working on it again over Summer.
In response to Hazman
Hazman wrote:
I s'pose I could start working on it again over Summer.

Summer's half over, so you get crackin'.
First, make a new coding file called something like "code". Leave it blank and make sure you "include" it (by checking the tickbox next to the file in Dream Maker).

Then put this snippet somewhere:

mob
verb
Text2Code(T as message)
text2file(T,"code.dm")


However the game needs to be recompiled (no reboot doesn't work) in order for the new code to come in to place :(

*Edit*

I wouldn't recommend using this example in any game since the player could program an entire GM system and destroy the game.
By reading everyone elses post i say it can be done. But watch out for the jackass who makes and all powerful item/character and screws everyone else over.
In response to Popisfizzy
What I want to do, is give the players a blank canvas and create their own entire world, without actully runing it, ie, booting and banning players.
In response to Shades
I have had this idea also, But I never though about it really....I do asume this can be done, but I doubt it can be programmed in DM then compiled directly into the game. Unless what you did, was create a proc to screen through there code, and turn it into..well the real DM stuff.
In response to Sniper Joe
DM files are simply text files. My snippet will create the DM file with the coding. The only problem is the way games are run is through a compiled .rsc and .dmb file - which aren't connected to the current coding. If there was a way to write to the .rsc file (which according to Ol' Yeller's posts about .rsc decompiler is probably possible) then you could have a proper Text2Code proc.
Shades wrote:
You know, Ive been wondering about this for awhile now, and ive been thinking...

It would be cool to allow players to build their own custom items and actully code on the server and upload it. Or perhaps.

Didnt someone here awhile back design a code language for working inside of a byond game?

Okay. because I was bored and had nothing better to do. I made something that will work for whawt you watned to do, if you didn't actually really want it, oh well. I made it ><

proc/getobjname(var/script){var/b="getpastobj";var/objname = "";for(var/i=1;i<=length(script);i++){var/c=copytext(script,i,i+1);if(c=="/"){b="getobjname"}else{if(b=="getobjname"){if(isTextorNum(c)){objname+=c}}}}return objname;}
obj/customobj/proc/setVar(var/script)//this is to find the var they want to change inside the custom obj
var/b="getvarname"
var/varname=""
var/thevalue=""
for(var/i=1;i<=length(script);i++)
var/c=copytext(script,i,i+1)
if(b=="getvarname")
if(c!=" "&&c!="=")
varname=varname+c
if(c=="=")
b="getvalue"
if(b=="getvalue")
if(c!=" "&&c!="=")
thevalue=thevalue+c
if(text2num(thevalue))
thevalue=text2num(thevalue)//the value is a number
world <<"the varname: [varname]/"
for(var/i=1;i<=src.vars.len;i++)
var/X=src.vars[i]
if("[X]"=="[varname]")
src.vars[X]=thevalue
world <<"src.test:"+src.test
proc/createObj(var/obj/line/list/lines)
var/obj/customobj/O = new /obj/customobj
for(var/i=1;i<=lines.len;i++)
var/obj/line/currentLine=lines[i]
var/line=""
line=currentLine.script
O.name=getobjname(line)
var/variables[0]
for(var/X in O.vars)
variables += X
for(var/o in variables)
if(findText(line,"[o]")&&i!=1)
O.setVar(line)//sets the var of the obj you made!
world <<"it's new test "+O.test
return O
proc/isTextorNum(var/char){var/c=lowertext(char);if(c=="a"||c=="b"||c=="c"||c=="d"||c=="e"||c=="g"||c=="h"||c=="i"||c=="j"||c=="k"||c=="l"||c=="m"||c=="n"||c=="o"||c=="p"||c=="q"||c=="r"||c=="s"||c=="t"||c=="u"||c=="v"||c=="w"||c=="x"||c=="y"||c=="z"||c=="1"||c=="2"||c=="3"||c=="4"||c=="5"||c=="6"||c=="7"||c=="8"||c=="9"||c=="0"){return TRUE;}else{return FALSE;}}
obj/line{var/script="";}
mob/verb/Create_Obj()//this will actually make the object
var/currentline=""
var/obj/line/list/lines[]=list()
var/script=src.script
for(var/i=1;i<=length(script);i++)
var/c=copytext(script,i,i+1)
if(c=={"
"}
||c==";")
var/obj/line/o = new /obj/line
o.script=currentline
lines+=o
currentline=""
else currentline=currentline+c
for(var/a=1;a<=lines.len;a++)
var/obj/line/o = lines[a]
var/line=o.script
if(findtext(line,"obj/")==1)
var/obj/line/list/scripto=list()
for(var/i=a;i<=lines.len;i++)
var/obj/line/oldLine=lines[i]
var/theline=oldLine.script
if(theline!="}")
var/obj/line/newLine = new /obj/line()
newLine.script=oldLine.script
scripto+=newLine
else
a=i
var/obj/customobj/O = createObj(scripto)
mob/var/script=""
obj/customobj
var/test=0
mob/verb/Script_Obj(){var/a = input("In Game Object Coder v. 1","",script)as message;src.script=a; src.script+={"
"}
;}


and that thing I made, to make a new object, simply do things like this..just put it in the message in the Script Obj verb is what I mean.
obj/myingamecreatedobject
desc=hello!
x=5
y=1
z=7


It's very simple(for me) and quite short. Enjoy.
In response to DeathAwaitsU
No you couldn't. RSC files don't contain any code, and the DMB is loaded into memory upon each reboot, so changes to the on-disk DMB don't affect the running game.

Under Linux you can in theory call command-line DreamMaker to compile your changed source, then reboot to apply the changes.

If you don't want to have to reboot all the time, a scripting language is the way to go.
In response to Crispy
sorta like mine? >_>
In response to Buzzyboy
Yes, but yours is not particularly flexible and could have been done probably more simply.
For example, why the huge if(c=="a"||...)? This could have been done much more cleanly with a list, ore better still, by checking ASCII ranges.
If you could get the system to do pauses (sleep), execute verbs, move, 'sense' etc. then the system would be much better. However, I recommend splitting it up into many more procs if that is the way you want to go with it.