Forum

> > CS2D > Scripts > Lua Update Suggestion
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Update Suggestion

12 replies
To the start Previous 1 Next To the start

Poll Poll

Do you need this function?

Only registered users are allowed to vote
Yes
77.78% (7)
No
22.22% (2)
9 votes cast

old Poll Lua Update Suggestion

sixpack
User Off Offline

Quote
Hello there fellow Lua scripters.
I was scripting for the NFS Server last night and i thought it would be a lot easier for lua coders if menu's did not have a maximum size of 9 items, but they have unlimited items, and they were automatically sorted in Pages of 8 + 1 [More Button]. So you normally send a menu with 17 items, and it shows up 8+1 in first page and 9 in the second. It would be easier at least to show arrays in the menu. It is possible now, but it will take a lot of coding for no reason.
What do you think?

P.S.: Menus shall be handled on the same title, and with more selections. So in the menu hook, you just use
1
if(selection==95)then

old Re: Lua Update Suggestion

DC
Admin Off Offline

Quote
yeah just write a small function which automates this process. shouldn't be very hard.

so that you end up with a simple function which takes an array with unlimited entries as parameter for the buttons.

old Re: Lua Update Suggestion

Infinite Rain
Reviewer Off Offline

Quote
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
table = {'hi', 'bye', 'yo', 'sup', 'bb', 'BYOTCH', ':D'}

function open_inf_menu(id)
	if player(id, 'health') ~= 0 then
		local m = 'Select Word P1'
		local d = math.ceil(#table / 7)
		for p = 1, 7 do
			if table[p] ~= nil then
				m = m .. ', '.. table[p]
			else
				m = m .. ','
			end
		end
		if d == 1 then
			m = m ..',( Next Page -->),( <-- Prev Page)'
		else
			m = m ..', Next Page -->,( <-- Prev Page)'
		end
		menu(id, m)
	end
end

addhook('menu', 'menu')
function menu(id, title, button)
	if title:sub(1, 13) == 'Select Word P' then
		local h = tonumber(title:sub(14))
		if button == 8 then
			h = h + 1
			local m = 'Select Word P' .. h
			local d = math.ceil(#table / 7)
			for p = 7 * h - 6, 7 * h do
				if table[p] ~= nil then
					m = m .. ', '.. table[p]
				else
					m = m .. ','
				end
			end
			if d == h then
				m = m ..',( Next Page -->), <-- Prev Page'
			else
				m = m ..', Next Page -->, <-- Prev Page'
			end
			menu(id, m)
		elseif button == 9 then
			h = h - 1
			local m = 'Select Word P' .. h
			local d = math.ceil(#table / 7)
			for p = 7 * h - 6, 7 * h do
				if table ~= nil then
					m = m .. ', '.. table[p]
				else
					m = m .. ','
				end
			end
			if h == 1 then
				m = m ..', Next Page -->,( <-- Prev Page)'
			else
				m = m ..', Next Page -->, <-- Prev Page'
			end
			menu(id, m)
		else
			msg2(id, table[7 * h - 7 + button])
		end
	end
end

My script will make ur life easier

old Re: Lua Update Suggestion

Flacko
User Off Offline

Quote
I also believe that browsing through paginated menus isn't very comfortable.
The scrollbar idea is good, but somehow, not good enough

old Re: Lua Update Suggestion

Apache uwu
User Off Offline

Quote
user Flacko has written
I also believe that browsing through paginated menus isn't very comfortable.
The scrollbar idea is good, but somehow, not good enough


It's called organization. If you can add all the required items in a submenu that should solve your problems.

Scrolling sounds cool

I approve √
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview