Page 2 of 2

Posted: Wed Nov 12, 2014 11:34 am
by 8guawong
Ayuto wrote:No, currently there isn't, but you can create your own timeout by delay-calling <your menu>.close() after sending it.


ic thanks!

Posted: Tue Nov 18, 2014 2:01 pm
by 8guawong

Syntax: Select all

from players.helpers import index_from_userid
from events import Event
from menus import SimpleMenu
from menus import Option
from menus import Text
from listeners.tick import tick_delays

def test_select_callback(menu, ply_index, option):
return

test_menu = SimpleMenu()
test_menu.append(Text('test'))

test_menu.select_callback = test_select_callback

@Event
def player_death(game_event):
userid = game_event.get_int('userid')
index = index_from_userid(userid)
test_menu.send(index)
tick_delays.delay(5, test_menu.close())


like this??

does this close all the menu that was sent to the user??????

if it does how do you close a specific user's menu?

Posted: Tue Nov 18, 2014 2:17 pm
by Ayuto
No that would close the menu instantly for all users. You would do something like this.

Syntax: Select all

# ...
tick_delays.delay(5, test_menu.close, index)
But you also need to cancel the delay if the player left the server. Otherwise you will probably get ValueErrors.

Re: A menus package is now available!

Posted: Sun Aug 14, 2016 8:35 pm
by arawra
Is 'Option' no longer a part of the menus package?

Re: A menus package is now available!

Posted: Sun Aug 14, 2016 8:47 pm
by iPlayer
There're SimpleOption, PagedOption and ListOption

Re: A menus package is now available!

Posted: Mon Oct 10, 2016 12:14 am
by velocity
When sending a menu to the player through a command and then the player select an option that makes another menu popup. If I then type the command again, it does not send the first menu, it just stays on your current menu

Re: A menus package is now available!

Posted: Mon Oct 10, 2016 4:30 am
by arawra
That's correct. If you want to remove the open menu, you'll need to add that functionality in yourself to close the already open menu.