Page 1 of 1

NWEval

Posted: Sat Sep 06, 2014 4:23 pm
by KyleMassacre
So I am working on a module and I need to use NWEval. Now, I have used NWEval before in my voting module but for some reason I keep getting this error:

Code: Select all

Error: syntax error, unexpected T_STRING
HINT: Maybe you didn't closed / escaped a string correctly or missing a ; sign at the end of a line.

Error in "not/important/to/know/root/directory/nwe/libs/common.php(1143) : eval()'d code"
Line 1
I have a table column like:

Code: Select all

`crimeSuccess` text NOT NULL
and my usage is like:

Code: Select all

$success = round(NWEval("return {$crimes->fields[1]};") * 100.0, 0);
?>
Which is a copy/paste from the crimes module because that seemed to work perfectly

And in my table I have tried using things like:
  • 50/8;
  • 50/8
  • 50;
Any ideas on what i'm doing wrong?

***EDIT***
Also my $success is returning 0

Re: NWEval

Posted: Sat Sep 06, 2014 8:33 pm
by SophieEV
When i look at the crime table my success_rate is as follows: '$userStats["Dexterity"]->value/50.'

Im not sure if its after a fullstop?

ive found a few odd formatting requirements when using the nweval, but i find it useful to use the ingame wizards to set up the conditions, stat gains etc rather then typing them straight into the table so then i dont need to worry about formatting them correctly.

Good luck ;)

Re: NWEval

Posted: Sat Sep 06, 2014 11:18 pm
by KyleMassacre
Yeah it's something I need to get to the bottom of. The weird thing is that it works fine in a different file but where I am trying to use it is in an auto_pre_content.php. Maybe when Alain gets on he may know but I know he doesn't normally show up on weekends.

Re: NWEval

Posted: Sat Sep 06, 2014 11:29 pm
by KyleMassacre
Ughh, I feel like an idiot but I figured it out. I was calling the wrong column

Re: NWEval

Posted: Sun Sep 07, 2014 8:50 am
by SophieEV
Ahh, that would probably do it ;)