PenUltima Online

It is currently Fri Sep 05, 2008 1:49 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Beginners problems
PostPosted: Wed Jun 25, 2008 1:44 am 
Offline

Joined: Sat Apr 08, 2006 4:09 am
Posts: 28
Hi.

I'm new to Escripting and the only real base I have is a very small knowledge of C++. I have been reading through the guide for Escript in the Documentations section, and I understand it quite well.

The problem is, the scripts I create aren't working, and I just can't figure out why!

First of all, I pretty much copied and pasted the "return ring" script into various locations of my server, and the compiling goes well.
What goes wrong is that when I then create the item inside UO, it can't be doubleclicked, I just get the normal "don't know what to do with this" message. Inside the server window I also get an error message:

Exception caught while loading script scripts/items/return_ring.ecl: Unable to open scripts/items/return_ring.ecl for reading.
Unable to read script 'scripts/items/return_ring.ecl

I've done everything the right way, I think, so I'm guessing the problem lies elsewhere. Here's a few copypastes of what I've used.

config\itemdesc.cfg:

Code:
Item 0x5000
{
   Name      ring_of_returning
   Desc      Ring of Returning
   Graphic      0x108A
   Color      72
   Script      return_ring
}



pkg\items\return_ring-src:

Code:
use uo;

program ReturnRing(player, ring)
// remember this is a usescript, and the variables 'player' and 'ring'
// are the parameters passed to the script by the POL core.

  var x,y,z;

  x := GetObjProperty(player, "x_corpse");
  y := GetObjProperty(player, "y_corpse");
  z := GetObjProperty(player, "z_corpse");

  if ( (x == error) or (y == error) or (z == error) )
    SendSysMessage(player, "Could not find your corpse");
    return 0; //exits the script
  endif

  MoveObjectToLocation(player, x, y, z);

  EraseObjProperty(player, "x_corpse");
  EraseObjProperty(player, "y_corpse");
  EraseObjProperty(player, "z_corpse");

  DestroyItem(ring);
endprogram



That's it. Any help is appreciated.

Thanks / Lunne


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 25, 2008 2:42 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 747
Location: Chicago, IL USA
Just wondering... is the ecompile.exe the same one that came with the pol.exe that you're using? The script is fine and should compile. There's something fishy about trying to load the file though and that's usually the first thing I ask people. If you mix files from different versions or subversions of POL, you run into a lot of problems.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 25, 2008 4:02 am 
Offline

Joined: Sat Apr 08, 2006 4:09 am
Posts: 28
I've downloaded nothing but the POL097 core and distro, so that shouldn't be a problem.

I just realized what the problem is, and I'm such an idiot.

"Exception caught while loading script scripts/items/return_ring.ecl: Unable to open scripts/items/return_ring.ecl for reading."

"pkg\items\return_ring-src:"

I've put the files in the pkg\items folder, and that isn't allowed for some reason. When I moved the files to scripts\items the problem was solved.

Thanks for the help though!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 26, 2008 4:17 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 747
Location: Chicago, IL USA
ahh yes. \pkg\ is the script packages path. Folders here have to have a pkg.cfg with the minimum required parameters in the cfg for POL to read that path since it allows access to those scripts in a little different of a manner.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl