Natural Healing corrected and fully functional!

Learn about OpenMW mod compatibility, check for problematic mods, discuss issues, and give us feedback about your experience with modded OpenMW.
Loriel
Posts: 98
Joined: 28 May 2015, 00:44

Re: Natural Healing corrected and fully functional!

Post by Loriel » 24 Aug 2017, 11:32

Agreed - the proposed solution will run without errors, but will give the wrong solution.

Simply type "20>=15>=11" into the console (without the quotes) - it gives 0 (false) which isn't what was wanted...

Another possible alternative would be something like:

Code: Select all

if (HRatio<=10)
	set RMult to 1
elseif (Hratio <= 20)
	set RMult to 2
elseif (HRatio<=30)
	set RMult to 3
etc

But Zini's suggestion is simpler and more elegant, so I would go with that...

Loriel

zelo86
Posts: 7
Joined: 23 Aug 2017, 14:46

Re: Natural Healing corrected and fully functional!

Post by zelo86 » 24 Aug 2017, 14:42

Hello, Zini. Thanks for the post.

When I corrected the Mod, I was thinking for a way to substitute the "&&". I remembered some Math lesson when I was at school and I tried to apply the "included" (I don't know the english word for it) math formula in this situation. That's

n < x < n (Or n > x > n)

I remembered that in this formula, if both evaluations are correct the return of the function is "True". If some (or both) is (are) not correct then is "False".. In this way the "if" should've worked..

But I trust you, if you say that's not correct. I'm no expert in writing programs!
The only thing I can say is that I tried the Mod. It seems to me that it works correctly, healing at slow pace when seriously injured, and at faster pace when slightly wounded..

Thanks again..
Nicola

Loriel
Posts: 98
Joined: 28 May 2015, 00:44

Re: Natural Healing corrected and fully functional!

Post by Loriel » 24 Aug 2017, 15:18

See the discussion at viewtopic.php?f=40&t=4304

Unfortunately, as Zini says, your proposal doesn't do what you expect it to...

Code: Select all

if ( 20 >= HRatio >= 11 )
In the absence of better logic, it treats it as

Code: Select all

if (( 20 >= HRatio) >= 11)
First it evaluates the first half of the expression - if( 20 >= HRatio ) - and returns either 1 (true) or 0 (false)

Then it evaluates the second half - if( 0 => 11 ) or if( 1 => 11 ) - both of which will return 0 (false)

The suggestions from the linked thread would lead to something like:

Code: Select all

elseif ( 20 >= HRatio )
	if( HRatio >= 11 )
		Set RMult to 2
	endif
elseif ( 30 >= HRatio )
That should work correctly, but is verbose.

My alternative suggestion simplified it by removing the second part of the comparison - I think the double comparison is unnecessary if the "elseif"s are set up correctly.

However Zini's suggestion is much simpler again.

Loriel

zelo86
Posts: 7
Joined: 23 Aug 2017, 14:46

Re: Natural Healing corrected and fully functional!

Post by zelo86 » 24 Aug 2017, 15:41

Ah.. Now I get it!
Thanks for the explanation, now that's clear..

So now the file I uploaded isn't useful, I think..

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest