Guild icon
Teeworlds
discord.gg/teeworlds / development
For discussions around the development of the official Teeworlds
Between 2021-02-18 00:00:00Z and 2021-02-19 00:00:00Z
Avatar
Why are the console side arguments designed in such a way that it only returns the number of arguments specified from format? NumArguments() != 1 it's un correct Simply because it cannot exceed the number of arguments specified for format
20:20
I think it would be optimal to add (everything else that is not included in the area as an argument, so we could have more flexible control over the commands)
Avatar
the argument type r captures the "rest" of the line
20:22
you can use that
Avatar
So all NumArguments can do is < Okay, I'll take a look at it, thanks for the answer
20:26
Uncomfortable thing r
20:27
I have to change my arguments
20:27
Which are shown as a hint
20:29
And it does not change, example using the in-game chat command with NumArguments() != 1 /sound - does not work. /sound 1 - work. /sound 1 dkasokdosakd koasdsakdo kasod kaso - work xd (edited)
Avatar
I'm not entirely sure what you want
20:30
do you want to make some arguments optional?
Avatar
I want to know is there a reason why it's done that way?
Avatar
oh, do you mean that commands accept more parameters than specified?
Avatar
hm. idk
Avatar
It inherits the number of arguments from formated that are passed as ?s[text] only for example
20:39
Therefore, the logic of NumArguments seems incomprehensible
20:44
I think that would be correct with logic NumArguments() != 1
Avatar
i guess it is defined as sound i[id]?
20:45
It will only check arguments that are valid
20:45
everything entered at the end is not used
20:46
Only if the last argument is r
20:46
r is like s (string) but it will check the rest of the entered command, r is for example good for playernames because they can have spaces
Avatar
yes, that's what @Kurosio is complaining about
20:47
that unused arguments don't yield errors
Avatar
I have already looked at the logic of r and understood how it works
Avatar
So whats the question?
20:47
Im not sure I get it
Avatar
Avatar
heinrich5991
that unused arguments don't yield errors
oh
20:48
yea but that makes sense i think, because if the creator of the command would need more arguments he would add it to the argument list of that command
20:49
Of course, it could say invalid arguments: given x arguments too much, but it interprets what it gets so i think its okay and good
Avatar
The point is that NumArguments it cannot exceed the number of specified arguments passed through format
20:49
But it can be less than the number of arguments specified
Avatar
If you want less arguments you have to add a ? in front if it, for example ?s[name]
20:50
then its optional
Avatar
Hm sec
Avatar
command ?i[number] s[string] would not work
20:52
Optional arguments need to be added at the end
20:52
But: command i[number] ?s[string] ?i[number2] would work
Avatar
I don't know what you mean xD
20:52
nvm
Avatar
What I'm writing, it doesn't affect any of the arguments xd
Avatar
i[some]s[some2]?i[some3]?i[some4]?i[some5] 1. logic with args 10 hello 5 1. logic NumArguments NumArguments != 3 arguments admissible to logic 10 hello 10 hello 5 0 2. logic with args 10 hello 5 0 10 2. logic NumArguments NumArguments != 5 arguments admissible to logic 10 hello 5 unacceptable 10 hello 5 0 10 0 - I don't care, I will work. (edited)
21:10
I think that makes more sense xD
21:11
example that the logic of NumArguments is different
Avatar
And at the same time, it was ideal to also apply Error, then the commands and the console will be just perfect, and using PrintCallback it's generally sweet
Exported 47 message(s)