Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
<C> cmdlist

 
Post new topic   Reply to topic Printable version
 View previous topic  <C> ASSS Command List Module Post :: Post <C> ball_motion  View next topic  
Author Message
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Jan 30, 2011 2:05 pm    Post subject: <C> cmdlist Reply to topic Reply with quote

Following the discussion in this topic, I made a simple ?cmdlist module.
It will list all the commands available to the player, for all the modules in the arena. The commands are sorted alphabetically. It lists commands that can only be sent privately separately. However, commands that can be sent both publicly and privately are only shown in the 'Public commands' section, it would be pretty spammy otherwise.

It needs to be loaded right after the chat module, in modules.conf.

Feel free to make improvements on this and post updates.

Source and windows binary included.

Possible improvements:
-Filter option (i.e. "?cmdlist set" would return all commands containing "set")
-Column formatting (sort commands and display them top to bottom, left to right, instead of left to right, top to bottom)
-Get the chat interface in POSTLOAD or on the first ?cmdlist called; this would allow us to load the cmdlist module earlier
-Variable number of columns / column width, perhaps even automatically adjust the column width depending on the longest command name


UPDATE 20/02/2011: Uploaded new version. Includes makefile. Compiles and runs properly both on Linux and Windows.
_________________
(Insert a bunch of dead links here)




.dll and source

cmdlist.zip - 23.59 KB
File downloaded or viewed 198 time(s)

cmdlist.png - 66.86 KB
File downloaded or viewed 203 time(s)


Last edited by Samapico on Sun Feb 20, 2011 2:59 am, edited 1 time in total
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Mon Jan 31, 2011 1:21 am    Post subject: Re: <C> cmdlist Reply to topic Reply with quote

Samapico wrote:
-Filter option (i.e. "?cmdlist set" would return all commands containing "set")
-Column formatting (sort commands and display them top to bottom, left to right, instead of left to right, top to bottom)
-Variable number of columns / column width, perhaps even automatically adjust the column width depending on the longest command name


i would say the first two would be substantially important, but the third one can not be done without knowing the client's resolution

Samapico wrote:
-Get the chat interface in POSTLOAD or on the first ?cmdlist called; this would allow us to load the cmdlist module earlier


this isnt even really needed, but if you feel the need to:
Get the chat interface in POSTLOAD=winner
the other one is just silly
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Mon Jan 31, 2011 6:52 am    Post subject: Reply to topic Reply with quote

The server does know the client's resolution, you know.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Mon Jan 31, 2011 8:09 am    Post subject: Reply to topic Reply with quote

By the way, these 'possible improvements' are stuff that I probably won't do myself (unless I specifically need it at some point), but you're all welcome to do it tongue.gif
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Mon Jan 31, 2011 1:23 pm    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
The server does know the client's resolution, you know.


lol i forgot about that






also, i rewrote this and compiled, and then it crashed when the first command got added, then i compiled your source file, same thing, then i used your included binary, same thing.
and yet you have a screenshot, so it must have worked at some point...
is there something missing?
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Arnk Kilo Dylie
Seasoned Helper


Age:37
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Mon Jan 31, 2011 2:16 pm    Post subject: Reply to topic Reply with quote

Server doesn't know the text size the client is using though

Anyway...I was hoping that you wrote something that magically could replace hz's cmdlist module. While you're doing a clever hack, I figure cmdman needs to be redone anyway...grouping commands into sections is a must--such that one could filter out staff vs player commands, commands for each module or game, etc. That's already on the list of 1,000 desirable asss revamps that might happen in the next 10 years...ramble ramble

P.S. Would recommend not using POSTLOAD.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Mon Jan 31, 2011 5:38 pm    Post subject: Reply to topic Reply with quote

Cheese wrote:
...
Did you put cmdlist:cmdlist right after chat in modules.conf?
And it shouldn't be attached to any arena either.


As for splitting in sections...

if capman has a way to tell us if a capability is available for a normal player, we could get:

Player commands:
...

(if you have powers other than default)
Other/staff commands:
...


But splitting by modules is way trickier... Perhaps it could recognize a string in the helptext of a function (Module: ... Args: ... etc...) and categorize it as what's written at Module... If you don't write anything, or if the command doesn't have a helptext, it just puts it in a generic section.
So you could categorize your commands, but if you don't want to, you don't have to. But doing it automatically, as it is now, would be impossible icon_sad.gif


Either way, I think it's very useful, even as it is. When you forget how a particular command was spelled, or whatever.
Back to top
View users profile Send private message Add User to Ignore List
Arnk Kilo Dylie
Seasoned Helper


Age:37
Gender:Gender:Male
Joined: Jul 14 2006
Posts: 108
Offline

PostPosted: Mon Jan 31, 2011 5:54 pm    Post subject: Reply to topic Reply with quote

I know, that's why I brought up that cmdman needs an overhaul anyway. Oh, and capman too...

Brainstorm things you need in new versions of those and it might happen.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Mon Jan 31, 2011 6:59 pm    Post subject: Reply to topic Reply with quote

One way to do things would be:

1) Add a 'AddCommand' function that has another parameter for a 'category'
2) The default AddCommand would use "" as category

Unless there's really a way to know from which module the AddCommand was called from...

And to differentiate player commands from staff commands, the only way I can think of is some kind of:
GroupHasCapability(somegroup (i.e. "default"), somecapability (i.e. "cmd_stats")); function.
From what I see and understand in capman.c, it would be pretty easy.........
Actually:
return(cfg->GetStr(groupdef, somegroup, cap) != NULL);
Back to top
View users profile Send private message Add User to Ignore List
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Feb 20, 2011 1:12 am    Post subject: Reply to topic Reply with quote

Found a stupid bug in function AddCommandInt...

Correct code:
Code: Show/Hide

local void AddCommandInt(const char *cmdname, CommandFunc func, Arena *arena, helptext_t ht)
{
   LOCK_MUTEX(lockcmd);


   commandInfo* cmdinfo = (commandInfo*)amalloc(sizeof(commandInfo));

instead of [...]sizeof(commandlist)[...]


Updated first post
Back to top
View users profile Send private message Add User to Ignore List
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Sun Feb 20, 2011 10:25 am    Post subject: Reply to topic Reply with quote

recompiled from source with this fix, and it works 100% now

good job, this thing is awesome


also, since this is probably going to be used by everyone, variable column lengths and vertical alphabeticismness are going to be pretty much mandatory.
ill write it when i get some free time in about six months from now... tongue.gif

PS filter would be icing on the cake
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Feb 20, 2011 11:49 am    Post subject: Reply to topic Reply with quote

Cheese wrote:

also, since this is probably going to be used by everyone, variable column lengths and vertical alphabeticismness are going to be pretty much mandatory.
ill write it when i get some free time in about six months from now... tongue.gif

PS filter would be icing on the cake
Yeah I know. I want all of these things too tongue.gif
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sun Feb 20, 2011 4:33 pm    Post subject: Reply to topic Reply with quote

If your looking for output formatting, hs_util's menu module works decently well.

http://forums.minegoboom.com/viewtopic.php?t=8092
and
https://bitbucket.org/drbrain/hs_util/

I think Jowie wrote a python equivalent.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Tue Feb 22, 2011 6:31 am    Post subject: Reply to topic Reply with quote


  • Align column left, right or center
  • Custom characters for the borders (padding, configurable width for borders, custom junction chars, etc)
  • Maximum width based on screen resolution
  • Maximum width configurable with the command ?menuwidth (persistent)
  • Multiple tables within a menu can be stretched to each others width
  • Column less tables (text area) within a menu
  • Custom seperators
  • Toggle visibility of columns
  • Calculates the best column width to use based on the data contained in each row (like html tables)
  • word wraps column data without breaking lines


Requires cPickle




ChatMenu_test.py - 3.45 KB
File downloaded or viewed 293 time(s)

ChatMenu.py - 19.81 KB
File downloaded or viewed 305 time(s)
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 54 page(s) served in previous 5 minutes.

phpBB Created this page in 0.482714 seconds : 40 queries executed (85.8%): GZIP compression disabled