Author Topic: Adding filters to parameters possible?  (Read 1554 times)

0 Members and 1 Guest are viewing this topic.

Offline jakej78b

  • Newbie
  • *
  • Posts: 26
  • Karma: 4
Adding filters to parameters possible?
« on: October 30, 2014, 10:44:55 AM »
So, while registering a command you typically add something similar to this in order to allow the command to target other players.

command:addParam{ type=ULib.cmds.PlayersArg }

I was wondering if it was possible to make a filtered parameter to filter out dead or alive people. I have a respawn command and it adds all the players, and yes it does have code that won't allow them to be respawned anyways, but it would be cool if all the alive players were filtered out of xgui, same with slay but filter dead players instead.

Anybody got any ideas?
« Last Edit: October 31, 2014, 07:33:22 PM by jakej78b »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Adding filters to parameters possible?
« Reply #1 on: October 30, 2014, 03:14:36 PM »
You set checking like that within your function, just like ULX does.
ULib's command object functions are extremely powerful, but such a filter addition would generally be too niche/overkill, as I'd guess majority of code functions, both custom and ULX, don't require it.
Not to say that Stickly Man, MrPres, and Megiddo may disagree with what I think they might say.
As for ULX, within any functions that need it, we also use ulx.getExclusive to determine other player states set by ULX such as jailed, mauled, frozen, etc.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming