Logic and (&&) is unsupported?
- KelvinShadewing
- Posts: 12
- Joined: 12 Mar 2015, 14:24
- Contact:
Logic and (&&) is unsupported?
So I tried to load a mod recently, and got a compile error. When I opened it in OpenMW-CS, it gave me "syntax error (&)" on a line that was checking if a variable was between two values. Is there some alternative to this? Why isn't && supported?
Re: Logic and (&&) is unsupported?
I am fairly sure there are no boolean operators in the MW scripting language.
See also this guide.
See also this guide.
- AnyOldName3
- Posts: 2678
- Joined: 26 Nov 2015, 03:25
Re: Logic and (&&) is unsupported?
I think they even had to be added via F4SE for Fallout 4, so it's not unlikely that Bethesda would have deemed them unnecessary as far back as Morrowind.
Re: Logic and (&&) is unsupported?
MW scripts don't support boolean operators, but vanilla engine somehow ignores them without throwing error. That's probably why some mods use them without knowing that they don't work...
Re: Logic and (&&) is unsupported?
It seems vanilla engine treats "&&" and second command as valid extra string arguments in first command. These values are not ignored - there are just elements of arguments array, unused by command.vanilla engine somehow ignores them
- KelvinShadewing
- Posts: 12
- Joined: 12 Mar 2015, 14:24
- Contact:
Re: Logic and (&&) is unsupported?
Even then, why doesn't OpenMW support them? Seems kind of essential to me.
Re: Logic and (&&) is unsupported?
Are they? You can do almost anything with if, else if, else and negation operators. Albeit code duplication.KelvinShadewing wrote:Even then, why doesn't OpenMW support them? Seems kind of essential to me.
Code: Select all
// and
if(1 && 2) { foo }
if(1) { if(2) { foo } }
// or
if(1 || 2) { foo }
if(1) { foo }
else { if(2) { foo } }
// xor
if(1 XOR 2) { foo }
If(1) { if(!2) { foo } }
if(2) { if(!1) { foo } }
Re: Logic and (&&) is unsupported?
I agree they aren't essential, but boy howdy would they be a great improvement to the scripting language. So would string variables.Jyby wrote: Are they? You can do almost anything with if, else if, else and negation operators. Albeit code duplication.
... which brings us back into the question of whether to improve the scripting language or enable a different scripting language (python? lua? something else?). I'm pretty sure that usually ends with a "not till post-1.0".
Re: Logic and (&&) is unsupported?
Exactly. Of course we will get logic operators after 1.0. Probably almost immediately after 1.0. I do consider them essential (even if there is usually a workaround) and adding them is very easy.
- KelvinShadewing
- Posts: 12
- Joined: 12 Mar 2015, 14:24
- Contact:
Re: Logic and (&&) is unsupported?
I'd love to see Squirrel added. It's a great C-like language that doesn't get enough love.jmelesky wrote: ↑08 May 2017, 17:09I agree they aren't essential, but boy howdy would they be a great improvement to the scripting language. So would string variables.Jyby wrote: Are they? You can do almost anything with if, else if, else and negation operators. Albeit code duplication.
... which brings us back into the question of whether to improve the scripting language or enable a different scripting language (python? lua? something else?). I'm pretty sure that usually ends with a "not till post-1.0".