'Error reading function declaration in module uo'

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 098.

Moderator: POL Developer

Post Reply
Yukiko
Distro Developer
Posts: 2736
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

'Error reading function declaration in module uo'

Post by Yukiko » Sun Aug 16, 2009 2:20 am

That's the error I get when attempting to compile stafflist.src under this release. I didn't get this error with the POL 0.97 release.
Any help would be appreciated.
Here is the copy the full error report and the stafflist.src file:

Error:

Code: Select all

Compiling: C:\pol\pkg\systems\stafflist\staffList.src
Error reading function declaration in module uo
Error compiling statement at C:\pol\pkg\systems\stafflist\staffList.src, Line 3
Compilation Error:
Near: use uo;
File: C:\pol\pkg\systems\stafflist\staffList.src, Line 3
Execution aborted due to: Error compiling file
stafflist.src:

Code: Select all

use os;
use util;
use uo;

include "include/math";
include "include/eventID";
var stff := {};
var players := {};
var coun := {};
var gm := {};

program online_server()
  stff := {};
  while(1)
	var ev := wait_for_event(3600);
	if(ev)
	  case(ev.type)
	    EVID_STAFF_LOGIN:   staff(ev);
	    EVID_PLAYER_LOGIN:  login(ev);
	    EVID_PLAYER_LOGOFF: logoff(ev);
	    EVID_PLAYER_DELAY:  delay(ev);
	    EVID_FIND_COUN:     Reportcounselors(ev);
	    EVID_FIND_GM:       Reportgamemasters(ev);
	    "gmbcast":          GMBcast(ev);
	  endcase
	endif
  endwhile
endprogram

function GMBcast(ev)
  var msg := ev.msg;
  if(ev.src == "ScriptManager")
    foreach x in gm
      SendSysMessage(x, msg, 0, 52);
    endforeach
  else
    var source := ev.source;
    foreach x in gm
      SendSysMessage(x, source.name + ": " + msg, 0, 87);
    endforeach
  endif
endfunction

function Reportcounselors(ev)
  var sender := GetProcess(ev.pid);
  var k := struct;
  k.+type  := EVID_FIND_COUN;
  k.+data := coun;
  sender.sendevent(k);
endfunction

function Reportgamemasters(ev)
  var sender := GetProcess(ev.pid);
  var k := struct;
  k.+type  := EVID_FIND_GM;
  k.+data  := gm;
  sender.sendevent(k);
endfunction

function login(ev)
  var who := ev.player;
  foreach person in stff
    if(CInt(GetObjProperty(person, "LogNotify")) == 1)
      SendSysMessage(person, who.name + " (Account name: " + who.acctname + ") has logged on.  IP: " + who.ip);
    endif
  endforeach
endfunction

function logoff(ev)
  var who := ev.player;
  var lastlogon := CInt(ReadGameClock()) - CInt(GetObjProperty(who, "LastLog"));
  if(!lastlogon)
    lastlogon := "unknown";
  else
    var s := Mod(lastlogon, 60);
	var m := CInt(lastlogon/60);
	m := Mod(m, 60);
	var h := CInt(m / 60);
	if (s < 10)
	  s := "0" + CStr(s);
	endif
	if (m < 10)
	  m := "0" + CStr(m);
	endif
	lastlogon := CStr(h) + ":" + CStr(m) + ":" + CStr(s);
  endif
  SetObjProperty(who, "LastLog", ReadGameClock());
  if(who.cmdlevel >= 1)
    var holder := {};
    foreach thing in stff
      if(thing != who)
        holder.append(thing);
      endif
    endforeach
    stff := holder;
    holder := {};
    if(who.cmdlevel == 1)
      foreach thing in coun
        if(thing != who)
          holder.append(thing);
        endif
      endforeach
      coun := holder;
    elseif(who.cmdlevel > 1)
      foreach thing in gm
        if(thing != who)
          holder.append(thing);
        endif
      endforeach
      gm := holder;
    endif
  endif
  if(GetObjProperty(who, "StealthLogin"))
	return;
  else
    foreach person in stff
      if(CInt(GetObjProperty(person, "LogNotify")) == 1)
        SendSysMessage(person, who.name + " (Account name: " + who.acctname + ") has logged off.  IP: " + who.ip + "   Time on- " + lastlogon);
      endif
    endforeach
  endif
endfunction

function staff(ev)
  var who := ev.player;
  stff.append(who);
  if((who.cmdlevel >= 1) and (who.cmdlevel < 3))
    coun.append(who);
  elseif(who.cmdlevel >= 3)
    gm.append(who);
  endif
  SendSysMessage(Who, "Welcome, there are currently " + len(stff) + " staff online");
  foreach thing in stff
    if(thing != who)
      var msg := "Staff Member";
      case(thing.cmdlevel)
        0: msg := "Player";
        1: msg := "Counselor";
        2: msg := "Seer";
        3: msg := "GM";
        4: msg := "Admin";
        5: msg := "Developer";
      endcase
      SendSysMessage(who, msg + " " + thing.name + " is online");
      if(!GetObjProperty(who, "StealthLogin"))
        SendSysMessage(thing, who.name + " (Account name: " + who.acctname + ") has logged on.  IP: " + who.ip);
      endif
    else
      if(CInt(GetObjProperty(thing, "LogNotify")) == 1)
        SendSysMessage(thing, who.name + " (Account name: " + who.acctname + ") has logged on.  IP: " + who.ip);
      endif
    endif
    sleep(1);
  endforeach
endfunction

function delay(ev)
  var who := ev.player;
  if(GetObjProperty(who, "StealthLogin"))
	return;
  else
    foreach person in stff
      if(CInt(GetObjProperty(person, "LogNotify")) == 1)
        SendSysMessage(person, who.name + " (Account name: " + who.acctname + ") has been set to delayed log out.  IP: " + who.ip);
      endif
    endforeach
  endif
endfunction

User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Re: 'Error reading function declaration in module uo'

Post by OldnGrey » Sun Aug 16, 2009 3:01 am

Is there a new function or variable declaration in uo.em that is being used in your script?

Yukiko
Distro Developer
Posts: 2736
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: 'Error reading function declaration in module uo'

Post by Yukiko » Sun Aug 16, 2009 3:11 am

I looked for function declares and didn't see any. I did notice that the uo.em file grew a bit since 0.97 so I suspect it could be that some new keyword was added to uo.em that conflicts with my script. The odd thing is that when I was compiling scripts with that type of issue earlier (I had some scripts that had vars named "min" which is a function that was added to math.em.) the error was different.

I'll have to look through the script and compare vars and the like I guess with stuff in uo.em.

Why did it have to be the biggest module??? Why couldn't it have been 'util.em'?
*laughs*

User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Re: 'Error reading function declaration in module uo'

Post by OldnGrey » Sun Aug 16, 2009 4:16 am

I just don't like the look of login and logoff as functions names :)

Tomi
POL Developer
Posts: 477
Joined: Tue Feb 21, 2006 5:08 pm

Re: 'Error reading function declaration in module uo'

Post by Tomi » Sun Aug 16, 2009 6:55 am

I looked at your script and found out what the problem was.

Seems that delay is a reserved word in uo.em or such nowadays, because changing the function name delay makes the script compile without any errors.

Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: 'Error reading function declaration in module uo'

Post by Turley » Sun Aug 16, 2009 8:45 am

The problem is inside uo.em:
PerformAction( character, action, framecount := 5, repeatcount := 1, backward := ACTION_DIR_FORWARD, repeatflag := ACTION_NOREPEAT, delay := 1 );

note the variable delay
if you compile with flag "-d" you will see it

MuadDib
Former Developer
Posts: 1090
Joined: Sun Feb 12, 2006 9:50 pm
Location: Cross Lanes, WV

Re: 'Error reading function declaration in module uo'

Post by MuadDib » Sun Aug 16, 2009 10:06 am

Long Live The Ecompile -options!!!!

Yukiko
Distro Developer
Posts: 2736
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: 'Error reading function declaration in module uo'

Post by Yukiko » Mon Aug 17, 2009 3:25 am

My humble and deserved thanks to you guys.

I hadn't had time to dig through every word in that script yet so again THANKS!

Unlike with POL 0.96 I haven't read all the core changes yet for POL 0.98 so I assume that delay was added in POL 0.98 and that's where my script went awry.

And yes, long live The eCompile -options!

And yes OnG using login and logoff as function names wasn't my idea. I didn't write this one. I believe this script is a carry-over from and old Distro but I'm not sure since I've borrowed many scripts over the years. Naturally I could have changed the names but you know how that goes. You're busy fixing things that if ya don't get an error on a function name you don't think about it. I will remember to make changes to the rather ambiguous function names when I find them from now on.

Post Reply