Logic and (&&) is unsupported?

Learn about OpenMW mod compatibility, check for problematic mods, discuss issues, and give us feedback about your experience with modded OpenMW.
User avatar
KelvinShadewing
Posts: 12
Joined: 12 Mar 2015, 14:24
Contact:

Logic and (&&) is unsupported?

Post by KelvinShadewing » 06 May 2017, 20:47

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?

ezze
Posts: 426
Joined: 21 Nov 2013, 13:20

Re: Logic and (&&) is unsupported?

Post by ezze » 07 May 2017, 09:18

I am fairly sure there are no boolean operators in the MW scripting language.
See also this guide.

User avatar
AnyOldName3
Posts: 1032
Joined: 26 Nov 2015, 03:25

Re: Logic and (&&) is unsupported?

Post by AnyOldName3 » 07 May 2017, 14:31

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.
AnyOldName3, Master of Shadows

User avatar
jirka642
Posts: 117
Joined: 23 Aug 2014, 11:39
Location: Czech Republic
Contact:

Re: Logic and (&&) is unsupported?

Post by jirka642 » 07 May 2017, 14:40

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...
On GitHub as kunesj, on GitLab as kunesj.
OS: Linux Mint 18, CPU: Intel Core i5-3330, RAM: 16GB, GPU: GeForce GTX 650Ti, OpenMW: from source

User avatar
akortunov
Posts: 351
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation
Github profile: https://github.com/akortunov

Re: Logic and (&&) is unsupported?

Post by akortunov » 07 May 2017, 16:13

vanilla engine somehow ignores them
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.

User avatar
KelvinShadewing
Posts: 12
Joined: 12 Mar 2015, 14:24
Contact:

Re: Logic and (&&) is unsupported?

Post by KelvinShadewing » 08 May 2017, 00:55

Even then, why doesn't OpenMW support them? Seems kind of essential to me.

User avatar
Jyby
Posts: 406
Joined: 10 Dec 2013, 04:16

Re: Logic and (&&) is unsupported?

Post by Jyby » 08 May 2017, 03:04

KelvinShadewing wrote:Even then, why doesn't OpenMW support them? Seems kind of essential to me.
Are they? You can do almost anything with if, else if, else and negation operators. Albeit code duplication.

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 } }
Macbook Air 2013 - 1.7GHz Intel i7 - 8 GB - 512 GB SSD - Intel HD 5000
Windows 10 PC - 4GHz Intel i7 - 16 GB - 512 GB SSD - EVGA GTX 1060 SSC

jmelesky
Posts: 28
Joined: 02 Mar 2017, 20:52

Re: Logic and (&&) is unsupported?

Post by jmelesky » 08 May 2017, 17:09

Jyby wrote: Are they? You can do almost anything with if, else if, else and negation operators. Albeit code duplication.
I agree they aren't essential, but boy howdy would they be a great improvement to the scripting language. So would string variables.

... 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".

User avatar
Zini
Posts: 5445
Joined: 06 Aug 2011, 15:16

Re: Logic and (&&) is unsupported?

Post by Zini » 08 May 2017, 17:12

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.

User avatar
KelvinShadewing
Posts: 12
Joined: 12 Mar 2015, 14:24
Contact:

Re: Logic and (&&) is unsupported?

Post by KelvinShadewing » 23 Jan 2018, 01:12

jmelesky wrote:
08 May 2017, 17:09
Jyby wrote: Are they? You can do almost anything with if, else if, else and negation operators. Albeit code duplication.
I agree they aren't essential, but boy howdy would they be a great improvement to the scripting language. So would string variables.

... 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".
I'd love to see Squirrel added. It's a great C-like language that doesn't get enough love.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest