Nice.
KHUD that I use for Elora 2

// This is the engine.

proc
screen_loc_math(loc,dir,size)
var/list/A = splittext(loc,","),list/B = splittext(A[1],":"),list/C = splittext(A[2],":")
var/list/L = list(text2num(B[1]),B.len > 1 ? text2num(B[2]) : 0,text2num(C[1]),C.len > 1 ? text2num(C[2]) : 0)
switch(dir)
if(NORTH)
return "[L[1]]:[L[2]],[L[3]]:[L[4]+size]"
if(NORTHEAST)
return "[L[1]]:[L[2]+size],[L[3]]:[L[4]+size]"
if(NORTHWEST)
return "[L[1]]:[L[2]-size],[L[3]]:[L[4]+size]"
if(SOUTH)
return "[L[1]]:[L[2]],[L[3]]:[L[4]-size]"
if(SOUTHEAST)
return "[L[1]]:[L[2]+size],[L[3]]:[L[4]-size]"
if(SOUTHWEST)
return "[L[1]]:[L[2]-size],[L[3]]:[L[4]-size]"
if(EAST)
return "[L[1]]:[L[2]+size],[L[3]]:[L[4]]"
if(WEST)
return "[L[1]]:[L[2]-size],[L[3]]:[L[4]]"
return "[L[1]]:[L[2]],[L[3]]:[L[4]]"

client
var
list
containers[] = new
list
hud[] = new
proc
layer(ID,INT)
var/khud/KHUD = src.hud[ID]
if(KHUD)
KHUD.layer = INT ? INT : KHUD.layer
change_text(ID,string,color="#FFFFFF")
var/khud/KHUD = src.hud[ID]
if(KHUD)
KHUD.overlays = list()
KHUD.overlays += build_maptext(string,"#666666",KHUD.layer + 1,KHUD.maptext_x-1,KHUD.maptext_y)
KHUD.overlays += build_maptext(string,"#666666",KHUD.layer + 1,KHUD.maptext_x+1,KHUD.maptext_y)
KHUD.overlays += build_maptext(string,"#666666",KHUD.layer + 1,KHUD.maptext_x,KHUD.maptext_y+1)
KHUD.overlays += build_maptext(string,"#666666",KHUD.layer + 1,KHUD.maptext_x,KHUD.maptext_y-1)
KHUD.overlays += build_maptext(string,KHUD.color,KHUD.layer + 2,KHUD.maptext_x,KHUD.maptext_y)
relocate(ID,SCREEN_LOC,DIR,VALUE)
var/client/c = usr.client
if(c.hud.Find(ID))
var/khud/KHUD = src.hud[ID]
if(SCREEN_LOC)
if(DIR!=null)
KHUD.screen_loc = "[screen_loc_math(SCREEN_LOC,DIR,VALUE)]"
else
KHUD.screen_loc = "[SCREEN_LOC]"
screen |= KHUD
return TRUE
add_text(ID, STRING = null, px = 0, py = 0)
var/khud/KHUD = src.hud[ID]
if(KHUD)
KHUD.overlays = list()
KHUD.overlays += build_maptext(STRING,"#000000",KHUD.layer + 1,px,py+1)
KHUD.overlays += build_maptext(STRING,"#000000",KHUD.layer + 1,px,py-1)
KHUD.overlays += build_maptext(STRING,"#000000",KHUD.layer + 1,px+1,py)
KHUD.overlays += build_maptext(STRING,"#000000",KHUD.layer + 1,px-1,py)
KHUD.overlays += build_maptext(STRING,KHUD.color,KHUD.layer + 2,px,py)

clean_text(ID)
var/khud/KHUD = src.hud[ID]
KHUD.overlays = list()
clean_container_text(ID)
var/khud/KHUD = src.containers[ID]
for(var/khud/HUD in KHUD.container)
HUD.overlays = list()
move_hud( ID , DIR = null , SIZE = 0)
if(ID && DIR && SIZE)
var/khud/KHUD = src.hud[ID]
if(KHUD.container.len > 0)
for(var/khud/HUD in KHUD.container)
HUD.screen_loc = "[screen_loc_math(KHUD.screen_loc,DIR,SIZE)]"
else
KHUD.screen_loc = "[screen_loc_math(KHUD.screen_loc,DIR,SIZE)]"
add_hud( ID , khud/KHUD , LOC = null , VISIBLE = FALSE ,LAYER )
if(!(src.hud.Find(ID)))
KHUD.ID = ID
src.hud[ID] = KHUD
if(LAYER)
KHUD.layer = LAYER
if(VISIBLE)
src.screen |= KHUD
if(LOC)
KHUD.screen_loc = "[LOC]"

add_container( ID )
if(!(src.containers.Find(ID)))
var/khud/KHUD = new
KHUD.ID = ID
src.containers[ID] = KHUD
for(var/ARG in args.Copy(2))
if(src.hud.Find(ARG))
var/khud/HUD = src.hud[ARG]
HUD.parent = KHUD
KHUD.container |= HUD
else
var/khud/KHUD = src.containers[ID]
var/khud/HUD
for(var/ARG in args.Copy(2))
if(src.hud.Find(ARG))
HUD = src.hud[ARG]
HUD.parent = KHUD
KHUD.container |= HUD


remove_container( ID )
if(src.containers.Find(ID))
var/khud/KHUD = src.containers[ID]
for(var/khud/HUD in KHUD.container)
HUD.parent = null
src.containers -= ID

hide_hud()
var/khud/KHUD
for(var/ARG in args)
if(src.containers.Find(ARG))
KHUD = src.containers[ARG]
if(KHUD)
for(var/khud/HUD in KHUD.container)
src.screen -= HUD
continue
if(src.hud.Find(ARG))
KHUD = src.hud[ARG]
if(KHUD)
src.screen -= KHUD
show_hud()
var/khud/KHUD
for(var/ARG in args)
if(src.containers.Find(ARG))
KHUD = src.containers[ARG]
if(KHUD)
for(var/khud/HUD in KHUD.container)
src.screen |= HUD
continue
if(src.hud.Find(ARG))
KHUD = src.hud[ARG]
if(KHUD)
src.screen |= KHUD
fade_hud()
var/khud/KHUD
. = args.Copy(2)
for(var/ARG in .)
if(src.containers.Find(ARG))
KHUD = src.containers[ARG]
if(KHUD)
for(var/khud/HUD in KHUD.container)
HUD.alpha = 255
animate(HUD,alpha=0,time=args[1])
spawn(args[1])
src.screen -= HUD
continue
if(src.hud.Find(ARG))
KHUD = src.hud[ARG]
if(KHUD)
KHUD.alpha = 255
animate(KHUD,alpha=0,time=args[1])
spawn(args[1])
if(KHUD.alpha==0)
src.screen -= KHUD
fade_in_hud()
var/khud/KHUD
. = args.Copy(2)
for(var/ARG in .)
if(src.containers.Find(ARG))
KHUD = src.containers[ARG]
if(KHUD)
for(var/khud/HUD in KHUD.container)
HUD.alpha = 0
animate(HUD,alpha=255,time=args[1])
src.screen |= HUD
continue
if(src.hud.Find(ARG))
KHUD = src.hud[ARG]
if(KHUD)
KHUD.alpha = 0
animate(KHUD,alpha=255,time=args[1])
src.screen |= KHUD

proc
build_maptext(string="",COLOR=null,LAYER=0,PX=0,PY=0)
var/obj/O = new/obj{maptext_width=1024;maptext_height=16}
O.maptext = "<font face=Arial>[string]"
O.color = COLOR
O.layer = LAYER
O.maptext_x = PX
O.maptext_y = PY
. = O

khud
parent_type = /obj
var
ID = ""
khud/parent = null
list
container[] = new
text
layer = 105
Outline code, sharing random stuff :P

obj
proc
outline()
. = 15
var/obj
n = locate(type) in locate(x,y+1,z)
e = locate(type) in locate(x+1,y,z)
s = locate(type) in locate(x,y-1,z)
w = locate(type) in locate(x-1,y,z)
if(n)n = 1
if(e)e = 4
if(s)s = 2
if(w)w = 8
overlays = list()
var/obj/o = new/obj{icon='Outline.dmi'}
o.layer = layer + 0.1
o.icon_state = "[. - (n+e+s+w)]"
overlays |= o
My first scripting language I made back in 2013, you never stop improving tho :D

Examples of the language
new obj1 /obj/Cookie
set obj1 name "Kozzy"

print "This objects name is [obj1.name]"

set obj1 x 1
set obj1 y 1
set obj1 z 1

call /proc/AI obj1

print "Done!"

: Rename
input name "What's your username?" as text
Hey "Hello,"
if name > 12
print "Your username [name] is to long!"
goto Rename
end if
if name < 3
print "Your username [name] is to short!"
goto Rename
end if
print "[Hey] [name]!"

A -1
B 1
TMP rand A B
printl "Number = [TMP] ,rand([A],[B]), "
if TMP
print "Your number is > 0."
else then
print "Your number is < or = 0."
end if

cookies 0

while cookies <= 3

add cookies 1
if cookies == 1
print "Here is a cookie! :3"
end if

if cookies == 2
print "Here is another cookie! :3"
end if

if cookies == 3
print "Here is one-more cookie! :3"
end if
end while

print "Now eat them cookies!"

bottles 99
while bottles >= 1
if bottles >= 2
printl "[bottles] bottles of beer on the wall, [bottles] bottles of beer. "
end if
if bottles == 1
printl "[bottles] bottle of beer on the wall, [bottles] bottle of beer. "
end if
sub bottles 1
if bottles > 1
print "You take one down pass it around, [bottles] bottles of beer on the wall."
end if
if bottles == 0
print "You take one down pass it around, no more bottles of beer on the wall!"
end if
if bottles == 1
print "You take one down pass it around, [bottles] bottle of beer on the wall."
end if
end while


The parser

atom/movable
var/tmp/hash = null


proc
Kscript(atom/user,data)

proc
Eval(_)
_ = Read_Vars(_)
. = eval({"var/data=[_];return data"})
upper(atom/A,value,list/Vars)
if(Vars.Find(value))
Vars[value] = uppertext(Vars[value])
else if(A.vars.Find(value))
A.vars[value] = uppertext(A.vars[value])
lower(atom/A,value,list/Vars)
if(Vars.Find(value))
Vars[value] = lowertext(Vars[value])
else if(A.vars.Find(value))
A.vars[value] = lowertext(A.vars[value])
Get_Var(atom/A,item,list/Vars)
if(Vars.Find(item))
return Vars[item]
else if(A.vars.Find(item))
return A.vars[item]
//
var/found = copytext(item,1,2)
switch(found)
if("\"")
item = Read_Vars(A,item,Vars)
return copytext(item,2,lentext(item))
if("0","1","2","3","4","5","6","7","8","9")
return text2num(item)
else return
Read_Vars(atom/A,data,list/Vars)
var/safe=32
. = 1
while(findtext(data,"\[",.))
if(!safe)break
safe--
var _1 = findtext(data,"\[",.)
var _2 = findtext(data,"]",_1+1)
var value = copytext(data,_1+1,_2)
if(findtext(value,"."))
var/Mid = findtext(value,".")
var/Get = copytext(value,1,Mid)
var/Var = copytext(value,Mid+1)
var/Item
if(Vars.Find(Get))
var/atom/M = Vars[Get]
if(M)
for(var/check in M.vars)
if(check==Var)
Item = M.vars[check]
break
if(Item)
data = copytext(data,1,_1)+"[Item]"+copytext(data,_2+1)
else
. = _1+1
if(A.vars.Find(Get))
var/atom/M = A.vars[Get]
if(M)
for(var/check in M.vars)
if(check==Var)
Item = M.vars[check]
break
if(Item)
data = copytext(data,1,_1)+"[Item]"+copytext(data,_2+1)
else
. = _1+1
else
if(Vars.Find(value))
data = copytext(data,1,_1)+"[Vars[value]]"+copytext(data,_2+1)
else if(A.vars.Find(value))
data = copytext(data,1,_1)+"[A.vars[value]]"+copytext(data,_2+1)
else
. = _1+1
return data

IsType(atom/user,item,list/Vars)
if(Vars.Find(item))
return Vars[item]
else if(user.vars.Find(item))
return user.vars[item]
var/found = copytext(item,1,2)
var/found_null = copytext(item,1,5)
if(found_null=="null")return "null"
switch(found)
if("\"")return "text"
if("0","1","2","3","4","5","6","7","8","9","-")return "num"
else return "error"
Error(data)
return "<b>Error</b>: <i>[data]</i>"
Debug(atom/User,data)
User<<"<b>DEBUG:</b> <u>[data]</u>"
Get_Lines(data)
. = 1
var/list/Lines=list()
while(findtext(data,"\n"))
var/got = copytext(data,1,findtext(data,"\n"))
while(copytext(got,1,2)==" "){got = copytext(got,2)}
Lines["[.]"]=got
data=copytext(data,findtext(data,"\n")+1)
.++
while(copytext(data,1,2)==" "){data = copytext(data,2)}
Lines["[.]"]=data
return Lines
/*Get_Lines5555(data)
. = 1
var/list/Lines=list()
while(findtext(data,"\n"))
Lines["[.]"]=copytext(data,1,findtext(data,"\n"))
data=copytext(data,findtext(data,"\n")+1)
.++
Lines["[.]"]=data
return Lines*/

proc
Parse(atom/user,data) //Function params
var
_debug=0
max_goto=10240
max_while=10240
max_for=10240
last_end_if=0
at_line=1
list/lines=Get_Lines(data)
list/Vars=list()
//
current_while=0
last_end_while=0
//
if_passed=0
current_if=0
//
stepping=1
for_at=0
for_end=0
current_for=0
last_end_for=0
last_end_prob=0
while(at_line<=lines.len)
var
new_data=lines["[at_line]"]
if(!new_data) //Allows spaces
at_line++
continue
while(new_data)
//world<<"#[at_line] , \..."
if(copytext(new_data,1,3)=="//")
at_line++
break
var function_found = findtext(new_data," ")
if(!function_found)
return Error("No function was found\nLine [at_line] - [new_data]")
var function = copytext(new_data,1,function_found)
var params = copytext(new_data,function_found+1)
switch(function)
if("set")
var space_1 = findtext(params," ")
var space_2 = findtext(params," ",space_1+1)
var VAR1 = copytext(params,1,space_1)
var VAR2 = copytext(params,space_1+1,space_2)
var NEW_VAR = copytext(params,space_2+1)
if(Vars.Find(VAR1))
var/atom/A = Vars[VAR1]
for(var/check in A.vars)
if(check==VAR2)
A.vars[VAR2] = Get_Var(user,NEW_VAR,Vars)
break

if("new")
var space = findtext(params," ")
if(!space)
return Error("No Variable was found\nLine [at_line] - [new_data]")
var tmp_name = copytext(params,1,space)
var tmp_obj = copytext(params,space+1)
if(tmp_obj)
var/A = text2path(tmp_obj)
if(ispath(A))
Vars[tmp_name] = new A
else
return Error("This path doesn't exist.\nLine [at_line] - [new_data]")
else
return Error("This path doesn't exist.\nLine [at_line] - [new_data]")
if("call")
var PROC
var PARAMS
var TMP
var space = findtext(params," ")
if(space)
TMP = copytext(params,1,space)
PROC = text2path(copytext(params,1,space))
PARAMS = copytext(params,space+1)
else
TMP = params
PROC = text2path(params)

if(!PROC)
return Error("Call path couldn't be found.\nLine [at_line] - [params]")
else
var A = copytext(TMP,1,11)
var B = copytext(TMP,1,7)
if(A=="/mob/verb/"||A=="/mob/proc/")
spawn(0.1)
call(PROC)(Get_Var(user,PARAMS,Vars))
else if(B=="/proc/")
spawn(0.1)
call(PROC)(Get_Var(user,PARAMS,Vars))
if("prob")
var/TMP = params
if(Vars.Find(TMP))
TMP = text2num(Vars[TMP])
else if(user.vars.Find(TMP))
TMP = text2num(user.vars[TMP])
else TMP = text2num(TMP)
if(prob(TMP))
at_line++
break
else
var/found_end=0
for(var/checking=last_end_prob to lines.len)
var _check = lines["[checking]"]
if(_check=="end prob")
at_line = checking
found_end=1
break
if(!found_end)
return Error("end prob couldn't be found.\nLine [at_line] - [params]")

if("DEBUG")
switch(params)
if("TRUE","1")
_debug=1
if("FALSE","0")
_debug=0
else
_debug=0
if("return")
return Get_Var(user,params,Vars)
if("for")
current_for = at_line
var A1 = findtext(params,"to")
var A2 = findtext(params,"step")
var TMP_VAR1 = copytext(params,1,A1-1)
var TMP_VAR2 = copytext(params,A1+3,A2-1)
var TMP_VAR3 = copytext(params,A2+5)
if(!A2)
TMP_VAR2 = copytext(params,A1+3)
TMP_VAR3 = 1
if(Vars.Find(TMP_VAR1))
TMP_VAR1 = text2num(Vars[TMP_VAR1])
else if(user.vars.Find(TMP_VAR1))
TMP_VAR1 = text2num(user.vars[TMP_VAR1])
else TMP_VAR1 = text2num(TMP_VAR1)

if(Vars.Find(TMP_VAR2))
TMP_VAR2 = text2num(Vars[TMP_VAR2])
else if(user.vars.Find(TMP_VAR2))
TMP_VAR2 = text2num(user.vars[TMP_VAR2])
else TMP_VAR2 = text2num(TMP_VAR2)

if(Vars.Find(TMP_VAR3))
TMP_VAR3 = text2num(Vars[TMP_VAR3])
else if(user.vars.Find(TMP_VAR3))
TMP_VAR3 = text2num(user.vars[TMP_VAR3])
else TMP_VAR3 = text2num(TMP_VAR3)
//

for_at = TMP_VAR1
for_end = TMP_VAR2
stepping = TMP_VAR3

world<<"[TMP_VAR1] to [TMP_VAR2] step [TMP_VAR3]"

if(stepping<=0)stepping=1

var/found_end=0
for(var/checking=last_end_for to lines.len)
var _check = lines["[checking]"]
if(_check=="end for")
found_end=1
break
if(!found_end)
return Error("end for couldn't be found.\nLine [at_line] - [params]")
if("abs")
var/NUM=0
if(Vars.Find(params))
NUM = text2num(Vars[params])
Vars[params] = abs(NUM)

else if(user.vars.Find(params))
NUM = text2num(user.vars[params])
user.vars[params] = abs(NUM)
else
return Error("A variable couldn't be found.\nLine [at_line] - [new_data]")
if("file2text")
if(copytext(params,1,2)=="\"")
return Error("Text strings can't be used here.\nLine [at_line] - [new_data]")
var space_1 = findtext(params," ")
var TMP_VAR = copytext(params,1,space_1)
//
var PATH
if(findtext(params,"\"",space_1+1))
var A = findtext(params,"\"",space_1+1)
var B = findtext(params,"\"",A+1)
PATH = Read_Vars(user,copytext(params,A+1,B),Vars)
else
var TMP_PATH = copytext(params,space_1+1)
PATH = Get_Var(user,TMP_PATH,Vars)
if(!TMP_VAR)
return Error("A variable couldn't be found.\nLine [at_line] - [new_data]")
if(!PATH)
return Error("A string/variable couldn't be found.\nLine [at_line] - [new_data]")
//
if(Vars.Find(TMP_VAR))
Vars[TMP_VAR] = file2text(PATH)
else if(user.vars.Find(TMP_VAR))
user.vars[TMP_VAR] = file2text(PATH)
else
return Error("Sending Failed.\nLine [at_line] - [params]")
if("text2file")
if(copytext(params,1,2)=="\"")
return Error("Text strings can't be used here.\nLine [at_line] - [new_data]")
var space_1 = findtext(params," ")
var TMP_VAR = copytext(params,1,space_1)
var VAR = Get_Var(user,TMP_VAR,Vars)
//
var PATH
if(findtext(params,"\"",space_1+1))
var A = findtext(params,"\"",space_1+1)
var B = findtext(params,"\"",A+1)
PATH = Read_Vars(user,copytext(params,A+1,B),Vars)
else
var TMP_PATH = copytext(params,space_1+1)
PATH = Get_Var(user,TMP_PATH,Vars)
if(!VAR)
return Error("A variable couldn't be found.\nLine [at_line] - [new_data]")
if(!PATH)
return Error("A string/variable couldn't be found.\nLine [at_line] - [new_data]")
//
text2file(VAR,PATH)
if("while")
if(!max_while)
return Error("While limit reached (128)\nLine [at_line] - [new_data]")
current_while = at_line
var space_1 = findtext(params," ")
var space_2 = findtext(params," ",space_1+1)
var VAR_1 = copytext(params,1,space_1)
var VAR = Get_Var(user,VAR_1,Vars)
var OP = copytext(params,space_1+1,space_2)
var COMPARE = Get_Var(user,copytext(params,space_2+1),Vars)
var/is_single=0
if(!space_2)is_single=1
var/passed=0
if(is_single)
if(copytext(params,1,2)=="!")
VAR_1 = copytext(params,2,space_1)
VAR = Get_Var(user,VAR_1,Vars)
if(VAR<=0)
passed=1
else
if(VAR>0)
passed=1
else switch(OP)
if("&&")
if(VAR&&COMPARE)
passed=1
if("||")
if(VAR||COMPARE)
passed=1
if("==")
if(VAR==COMPARE)
passed=1
if("%")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR%COMPARE)passed=1
if(">=")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR>=COMPARE)passed=1
if("<=")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR<=COMPARE)passed=1
if(">")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR>COMPARE)
passed=1
if("<")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR<COMPARE)passed=1
if("!=")
if(VAR!=COMPARE)passed=1
if("<>")
if(VAR<>COMPARE)passed=1
else
return Error("Unknown operator being used\nLine [at_line] - [params]")
if(passed)
at_line++
max_while--
if(_debug)Debug(user,"while: loop")
break
else
//sleep(1)
if(!last_end_while)
var/found_end=0
for(var/checking=last_end_while to lines.len)
var _check = lines["[checking]"]
if(_check=="end while")
at_line = checking+1
found_end=1
break
if(!found_end)
return Error("end while couldn't be found.\nLine [at_line] - [params]")

else
at_line = last_end_while+1
break
break
if("encode")
var/TMP = params
if(Vars.Find(TMP))
Vars[params] = html_encode(Vars[TMP])
else if(user.vars.Find(TMP))
user.vars[params] = html_encode(user.vars[TMP])
else
return Error("A variable couldn't be found.\nLine [at_line] - [params]")
if("decode")
var/TMP = params
if(Vars.Find(TMP))
Vars[params] = html_decode(Vars[TMP])
else if(user.vars.Find(TMP))
user.vars[params] = html_decode(user.vars[TMP])
else
return Error("A variable couldn't be found.\nLine [at_line] - [params]")
//
if("end")
switch(params)
if("if")
last_end_if=at_line
if_passed=0
current_if=0
at_line++
if(_debug)Debug(user,"end if: reached")
break
if("while")
last_end_while = at_line
at_line = current_while
if(_debug)Debug(user,"end while: reached")
break
if("all")
if(_debug)Debug(user,"end all: called")
return
if("for")
max_for--
if(!max_for)
return Error("For limit reached (128)\nLine [at_line] - [new_data]")
last_end_for = at_line
if(for_at>=for_end)
for_at=0
for_end=0
stepping=0
at_line++
else
for_at+=stepping
at_line = current_for+1
if(_debug)Debug(user,"end for: reached")
break
if("end prob")
last_end_prob = at_line
at_line++
if(_debug)Debug(user,"end prob: reached")
break
else
return Error("end [params] isn't supported.\nLine [at_line] - [params]")

if("copytext")
var space_1
var is_text=0
if(findtext(params,"\""))
//world<<"[params]"
var A = findtext(params,"\"")
var B = findtext(params,"\"",A+1)
space_1 = findtext(params," ",B+1)
is_text=1
else
space_1 = findtext(params," ")
var space_2 = findtext(params," ",space_1+1)
var space_3 = findtext(params," ",space_2+1)
var VAR_1 = copytext(params,1,space_1)
var VAR2 = copytext(params,space_1+1,space_2)
var VAR1 = is_text ? copytext(VAR_1,2,lentext(VAR_1)) : Get_Var(user,VAR_1,Vars)
var START = text2num(copytext(params,space_2+1,space_3))
var END = text2num(copytext(params,space_3))

//world<<"<B>ID = [VAR1] : [VAR2] : [START] : [END]"

var/SEND
if(END)
SEND=copytext(VAR1,START,END)
else
SEND=copytext(VAR1,START)
if(Vars.Find(VAR2))
Vars[VAR2]=SEND
else if(user.vars.Find(VAR2))
user.vars[VAR2]=SEND
else
return Error("Sending Failed.\nLine [at_line] - [params]")
if("sub")
var A = findtext(params," ")
var item = copytext(params,1,A)
if(Vars.Find(item))
if(istext(Vars[item]))Vars[item]=lentext(Vars[item])
Vars[item]-=Get_Var(user,copytext(params,A+1),Vars)
else if(user.vars.Find(item))
if(istext(user.vars[item]))user.vars[item]=lentext(user.vars[item])
user.vars[item]-=Get_Var(user,copytext(params,A+1),Vars)
else
return Error("Variable hasn't been created\nLine [at_line] - [params]")
if("addtext")
var space = findtext(params," ")
var VAR1 = copytext(params,1,space)
var VAR2 = copytext(params,space+1)
var TMP
if(Vars.Find(VAR2))
if(isnum(Vars[VAR2]))
TMP = num2text(Vars[VAR2])
else
TMP = Vars[VAR2]
else if(user.vars.Find(VAR2))
if(isnum(user.vars[VAR2]))
TMP = num2text(user.vars[VAR2])
else
TMP = user.vars[VAR2]
else
TMP = copytext(VAR2,2,lentext(VAR2))

if(Vars.Find(VAR1))
Vars[VAR1]+=Read_Vars(user,TMP,Vars)
else if(user.vars.Find(VAR1))
user.vars[VAR1]+=Read_Vars(user,TMP,Vars)
else
return Error("Variable hasn't been created\nLine [at_line] - [params]")

if("add")
var A = findtext(params," ")
var item = copytext(params,1,A)
if(Vars.Find(item))
if(istext(Vars[item]))Vars[item]=lentext(Vars[item])
Vars[item]+=Get_Var(user,copytext(params,A+1),Vars)
else if(user.vars.Find(item))
if(istext(user.vars[item]))user.vars[item]=lentext(user.vars[item])
user.vars[item]+=Get_Var(user,copytext(params,A+1),Vars)
else
return Error("Variable hasn't been created\nLine [at_line] - [params]")
if("mul")
var A = findtext(params," ")
var item = copytext(params,1,A)
if(Vars.Find(item))
if(istext(Vars[item]))Vars[item]=lentext(Vars[item])
Vars[item]*=Get_Var(user,copytext(params,A+1),Vars)
else if(user.vars.Find(item))
if(istext(user.vars[item]))user.vars[item]=lentext(user.vars[item])
user.vars[item]*=Get_Var(user,copytext(params,A+1),Vars)
else
return Error("Variable hasn't been created\nLine [at_line] - [params]")
if("div")
var A = findtext(params," ")
var item = copytext(params,1,A)
if(Vars.Find(item))
if(istext(Vars[item]))Vars[item]=lentext(Vars[item])
Vars[item]/=Get_Var(user,copytext(params,A+1),Vars)
else if(user.vars.Find(item))
if(istext(user.vars[item]))user.vars[item]=lentext(user.vars[item])
user.vars[item]/=Get_Var(user,copytext(params,A+1),Vars)
else
return Error("Variable hasn't been created\nLine [at_line] - [params]")
if("uppercase")
upper(user,params,Vars)
if("lowercase")
lower(user,params,Vars)
if("move")
switch(params)
if("1","NORTH") step(user,NORTH)
if("2","SOUTH") step(user,SOUTH)
if("4","EAST") step(user,EAST)
if("8","WEST") step(user,WEST)
if("5","NORTHEAST") step(user,NORTHEAST)
if("9","NORTHWEST") step(user,NORTHWEST)
if("6","SOUTHEAST") step(user,SOUTHEAST)
if("10","SOUTHWEST") step(user,SOUTHWEST)
else return Error("Direction doesn't exist\nLine [at_line] - [params]")
if(":")
at_line++
break
if("if") //if RUN == 1
current_if= at_line
last_end_if = at_line
var space_1 = findtext(params," ")
var space_2 = findtext(params," ",space_1+1)
var VAR_1 = copytext(params,1,space_1)
var VAR = Get_Var(user,VAR_1,Vars)
var OP = copytext(params,space_1+1,space_2)
var COMPARE = Get_Var(user,copytext(params,space_2+1),Vars)
//
var/is_single=0
if(!space_2)is_single=1
//world<<"##### [VAR]"
var/passed=0
if(_debug)Debug(user,"if: [VAR] [OP] [COMPARE]")
if(is_single)
if(copytext(params,1,2)=="!")
VAR_1 = copytext(params,2,space_1)
VAR = Get_Var(user,VAR_1,Vars)
if(VAR<=0)
passed=1
else
if(VAR>0)
passed=1

else
switch(OP)
if("&&")
if(VAR&&COMPARE)
passed=1
if("||")
if(VAR||COMPARE)
passed=1
if("==")
if(VAR==COMPARE)
passed=1
if("%")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR%COMPARE)passed=1
if(">=")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR>=COMPARE)passed=1
if("<=")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR<=COMPARE)passed=1
if(">")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR>COMPARE)passed=1
if("<")
if(istext(VAR))VAR = lentext(VAR)
if(istext(COMPARE))COMPARE = lentext(COMPARE)
if(VAR<COMPARE)passed=1
if("!=")
if(VAR!=COMPARE)passed=1
if("<>")
if(VAR<>COMPARE)passed=1
else
return Error("Unknown operator being used\nLine [at_line] - [params]")
//
var/found_end=0
for(var/checking=last_end_if to lines.len)
var _check = lines["[checking]"]
if(_check=="end if")
last_end_if = checking+1
found_end=1
break
if(!found_end)
return Error("end if couldn't be found.\nLine [at_line] - [params]")
//
                        if(passed)
if_passed=1
at_line++
break
else
var/found_else=0
for(var/checking=current_if to last_end_if)
var _check = lines["[checking]"]
if(_check=="else then")
at_line = checking
found_else=1
break
if(!found_else)
at_line = last_end_if
break

if("print")
switch(IsType(user,params,Vars))
if("text")
var output = Read_Vars(user,params,Vars)
user<<copytext(output,2,lentext(output))
if("num")
user<<"[params]"
if("error")
return Error("Unknown command being passed through print\nLine [at_line] - [params]")
else
user<<"[Get_Var(user,params,Vars)]"
if(_debug)Debug(user,"print: [params]")
if("printl")
switch(IsType(user,params,Vars))
if("text")
var output = Read_Vars(user,params,Vars)
user<<copytext(output,2,lentext(output))+"\..."
if("num")
user<<"[params]\..."
if("error")
return Error("Unknown command being passed through print\nLine [at_line] - [params]")
else
user<<"[Get_Var(user,params,Vars)]\..."
if(_debug)Debug(user,"printl: [params]")
if("sleep")
sleep(Get_Var(user,params,Vars))
if("goto")
if(!max_goto)
return Error("Goto limit reached (128)\nLine [at_line] - [new_data]")
var/found=0
for(var/checking=1 to lines.len)
var _check = lines["[checking]"]
if(copytext(_check,1,2)==":")
var A = copytext(_check,3)
if(A==params)
at_line = checking
last_end_if = checking
last_end_while = checking
found=1
max_goto--
break
if(!found)
return Error("Goto location wasn't found\nLine [at_line] - [params]")
break
if("input")
var space_0 = findtext(params," ")
var space_2 = findtext(params," as ")
var VAR = copytext(params,1,space_0)
var TMP
var DESC = copytext(params,space_0+2,space_2-1)
var TYPE = copytext(params,space_2+4)
world<<"ok([TYPE])"
switch(TYPE)
if("text") TMP = input(user,DESC,"Input{text}")as text
if("num") TMP = input(user,DESC,"Input{number}")as num
else return Error("This type isn't supported\nLine [at_line] - [params]")
if(Vars.Find(VAR))
Vars[VAR] = TMP
else if(user.vars.Find(VAR))
user.vars[VAR] = TMP
else
return Error("Variable hasn't been created\nLine [at_line] - [params]")
at_line++
break
if("switch","#","call","run")
return Error("This is a reserved keyword.\nLine [at_line] - [new_data]")
if("!","?","`","~","@","$","%","^","&","*","(",")","_","+","=","-","\[","{","}","]","\\","|",";","\"","\'","<",">",",",".","/"," ")
return Error("Unable to assign.\nLine [at_line] - [new_data]")
else
switch(function)
if("else")
if(params!="then")
return Error("else then couldn't be found.\nLine [at_line] - [params]")
if(!if_passed)
at_line++
else
var/found_end=0
var _check = lines["[last_end_if-1]"]
if(_check=="end if")
at_line = last_end_if
found_end=1
break
if(!found_end)
return Error("end if couldn't be found.\nLine [at_line] - [params]")
break
if(copytext(params,1,5)=="rand")
params = copytext(params,6)
var
A = copytext(params,1,findtext(params," "))
B = copytext(params,findtext(params," ")+1)
//
if(user.vars.Find(A))A = text2num(user.vars[A])
else if(Vars.Find(A))A = text2num(Vars[A])
else A = text2num(A)
if(user.vars.Find(B))B = text2num(user.vars[B])
else if(Vars.Find(B))B = text2num(Vars[B])
else B = text2num(B)
//
if(!B&&!A)
return Error("Both values can't be null or 0\nLine [at_line] - [params]")
Vars[function]=rand(A,B)
at_line++
break
switch(IsType(user,params,Vars))
if("text")
if(user.vars.Find(function))
var/TMP = copytext(params,2,lentext(params))
TMP = Read_Vars(user,TMP,Vars)
user.vars[function] = TMP
else
var/TMP = copytext(params,2,lentext(params))
TMP = Read_Vars(user,TMP,Vars)
Vars[function] = TMP
if("num")
if(user.vars.Find(function))
user.vars[function] = text2num(params)
else
Vars[function] = text2num(params)
if("error")
return Error("Unknown var type\nLine [at_line] - [params]")
if("null")
if(user.vars.Find(function))
user.vars[function] = null
else
Vars[function] = null
else
if(user.vars.Find(function))
user.vars[function] = Get_Var(user,params,Vars)
else
Vars[function] = Get_Var(user,params,Vars)
at_line++
break
Lmao.
It is on a very rare occasion one has a function that long and is not doing something tremendously wrong. You have not happened upon one of those situation.
In response to Popisfizzy
Popisfizzy wrote:
It is on a very rare occasion one has a function that long and is not doing something tremendously wrong. You have not happened upon one of those situation.

xD I made this and a bit more in a week with no internet around 3 or 4 years ago.

Being the first time it allowed me to see what I needed to work around if I was to build it from scratch again and again improving each time.

Makes it alot easier to understand how to do things :)
[12:29:27 PM] Kozuma3: So I thought about AI in DM and I came up with an idea
[12:30:01 PM] Kozuma3: of replicating the map on another Z level and doing the actions there first and the results effect the real map
[12:30:13 PM] Kozuma3: So in a way the AI could look "forward"
[12:30:16 PM] Kozuma3: idk
In response to Kozuma3
Why would you have a concrete representation when an abstract representation would work equally well with fewer resources? On top of that, that idea is already in use: chess AI works by looking ahead at possible child nodes in the game tree of the current state in the board and taking the approach that it finds most optimal. Thus, it looks forward a number of steps at and finds the choice it "feels" is best.
In response to Popisfizzy
Popisfizzy wrote:
Why would you have a concrete representation when an abstract representation would work equally well with fewer resources?

Would have to write my own Bump and such procs causing more overhead than needed.

On top of that, that idea is already in use: chess AI works by looking ahead at possible child nodes in the game tree of the current state in the board and taking the approach that it finds most optimal. Thus, it looks forward a number of steps at and finds the choice it "feels" is best.

Yea, but while doing such could find and mark paths that would allow other AI to do such actions following the results making it so you'd only need to run it when needed.
In response to Kozuma3
Kozuma3 wrote:
Would have to write my own Bump and such procs causing more overhead than needed.

There are still ways of doing it other than recreating the entire map, doubling your memory and CPU footprint. You simply have to be a tiny bit creative.

Yea, but while doing such could find and mark paths that would allow other AI to do such actions following the results making it so you'd only need to run it when needed.

Caching or precomputing. Use them.
In response to Popisfizzy
Popisfizzy wrote:
There are still ways of doing it other than recreating the entire map, doubling your memory and CPU footprint. You simply have to be a tiny bit creative.

Nothing would be as efficient and I could easily modify this further and to allow for more than just Bump() ^^

Caching or precomputing. Use them.

idk how or wat those exactly are, I just make stuff

In response to Kozuma3
4/20 yesterday, no relation.

I had a random thought, would it be possible to somehow use multiple dream servers/dd's to host a single server to pass the single core limit? o-o

Like you could sync then up via a config file from a master one or something idk
I wonder what would happen if you used Distributed_Computing with Precomputation for AI to act leik different parts of the brain or soffin.
Man thinking is hard :( kek
Lol, Popisfizzy.
Page: 1 2 3 4