Quote:
|
Originally Posted by Dygear
Quote:
|
Originally Posted by Mattie
player_hurt.cfg:
Code:
// EventScripts v0.5.5
if (event_var(weapon) equalto "hegrenade") then ma_slap event_var(userid) 0
|
Why did you chose to do with equalto and now == or just = ?
Also,
Code:
if (event_var(weapon) == "hegrenade") { ma_slap event_var(userid) }
And from there you could do this :
Code:
if (event_var(weapon) == "hegrenade") { ma_slap event_var(userid) } else { ma_ban event_var(userid) }
What stage did you decide this? And I would like to see an config var that you could allow the change the operators to what you want. Such as 'operators_worded = 0' would then make it like my way, the == and {}.
|
Lots of reasons for this, but it's definitely by design. The operators are that way because I'm not writing a scripting language-- I'm trying to write it so people envision ES more as a lot of powerful console commands rather than learning a whole new language. EventScripts is not for programmers really, they can use Isis or some other plugin that allows JavaScript or somesuch.
Technically, the primary reason it's like that is because I want a very clearly identifiable token that's both unlikely to be in traditional cfg files and is rather readable by humans. If I start going with operators like == then programmers expect "!=" which is non-intuitive to everyday admins. As is "<>". (Even the double equals is a little random when you think about it in that context.) "notequalto" is a good bit better, though it is very "English" and I have to live with that for now.
If you understand logic well enough, it's not difficult to construct elses or whatever else you wish from the simple console commands I provide. If you're not a programmer, though, I don't want people to get lost in all the in-line constructs. "if" by itself is pushing that envelope, but I couldn't come up with a more readable conditional synax that I could cleanly parse (with Valve's tokenizing) on a single line. Else's, of course, are easy for the time-being:
Code:
if (event_var(weapon) equalto "hegrenade") then bar
if (event_var(weapon) notequalto "hegrenade") then foo
Or's and And's are simple, too.
Regardless, you have good suggestions. Why don't you post them over in my forum where some of my regular users can chime in on what they prefer? If enough people like the idea of making things more script-like, I'll consider it. For now, though, the whole idea of EventScripts is to avoid being a scripting language and try to be a little more like creating "extended' config files.
Thanks for your suggestions,
-Mattie