I'm having a strange 'door' issue.

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

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

I'm having a strange 'door' issue.

Post by Yukiko »

I have been attempting to make a custom door that uses a walkon teleport script so that when you cross the threshold of the door you step on the same square that the door occupies and teleport to a preset destination. I don't know if it will behave as I want it to but I was hopeful. To that end I've created a custom ObjType and assigned it the graphic of a door, 0x6AF. The original door, ObjType number 0x6AF is defined in my 'doors' package and works fine. It opens properly. I can walk through it when opened etc. but my custom object exhibits the following behaviour; it opens from the 'handle' side of the door and I am blocked from walking through it when it is opened. It's assigned as a 'door' item in the itemdesc.cfg file. For the life of me I can't understand why it's exhibiting this bizarre behaviour. So I call on the experts to help me out here.

Here is all the relevant info:

Original working door itemdesc info:

Code: Select all

Door 0x06af
{
    Desc	wooden door
    xmod +1
    ymod -1
    script door
    Weight 1
    doortype wood
}

Custom item itemdesc info:

Code: Select all

Door    0x106af
{
       Name     woodendoor99
        Graphic         0x06af
	Script			:doors:door
	WalkOnScript	teleporter
        xmod +1
        ymod -1
	doortype wood
        weight          1
}

My door.src:

Code: Select all

use uo;
use os;
use cfgfile;

include ":doors:doors";
include "include/attributes";

program use_door(chr, door)
  var doordesc, dooroptions, configuration, refresh, flowoption, closelocked, house, hs, ss, sign, item, stuff;
  var friend;
  if(GetObjProperty(door, "#inuse"))
    return;
  endif
  // The following added to prevent doors "opening while in a backpack - Yukiko 01-Aug-2006
        stuff := EnumerateItemsInContainer( chr.backpack );
        foreach item in stuff
            if (item == door)
                return;
            endif
        endforeach
  SetObjProperty(door, "#inuse", 1);
  doordesc := ReadConfigFile("itemdesc");
  dooroptions := ReadConfigFile("door");
  configuration := FindConfigElem(dooroptions, "doors");
  flowoption := lower(GetConfigString(configuration, "OpenFromInside"));
  closelocked := lower(GetConfigString(configuration, "CloseLocked"));
  if((chr.multi) && (!GetObjProperty(door, "Flow")) && (flowoption != "no"))
    run_script_to_completion(":doors:setFlow", chr.multi);
  endif
//  if(IsLocked(chr, door, flowoption, closelocked))
  if(IsLocked(chr, door))
    PrintTextAbovePrivate(door, "That is locked.", chr);
  else
    if(GetObjProperty( door, "WhenOpened" ))
      start_script(":doors:closeDoor", door);
    else
      detach();
      start_script(":doors:openDoor", door);
      foreach potentialdoor in ListObjectsInBox((door.x-1),(door.y-1),(door.z),(door.x+1),(door.y+1),(door.z))
        if(!potentialdoor.hp)
          var doortype := doordesc[potentialdoor.objtype].doortype;
          if((doortype) && (door != potentialdoor))
            if((!potentialdoor.locked) && (!GetObjProperty(potentialdoor, "WhenOpened")))
              start_script(":doors:openDoor", potentialdoor);
            endif
           endif
        endif
      endforeach
    endif
  endif
  EraseObjProperty(door, "#inuse");
endprogram
I didn't include here my doors.cfg file as it only contains settings for stuff like "can the door be closed, if it is locked, by a person who doesn't possess the key." Things like that. If need be I can post that as well.

The confusing part is that my doors.src file specifically uses the next graphic as the 'open door' graphic which works fine for the original working door but the custom door, which uses the same graphic, opens on the wrong side. That and the fact I can't walk on the square to get through the door.

Any insight into this would be helpful.
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: I'm having a strange 'door' issue.

Post by Yukiko »

I found the issue and it has to do with the way my openDoor.src program works. It's looking for the door ObjType in the doors pkg and my custom item was not in that pkg so it never found it. After talking with Nando I realized my idea probably wouldn't work as I wanted it to.
Post Reply