BOS(Build Order System)
I made this plugin to help organize the build structure inside an RTS game.
The commands help you set up a hierarchy system as shown in the picture. Other commands let you know what is available and what is currently active. Available would mean that you are allowed to build a "war factory", but if "active" is 0, it means it has not yet been built and therefore its children cannot be accessed.
Bugs:
When deactivating a node, it's children remain active.
keywords.ini
ADD NODE=main.htm=(Node name, Level, Active state)
ADD NODE LINK=main.htm=(Node name, parent name)
IS NODE ACCESSIBLE=main.htm=(Node name)
IS NODE ACTIVE=main.htm=(Node name)
SET NODE ACTIVE=main.htm=(Node name, Active state)
Example
n=add node("thing 1",0,1)
n=add node("thing 2",0,0)
n=add node("farm",0,0)
n=add node("barracks",0,0)
n=add node("war factory",0,0)
n=add node("farm upgrade",0,0)
n=add node("satellite",0,0)
n=add node("tank",0,0)
n=add node("something else",0,0)
n=add node link("farm","thing 1")
n=add node link("barracks","thing 1")
n=add node link("war factory","thing 2")
n=add node link("farm upgrade","farm")
n=add node link("satellite","barracks")
n=add node link("satellite","war factory")
n=add node link("tank","war factory")
n=add node link("something else","farm upgrade")
n=add node link("something else","satellite")
n=set node active("thing 2",1)
n=set node active("farm",1)
Global _click = 0
Global _flag = 0
sync on
repeat
cls
set cursor 0 ,0
_click = mouseclick()
if _click = 0 then _flag = 0
drawBox(100,5,"thing 1")
drawBox(400,5,"thing 2")
drawBox(40,100,"farm")
drawBox(130,100,"barracks")
drawBox(400,100,"war factory")
drawBox(30,200,"farm upgrade")
drawBox(220,200,"satellite")
drawBox(450,200,"tank")
drawBox(70,300,"something else")
drawDependencies()
sync
until spacekey()
function drawBox(x as integer, y as integer,name as string)
color as dword
state = is node active(name)
length = text width(name)
if (is node accessible(name) = 1)
if _click = 1 and _flag = 0
if mousex()>x and mousex()<x+length+10 and mousey()>y and mousey()<y+30
_flag = 1
if state = 1
state = 0
else
state = 1
endif
n=set node active(name,state)
endif
endif
if state = 1
color = rgb(100,200,0)
else
color = rgb(100,100,0)
endif
else
color = rgb(100,0,0)
endif
ink color,0
box x,y,x+length+10,y+30
ink rgb(255,255,255),0
text x+5,y,name
text x+5,y+10,"active:"+str$(state)
endfunction
function drawDependencies()
line 126,34,58,99
line 126,34,160,99
line 430,34,446,99
line 58,129,72,199
line 160,129,258,199
line 446,129,258,199
line 446,129,470,199
line 72,229,125,299
line 258,229,125,299
endfunction
"eureka" - Archimedes