Author Topic: What does this do?  (Read 2735 times)

0 Members and 1 Guest are viewing this topic.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
What does this do?
« on: November 30, 2013, 02:32:10 PM »
So when I'm coding a command for ULX, it seems like many things including silent echoes, and the setOpposite param don't work unless you have this:

command_name:addParam{ ULib.cmds.BoolArg, invisible=true }

So what exactly does that do?

Offline Decicus

  • Hero Member
  • *****
  • Posts: 552
  • Karma: 81
    • Alex Thomassen
Re: What does this do?
« Reply #1 on: November 30, 2013, 02:43:03 PM »
Silent echoes don't need the BoolArg. At least not when I've used it.
Although, if you're setting an opposite like for freeze (freeze has 3 parameters, calling player, target, boolean). The boolean is used to check if the Opposite command (unfreeze) or the normal command (freeze) is used. When the opposite is used, it's set to "_, _, true". Two first underscores are just to basically be the same as normal (calling player and target player), but the last one is to make the third parameter to "true", making it unfreeze.

It might be confusing (I'm tired), but basically: It's only needed for booleans, if you have something like "should_unfreeze", and then checks inside the command where it's like "if not should_unfreeze" (if should_unfreeze is false, basically, normal command).

Let's hope what I've understood is correct. Don't kill me if I'm wrong.

(My 200th post! Wooh!)
« Last Edit: November 30, 2013, 02:45:25 PM by Decicus »
Contact information:
E-mail: alex@thomassen.xyz.
You can also send a PM.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: What does this do?
« Reply #2 on: November 30, 2013, 02:46:29 PM »
As I've said to other people before, I don't know too much about how the black magic of ulx works, but from what little knowledge of ulx, I do know what that does.

command_name obviously being command name such as god.

addParam, is basically calling arguments I believe. So in {} there would normally be like type=ULib.cmds.PlayersArg, meaning that there would be a list of all the players, and you can select one of them to do w/e you're going to do to them.

Then following the above command, you could gibe a string argument such as another param
command_name:addParam{ type=ULib.cmds.StringArg, hint="STRING VALUE" }

So that was my example of addParam, but I bet you weren't talking about that, and you were most likely talking about the two functions within the {}

Typically when you're calling Ulib.cmds.(w/e here) you usually have type= before Ulib.cmds
I do not know what the first one would do, but I could guess the second one would just make the list/string/args invisible.




EDIT:
Just to add on to the original post, after I added invisible to one of my custom made ulx scripts, it just errored out. So I have no clue what it does.

Code: [Select]
[Dev Apple|2|STEAM_0:0:35379784] Lua Error:

[ERROR] addons/ulx give weapon/lua/ulx/modules/sh/giveweapon.lua:50: '}' expecte
d near 'type'
  1. unknown - addons/ulx give weapon/lua/ulx/modules/sh/giveweapon.lua:0
« Last Edit: November 30, 2013, 02:55:21 PM by chaos13125 »
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: What does this do?
« Reply #3 on: November 30, 2013, 03:18:15 PM »
No, I know all that stuff, I was referring to the actual "BoolArg, invisible=true" part.

Offline Bite That Apple

  • Hero Member
  • *****
  • Posts: 858
  • Karma: 416
  • Apple Innovations 2010®
    • Fun 4 Everyone Gaming
Re: What does this do?
« Reply #4 on: November 30, 2013, 06:01:17 PM »
No, I know all that stuff, I was referring to the actual "BoolArg, invisible=true" part.

Well I can tell you this, it breaks my server :p
Quote from: John F. Kennedy 1963
A man may die, nations may rise and fall, but an idea lives on.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: What does this do?
« Reply #5 on: November 30, 2013, 08:55:10 PM »
When used properly, it's usually intended to prevent a variable from being seen, in most instances, in the chat window of a chat command.
As the ULib command structure is quite robust, it could be used for other instances.
If you'd like to give a specific example within ULX (or a mod you've seen) that it's been used, I'd be happy to review/verify for you.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given