In response to Kozuma3
My eyes T.T
In response to GreatPirateEra
What's wrong with them?
Something I started on tonight, moved recently and have a shittop so \shrug
I know it can be improved but I'm posting what I have for now.
There is some code that's like wtf but I'm tinkering with stuff :P
#define SLOTH 40
#define VERY_SLOW 32
#define SLOW 24
#define NORMAL 16
#define FAST 8
#define VERY_FAST 4
#define INSANE 2

var config/game

world/New()
sleep(10)
game = new/config
world << "Items = [game.items.len]"

weapons/proc
onAttack()
armors/proc
onHit()

config
var list/items,list/item_ids
var __
New()
items = list()
item_ids = list()
. = typesof(/preload) - /preload
for(__ in .){load(copytext("[__]",10))}
for(__ in items){item_ids[__:name] = __}
proc
load(s,A1,A2)
world << "s: [s]"
var p,pp,ppp,list/l,list/ll,list/lll,_,t,o,r
_ = text2path("/[s]/teirs")
l = typesof(_) - _
for(p in l)
t = new p
_ = text2path("/[s]/rarity")
ll = typesof(_) - _
for(pp in ll)
r = new pp
_ = text2path("/[s]/objects")
lll = typesof(_) - _
for(ppp in lll)
o = new ppp
if(A1) o:vars[A1] += (t:vars[A1] + r:vars[A1])
if(A2) o:vars[A2] += (t:vars[A2] + r:vars[A2])
if(r:name)
o:name = "[r:name] [t:name] [o:name]"
else if(t:name)
o:name = "[t:name] [o:name]"
items += o
world << "[o:name]"

preload
weapons
armors
weapons
New(){}
var name
var dmg
var acc
var spd
rarity
Default {name = null ;dmg = 0 ;acc = 0}
teirs
Bronze {name = "Bronze" ;dmg = 0 ;acc = 2}
Iron {name = "Iron" ;dmg = 1 ;acc = 4}
Steel {name = "Steel" ;dmg = 3 ;acc = 8}
Mythril {name = "Mythril" ;dmg = 6 ;acc = 12}
objects
Dagger {name = "Dagger" ;dmg = 1 ;acc = 10 ;spd = FAST}
Hatchet {name = "Hatchet" ;dmg = 1 ;acc = 25 ;spd = NORMAL}
ShortSword {name = "Short-Sword" ;dmg = 2 ;acc = 35 ;spd = NORMAL}
LongSword {name = "Long-Sword" ;dmg = 3 ;acc = 25 ;spd = NORMAL}
Scimitar {name = "Scimitar" ;dmg = 2 ;acc = 20 ;spd = FAST}
Halberd {name = "Halberd" ;dmg = 4 ;acc = 25 ;spd = NORMAL}
Twohander {name = "Twohander" ;dmg = 4 ;acc = 45 ;spd = SLOW}
special_objects
BoneDagger
name = "Bone Dagger"
dmg= 3
acc= 16
armors
New(){}
var name
var def
rarity
Default {name = null ;def = 0}
teirs
Bronze {name = "Bronze" ;def = 0}
Iron {name = "Iron" ;def = 1}
Steel {name = "Steel" ;def = 2}
Mythril {name = "Mythril" ;def = 4}
objects
Boots {name = "Boots" ;def = 1}
Gloves {name = "Gloves" ;def = 1}
Helm {name = "Full-Helm" ;def = 2}
Chainmail {name = "Chainmail" ;def = 2}
Platelegs {name = "Platelegs" ;def = 2}
Platebody {name = "Platebody" ;def = 3}

Edit: Output
s: weapons
Bronze Dagger
Bronze Hatchet
Bronze Short-Sword
Bronze Long-Sword
Bronze Scimitar
Bronze Halberd
Bronze Twohander
Iron Dagger
Iron Hatchet
Iron Short-Sword
Iron Long-Sword
Iron Scimitar
Iron Halberd
Iron Twohander
Steel Dagger
Steel Hatchet
Steel Short-Sword
Steel Long-Sword
Steel Scimitar
Steel Halberd
Steel Twohander
Mythril Dagger
Mythril Hatchet
Mythril Short-Sword
Mythril Long-Sword
Mythril Scimitar
Mythril Halberd
Mythril Twohander
s: armors
Bronze Boots
Bronze Gloves
Bronze Full-Helm
Bronze Chainmail
Bronze Platelegs
Bronze Platebody
Iron Boots
Iron Gloves
Iron Full-Helm
Iron Chainmail
Iron Platelegs
Iron Platebody
Steel Boots
Steel Gloves
Steel Full-Helm
Steel Chainmail
Steel Platelegs
Steel Platebody
Mythril Boots
Mythril Gloves
Mythril Full-Helm
Mythril Chainmail
Mythril Platelegs
Mythril Platebody
Items = 52
Updated
#define SLOTH 40
#define VERY_SLOW 32
#define SLOW 24
#define NORMAL 16
#define FAST 8
#define VERY_FAST 4
#define INSANE 2

var config/game

world/New()
sleep(10)
game = new/config
world << "Items = [game.items.len]"

config
var list/items
var __
New()
items = list();. = typesof(/preload) - /preload
for(__ in .){load(copytext("[__]",10))}
proc
load(s)
var p,list/l,list/ll,list/lll,_,t,o,r
_ = text2path("/[s]/teirs")
l = typesof(_) - _
for(p in l)
t = new p
_ = text2path("/[s]/rarity")
ll = typesof(_) - _
for(p in ll)
r = new p
_ = text2path("/[s]/objects")
lll = typesof(_) - _
for(p in lll)
o = new p
if(r:name) o:name = "[r:name] [t:name] [o:name]"
else if(t:name) o:name = "[t:name] [o:name]"
world << "[o:name]"
for(__ in o:include){o:vars[__] += (t:vars[__] + r:vars[__])}
items += o

preload
weapons
armors
weapons
New(){}
var list/include = list("dmg","acc")
var name
var dmg
var acc
var spd
rarity
Default {name = null ;dmg = 0 ;acc = 0}
teirs
Bronze {name = "Bronze" ;dmg = 0 ;acc = 2}
Iron {name = "Iron" ;dmg = 1 ;acc = 4}
Steel {name = "Steel" ;dmg = 3 ;acc = 8}
Mythril {name = "Mythril" ;dmg = 6 ;acc = 12}
objects
Dagger {name = "Dagger" ;dmg = 1 ;acc = 10 ;spd = FAST}
Hatchet {name = "Hatchet" ;dmg = 1 ;acc = 25 ;spd = NORMAL}
ShortSword {name = "Short-Sword" ;dmg = 2 ;acc = 35 ;spd = NORMAL}
LongSword {name = "Long-Sword" ;dmg = 3 ;acc = 25 ;spd = NORMAL}
Scimitar {name = "Scimitar" ;dmg = 2 ;acc = 20 ;spd = FAST}
Halberd {name = "Halberd" ;dmg = 4 ;acc = 25 ;spd = NORMAL}
Twohander {name = "Twohander" ;dmg = 4 ;acc = 45 ;spd = SLOW}
special_objects
BoneDagger
name = "Bone Dagger"
dmg= 3
acc= 16
armors
New(){}
var list/include = list("def")
var name
var def
rarity
Default {name = null ;def = 0}
teirs
Bronze {name = "Bronze" ;def = 0}
Iron {name = "Iron" ;def = 1}
Steel {name = "Steel" ;def = 2}
Mythril {name = "Mythril" ;def = 4}
objects
Boots {name = "Boots" ;def = 1}
Gloves {name = "Gloves" ;def = 1}
Helm {name = "Full-Helm" ;def = 2}
Chainmail {name = "Chainmail" ;def = 2}
Platelegs {name = "Platelegs" ;def = 2}
Platebody {name = "Platebody" ;def = 3}
Battle stuff for the above, I have a idea on how to improve it and include speed into the mix. :P
mob
Login()
init()
slots["Offhand"] = game.items[3]
battle(list(src),list(new/mob))

var hitpoints = 100
var max_hitpoints = 100
var list/slots

proc
init()
slots = list(
"Offhand" = null,
"Feet" = null,
"Hands" = null,
)

proc/battle(list/A,list/B)
var list/C,list/E,mob/M,turn = rand(0,1)
for()
sleep(10)
turn = !turn
switch(turn)
if(0){C=A;E=B}
else {C=B;E=A}
for(M in C){M.Attack(pick(E))}

mob/proc/Attack(mob/T)
var D = calc("dmg")
T.hitpoints -= D
world << "[name] hit [T] for [D]"

mob/proc/calc(S)
var s,o
. = rand(0,1)
for(s in slots)
o = slots[s]
if(o && (S in o:vars)){.+=o:vars[S]}
Modified to allow for speed to be a factor.
mob
Login()
init()
slots["Offhand"] = game.items[3]
battle(list(src),list(new/mob))

var hitpoints = 100
var max_hitpoints = 100
var attack_cooldown = 0
var list/slots

proc
init()
slots = list(
"Offhand" = null,
"Feet" = null,
"Hands" = null,
)

proc/battle(list/A,list/B)
var mob/M,C = A + B
for(M in C){M.attack_cooldown = M.calc("spd")}
for()
sleep(1)
for(M in C)
M.attack_cooldown --
if(!M.attack_cooldown)
M.attack_cooldown = M.calc("spd")
if(M in A) M.Attack(pick(B))
else M.Attack(pick(A))

mob/proc/Attack(mob/T)
var D = calc("dmg") - T.calc("def")
T.hitpoints -= D
world << "[name] hit [T] for [D]"

mob/proc/calc(S)
var s,o
. = 0
for(s in slots)
o = slots[s]
if(o && (S in o:vars)){.+=o:vars[S]}
if(!.)
switch(S)
if("dmg")
. = rand(0,1)
if("spd")
. = NORMAL
In response to Kozuma3
Kozuma3 wrote:

Been thinking up a syntax.

v 1  // var[1] = 1
v 4 // var[2] = 4
v // var[3] = null / empty
v a 1 // var[4] becomes the 1st argument, possibily from a input
1 (1+2) // sets var[1] to (var[1] + var[2]) --> var[1] = 5
2 (1*1) // sets var[2] to (var[1] * var[1]) --> var[2] = 25
3 (1+2) // sets var[3] to (var[1] + var[2]) --> var[3] = 30
p 4 // prints var[4]
r 3 // returns 3


Inspired by Bandock, going to create a scripting language for it after I flesh out all the features.
Syntax I've made for it.

intro_a = text : intro : "#555555" : "5:8,9" : "kHud2.0"
intro_b = text : intro : "#666666" : "3:20,8:16" : "Created by Kozuma3"
mainmenu_a = text : main_menu : "#555555" : "1:4,9" : "Main Menu"
mainmenu_b = text : main_menu : "#666666" : "1:16,8:16" : "WIP, still much to do."
new_game = button : main_menu : "#000000" : "2,7:24" : "New Game"
load_game = button : main_menu : "#000000" : "2,7:6" : "Load Game"

intro_a pop 5
intro_b pop 15
sleep 20
intro fade 10
sleep 10
main_menu pop 5
The above syntax does exactly what the dm code above that does and produces.

mob/proc/khudParser(string)
var a,b,list/strings,list/parents
strings = list()
parents = list()
while(findtext(string,"\""))
a = findtext(string,"\"")
b = findtext(string,"\"",a+1)
if(b)
strings["[strings.len+1]"] = copytext(string,a+1,b)
string = copytext(string,1,a) + " [strings.len] " + copytext(string,b+1)
else break
string = replacetext(string," "," ")
var/list/lines = splittext(string,"\n"),list/cmds,length,cmd,khud/K,khud/O
for(. in lines)
cmds = splittext(.," ")
for(. in cmds){if(!.){cmds -= .}}
length = cmds.len
START
var pos = 1
for(. = pos to length)
cmd = cmds[.]
switch(cmd)
if("=")
switch(cmds[. + 1])
if("text")
K = new/khud/Text(client)
a = cmds[. + 3]
b = cmds[. - 1]
if(isnull(parents[a])){parents[a] = list()}
parents[a] |= b
K.color = strings[cmds[. + 5]]
K.screen_loc = strings[cmds[. + 7]]
K.edit(strings[cmds[. + 9]])
client.hud[b] = K
if("button")
K = new/khud/Button(client)
a = cmds[. + 3]
b = cmds[. - 1]
client.hud["[b]-text"] = list()
parents[a] |= b
world << "Added [b] to [a]"
K.screen_loc = strings[cmds[. + 7]]
if(cmds.len >= 9)
O = new/khud/Text(client)
O.edit(strings[cmds[. + 9]])
O.screen_loc = K.screen_loc
client.hud["[b]-text"] = O
parents[a] |= "[b]-text"
world << "MADE BUTTON [O.width] [a]"
K.showborder(O.width)
O.mouse_opacity = 0
O.color = strings[cmds[. + 5]]
K.mouse_opacity = 1
client.hud[b] = K
if("pop")
a = cmds[. - 1]
b = text2num(cmds[. + 1])
if(a in client.hud)
K = client.hud[a]
K.pop(b)
else if(a in parents)
var/list/l = parents[a]
for(a in l)
K = client.hud[a]
world << "WTF? [K]"
if(K)
K.pop(b)
if("fade")
a = cmds[. - 1]
b = text2num(cmds[. + 1])
if(a in client.hud)
K = client.hud[a]
K.fade(b)
else if(a in parents)
var/list/l = parents[a]
for(a in l)
K = client.hud[a]
K.fade(b)
if("sleep")
sleep(text2num(cmds[.+1]))
if(1)
// DEBUG
world << "DEBUG\[<font color=green>ON</font>]"
var/list/l
for(. in parents)
l = parents[.]
world << "Parent: [.]"
for(. in l)
world << " child: [.]"
for(. in client.hud)
world << "kHud: [.]"
else
world << "DEBUG\[<font color=red>OFF</font>]"
Idea I had earlier today, instead of compiling the images in, you could decode a hash that created the image using some kind of drawing script or w/e so that at run-time it would load the images from the hash so they're only stored dynamically or w/e o:
Page: 1 2 3 4