Autofilling a message window possible?


(-999-) #1

I’m creating some new menus for a couple of my clan’s servers, but I’ve run into a problem. I’m not a programmer/coder, but am trying to learn what I need so the may be obvious or obviously no.

Anyways, I want to make an admin menu, where admin’s can both see the formatting and use of commands (one server’s running jaymod, the other etpub). So I tried something like this:

BUTTON( 6, 32, .5*(WINDOW_WIDTH-18), 14, "PUTTEAM", .24, 11, open ingame_messagemode ; exec "cmd !putteam" )

To my suprise it both opens a messagebox and lists off the command values (!putteam [name][#] etc) just as it would if you typed it and entered it without adding name/switches. What’d I’d like to do is make it so that when you hit the button, it both tells you the context of the command as above, but also fills it into the messagebox so they only have to add name and switch.

If anyone can give me some help or even a “that is completely impossible and you’re stupid for asking it” response, it’d be greatly appreciated. :smiley:

Thanks


(-999-) #2

No one has any ideas? Is this something that would require new uiScript’s or is there something I can “rig” to work now? :???:


(=SC=Beef) #3

how will you define who can view it? or will everyone view it, because as far as i know making certian levels via shrubbot see a specific menue is impossible


(=SC=Beef) #4

how will you define who can view it? or will everyone view it, because as far as i know making certian levels via shrubbot see a specific menue is impossible


(-999-) #5

All players can view it, as well as interact with it, along with the rest of the menus. But, whether it has any effect is still dependant on their shrubbot level, and attempts to use it are recorded in the admin.log just as they are when the commands are typed.


(Chruker) #6

Have you tried setting the cg_messageText cvar before or after you open the message window?


(-999-) #7

I tried every combination I could think of (again, code is not a specialty of mine).
set cg_messageText !ban ; open ingame_messagemode
exec cg_messageText !ban ; open ingame_messagemode
set “cg_messageText !ban” ; open ingame_messagemode
exec “cg_messageText !ban” ; open ingame_messagemode
all reversed and various " arangements tried
etc
Still opens the message box, most of the time when I try it gives a “unknown ui script” error. Perhaps I’m setting it incorrectly, but I don’t see a lot of examples of that command in the the sdk menu files, and a search of the command came up with very little info. :???:


(Chruker) #8

Try with:

setcvar cg_messageText "!ban "

I’m not sure if you should put this before or after the open command.


(-999-) #9

That did it, thanks. It didn’t seem to matter whether I put it before or after. Here’s the button code incase anyone else wants it.

BUTTON( 6+.5*(WINDOW_WIDTH-18)+6, 32, .5*(WINDOW_WIDTH-18), 14, "!BAN", .24, 11, exec "cmd !ban" ; open ingame_messagemode ; setcvar cg_messageText "!ban " )

Thanks again Chruker, I probably would have never found that. :drink: