Beginners problems

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Lunne
New User
Posts: 28
Joined: Sat Apr 08, 2006 4:09 am

Beginners problems

Post by Lunne »

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: Select all

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

pkg\items\return_ring-src:

Code: Select all

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
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

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.
Lunne
New User
Posts: 28
Joined: Sat Apr 08, 2006 4:09 am

Post by Lunne »

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!
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

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.
Post Reply