VisualLua [v1.3] 
119 comments Some of you have probably noticed that CS2D has few UI functions. It's not enough for me, so I decided to make UI functions myself. And therefore, behold - the VisualLua mod!
Sorry everyone, the window creating function was absent in the uploaded version! Thanks to
tom282f3 for pointing that out. Updated now.
Features:
Create UI elements - windows, buttons, text
Customize them any way you want - style sheet tables
Hover and click states for buttons
Assign ANY Lua functions to buttons - they will be executed on button click
Documentation about style sheet tables is INSIDE the archive in a txt file. Read it if you want to add your own styles.
Comments about usage of functions and their arguments are in the script before every function.
Write anything that's not clear to you in the comments - I'll gladly explain.
Video preview: http://www.youtube.com/watch?v=WKPjjVrtNog
Style tables documentation:
Examples of usage:
EDIT 1: If box versions of this are ever to be released, then they'll probably look like the third image
Download, rate and comment, but most importantly - have fun.
Sorry everyone, the window creating function was absent in the uploaded version! Thanks to

Features:




Documentation about style sheet tables is INSIDE the archive in a txt file. Read it if you want to add your own styles.
Comments about usage of functions and their arguments are in the script before every function.
Write anything that's not clear to you in the comments - I'll gladly explain.
Video preview: http://www.youtube.com/watch?v=WKPjjVrtNog
Style tables documentation:
Examples of usage:
EDIT 1: If box versions of this are ever to be released, then they'll probably look like the third image

Download, rate and comment, but most importantly - have fun.
edited 6×, last 10.03.15 02:48:50 pm

Comments
119 commentsLog in!
You need to log in to be able to write comments!Log in
something error when combine it with Serveraction
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
LUA ERROR: sys/lua/vl.lua:260: attempt to concatenate local 'b' (a nil value)
-> sys/lua/vl.lua:260: in function 'colorcode'
-> sys/lua/vl.lua:239: in function 'createButton'
-> sys/lua/1.lua:8: in function <sys/lua/1.lua:3>
-> in Lua hook 'serveraction', params: 1, 3
1
1
LUA ERROR: sys/lua/vl.lua:260: attempt to concatenate local 'b' (a nil value)
-> sys/lua/vl.lua:260: in function 'colorcode'
-> sys/lua/vl.lua:239: in function 'createButton'
-> sys/lua/1.lua:8: in function <sys/lua/1.lua:3>
-> in Lua hook 'serveraction', params: 1, 3
-> sys/lua/vl.lua:260: in function 'colorcode'
-> sys/lua/vl.lua:239: in function 'createButton'
-> sys/lua/1.lua:8: in function <sys/lua/1.lua:3>
-> in Lua hook 'serveraction', params: 1, 3
1
1
LUA ERROR: sys/lua/vl.lua:260: attempt to concatenate local 'b' (a nil value)
-> sys/lua/vl.lua:260: in function 'colorcode'
-> sys/lua/vl.lua:239: in function 'createButton'
-> sys/lua/1.lua:8: in function <sys/lua/1.lua:3>
-> in Lua hook 'serveraction', params: 1, 3

WOW its COOL
im love this , i love robots too i love all robots and look like robots
i like it

i like it

@
Gajos: We've got a badass here. Go, learn Engin33r how he should script.
---
Edit (after
Gajos's edit):
And I really think that your Internet connection speed is 7,2Mb/s, not 7,2MB/s.

---
Edit (after

Quote:
110 kb or 11kB? Something is wrong here.10 kB * 11 vars = 110 kb + 1,7 kB * 3 = 15,1 kB
And I really think that your Internet connection speed is 7,2Mb/s, not 7,2MB/s.
edited 1×, last 23.08.13 11:08:36 pm

Do you know why your visual lua lagging?
1024B = 1kB
so
If ten people use this then
10 * 1kB = 10kB
10 kB * 11 vars = 110 kb + 1,7 kB * 3 = 150,1 kB
My internet is 7,2MB / sec
idk why this lagging.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
addhook("clientdata","vl.read")
function vl.read(ply,type,a1,a2)
if type==0 then
for buttons=1,1024 do
if (not player(ply,"bot")) then
if (a1>=vl.buttonpos[buttons][1]-vl.buttonsize[buttons][1]/2 and a1<=vl.buttonpos[buttons][1]+vl.buttonsize[buttons][1]/2 and a2>=vl.buttonpos[buttons][2]-vl.buttonsize[buttons][2]/2 and a2<=vl.buttonpos[buttons][2]+vl.buttonsize[buttons][2]/2) then
--if (vl.buttonply[buttons]==ply) then
vl.hoverButton(buttons,ply)
--end
else
--if (vl.buttonply[buttons]==ply) then
vl.dehoverButton(buttons,ply)
--end
end
end
end
end
end
addhook("ms100","vl.send")
function vl.send()
for ply=1,32 do
if (player(ply,"exists")) then
reqcld(ply,0)
end
end
end
function vl.read(ply,type,a1,a2)
if type==0 then
for buttons=1,1024 do
if (not player(ply,"bot")) then
if (a1>=vl.buttonpos[buttons][1]-vl.buttonsize[buttons][1]/2 and a1<=vl.buttonpos[buttons][1]+vl.buttonsize[buttons][1]/2 and a2>=vl.buttonpos[buttons][2]-vl.buttonsize[buttons][2]/2 and a2<=vl.buttonpos[buttons][2]+vl.buttonsize[buttons][2]/2) then
--if (vl.buttonply[buttons]==ply) then
vl.hoverButton(buttons,ply)
--end
else
--if (vl.buttonply[buttons]==ply) then
vl.dehoverButton(buttons,ply)
--end
end
end
end
end
end
addhook("ms100","vl.send")
function vl.send()
for ply=1,32 do
if (player(ply,"exists")) then
reqcld(ply,0)
end
end
end
1024B = 1kB
so
If ten people use this then
10 * 1kB = 10kB
10 kB * 11 vars = 110 kb + 1,7 kB * 3 = 150,1 kB
My internet is 7,2MB / sec
idk why this lagging.
edited 4×, last 23.08.13 11:18:03 pm
@
Noname12345 -GER-: What sort of USGN authorisation are you talking about? This is an interface library.
You can see the examples to get an answer to your other question.

You can see the examples to get an answer to your other question.