NWEval

General Chat, Comments
Post Reply
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

NWEval

Post 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
SophieEV
Posts: 22
Joined: Sat Aug 02, 2014 1:06 pm

Re: NWEval

Post 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 ;)
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: NWEval

Post 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.
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: NWEval

Post by KyleMassacre »

Ughh, I feel like an idiot but I figured it out. I was calling the wrong column
SophieEV
Posts: 22
Joined: Sat Aug 02, 2014 1:06 pm

Re: NWEval

Post by SophieEV »

Ahh, that would probably do it ;)
Post Reply

Return to “General”