PenUltima Online

It is currently Tue Oct 07, 2008 1:15 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 24 posts ] 
Author Message
 Post subject: Vendor placing..
PostPosted: Sat May 06, 2006 6:05 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Hey in vendordeed.scr i found this line:

if(!sign)
SendSysMessage(who, "You cannot place a vendor here.");
return;

And wondered if i changed it to this or somehting like this if it would work:
var tile := 0x0000
if(!sign or !tile)
SendSysMessage(who, "You cannot place a vendor here.");
return;

So that i could place on those tiles also.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 6:49 am 
Offline
User avatar

Joined: Sat Feb 04, 2006 8:17 am
Posts: 144
Location: Illinois, USA
Yes that should work like you want.

_________________
2nd place is the 1st loser.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 7:11 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Is somethign wrong wiht this because its sitl giving me "You can't place your vendor here" Yes i have the correct obj types

Code:
use os;
use uo;
include "include/canAccess";
include "include/attributes";

const SEARCH_RANGE := 10;

program makevendor(who, deed)
  EraseObjProperty(who, "IsMeditating");
  EraseObjProperty(who, "HealTimer");
  if(!can_access(who, deed))
    return;
  endif
  if(!ReserveItem(deed))
    return;
  endif
  var place;
  if(who.multi.serial)
    var multi := who.multi;
    var sign;
    foreach thing in (multi.components)
      if(thing.objtype == 0xbd2)
        sign := thing;
    var tile := 0xecb9;
        break;
      endif
    endforeach
    var tile := 0xecb9;
    if(!sign or !tile)
      SendSysMessage(who, "You cannot place a vendor here.");
      return;
    endif
    if(!GetObjProperty(sign, "Public"))
      SendSysMessage(who, "You can only place vendors in public houses.");
      return;
    endif
    place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
    if(!place)
      SendSysMessage( who, "Your vendor has not been created");
      return;
    else
      SendSysMessage(who, "You have successfully created a vendor");
      SetObjProperty(place, "master", who.serial);
      SetObjProperty(place, "mn", who.name);
      SetObjProperty(place, "r", 1500);
      if(!DestroyItem(deed))
        RevokePrivilege(place, "invul");
        SetObjProperty(place, "guardkill", 1);
        ApplyRawDamage(place, (GetHp(place) + 5));
      endif
    endif
  else
   SendSysMessage( who, "You cannot place your vendor here");
   return;
  endif
endprogram


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 10:22 am 
Offline
User avatar

Joined: Sat Feb 04, 2006 8:17 am
Posts: 144
Location: Illinois, USA
What script set are you using? This looks like the sanctuary scripts.

Now that I see your entire script I can see where you put this and what is causing the problem.

Do you just want to be able to place your vendors in set up areas only or anyplace?

_________________
2nd place is the 1st loser.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 10:24 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Im using 095, service pack 2... and i justw ant them to be able to place in a house or those tiles


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 10:31 am 
Offline
User avatar

Joined: Sat Feb 04, 2006 8:17 am
Posts: 144
Location: Illinois, USA
You are calling out the tile variable twice to start with. Just call it out once with the objtype you want.

Since you only want vendors placed on this one tile type just do a check for that tile. I set up regions myself for vendors to go in. It made things a little easier overall.

_________________
2nd place is the 1st loser.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 10:37 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Well everyone here should know me be now.. im not smart enough to do a check for it.. and actually a region would work, but i have no idea how to make one. Although i would prefer a tile


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 10:49 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
hey, couldnt i "trick" it into thinking that a tile is a sign by doing this
Original:
if(thing.objtype == 0xbd2)
sign := thing;
break;
endif

Modified:
if(thing.objtype == 0xbd2 or 0xecb9)
sign := thing;
break;
endif

nope.. doesnt work..


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 12:25 am 
Offline
User avatar

Joined: Fri Feb 03, 2006 2:25 am
Posts: 56
Location: Germany, Franconia
If I understand it right, you want to place vendors in houses that haven't got signs? Then this may help. It checks for a housesign or an object of type 0xecb9 within RANGE tiles. Player has to be in a multi tho.
To let vendors be placed anywhere when there's an object of type 0xecb9 near, just put in the ListItemsNearLocationOfType statement as an elseif condition.

Code:
const RANGE:= 5;

program makevendor(who, deed)
  [...]
  if (who.multi.serial)
    [...]
    if (!sign && !(ListItemsNearLocationOfType (who.x, who.y, who.z, RANGE, 0xecb9).size () > 0))
      SendSysMessage (who, "You cannot place a vendor here.");
      return 0;
    endif
    [...]
  else
    SendSysMessage (who, "You cannot place your vendor here");
    return 0;
  endif

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 1:41 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
EScript Compiler v1.03
Copyright (C) 1994-2003 Eric N. Swanson

Compiling: E:/pol/scripts/items/vendorDeed.src
Variable sign has not been declared on line 29.
Error compiling statement at E:\pol\scripts\items\vendorDeed.src, Line 19
Error detected in program body.
Error occurred at E:\pol\scripts\items\vendorDeed.src, Line 29
Execution aborted due to: Error compiling file

E:\pol\scripts>

No im not stupid, sign HAS been declared.



Code:
use os;
use uo;
include "include/canAccess";
include "include/attributes";

const SEARCH_RANGE := 10;
const RANGE:= 0;
program makevendor(who, deed)
var tile := 0xecb9;
  EraseObjProperty(who, "IsMeditating");
  EraseObjProperty(who, "HealTimer");
  if(!can_access(who, deed))
    return;
  endif
  if(!ReserveItem(deed))
    return;
  endif
  var place;
  if(who.multi.serial)
    var multi := who.multi;
    var sign := 0xdb2;
    foreach thing in (multi.components)
      if(thing.objtype == 0xbd2)
        sign := thing;
        break;
      endif
    endforeach
    elseif (!sign && !(ListItemsNearLocationOfType (who.x, who.y, who.z, RANGE, 0xecb9).size () > 0))
      SendSysMessage(who, "You cannot place a vendor here.");
      return;
    if(!GetObjProperty(sign, "Public"))
      SendSysMessage(who, "You can only place vendors in public houses.");
      return;
    endif
    place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
    if(!place)
      SendSysMessage( who, "Your vendor has not been created");
      return;
    else
      SendSysMessage(who, "You have successfully created a vendor");
      SetObjProperty(place, "master", who.serial);
      SetObjProperty(place, "mn", who.name);
      SetObjProperty(place, "r", 1500);
      if(!DestroyItem(deed))
        RevokePrivilege(place, "invul");
        SetObjProperty(place, "guardkill", 1);
        ApplyRawDamage(place, (GetHp(place) + 5));
      endif
    endif
  else
   SendSysMessage( who, "You cannot place your vendor here");
   return;
  endif
endprogram


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 09, 2006 9:25 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 770
Location: Chicago, IL USA
yes but its inside the IF.

Code:
  if(who.multi.serial)
    var multi := who.multi;
    var sign := 0xdb2;
    ...
  elseif (!sign && !(ListItemsNearLocationOfType (who.x, who.y, who.z, RANGE, 0xecb9).size () > 0))


look at that a little closer. You have to declare it before the IF if you're going to use it in the ELSEIF part.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 11, 2006 1:56 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Ok you know what, forget allt hat i have bad luck it will NEVER work, how do i let a "region" or an area be placable?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 11, 2006 8:22 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 770
Location: Chicago, IL USA
Actually, I think I possibly know what you're getting at. I'm a bit tired but its only a couple lines to change so try it...


Code:
    elseif (!sign && !(ListItemsNearLocationOfType (who.x, who.y, who.z, RANGE, 0xecb9).size () > 0))
      SendSysMessage(who, "You cannot place a vendor here.");
      return;


change that to this...

Code:
    if (!sign && !(ListItemsNearLocationOfType (who.x, who.y, who.z, RANGE, 0xecb9).size () > 0))
      SendSysMessage(who, "You cannot place a vendor here.");
      return;
    endif


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 12, 2006 3:55 am 
Offline

Joined: Thu Feb 02, 2006 8:33 am
Posts: 296
I think first of all you should tell us what 0xecb9 is exactly. Is that a sign or is that simple tile on which vendors could be placed? In both cases we need to now if it is a house component or not.

If i assume it is a sign, your script could look like this (not tested!!):

Code:
use os;
use uo;
include "include/canAccess";
include "include/attributes";

program makevendor(who, deed)

  EraseObjProperty(who, "IsMeditating");
  EraseObjProperty(who, "HealTimer");
  if(!can_access(who, deed))
    return;
  endif
  if(!ReserveItem(deed))
    return;
  endif
  var multi,sign;
  var signs := {0xbd2,0xecb9};
  if(who.multi.serial)
   multi := who.multi;
   foreach thing in (multi.components)
    if(thing.objtype in signs)
     sign := thing;
     break;
    endif
   endforeach
  else
   SendSysMessage(who, "You cannot place a vendor here.");
   return;
  endif
  if(!sign)
   SendSysMessage(who, "You cannot place a vendor here.");
   return;
  endif
  if(!GetObjProperty(sign, "Public"))
   SendSysMessage(who, "You can only place vendors in public houses.");
   return;
  endif
  var place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
  if(!place)
   SendSysMessage( who, "Your vendor has not been created");
   return;
  else
   SendSysMessage(who, "You have successfully created a vendor");
   SetObjProperty(place, "master", who.serial);
   SetObjProperty(place, "mn", who.name);
   SetObjProperty(place, "r", 1500);
   if(!DestroyItem(deed))
    RevokePrivilege(place, "invul");
    SetObjProperty(place, "guardkill", 1);
    ApplyRawDamage(place, (GetHp(place) + 5));
   endif
  endif

endprogram



And perhaps a few tips on how you can find such errors very fast.
If you are doing in on a test server, put in some broadcast giving out variables or whatever so you can see where the problem is, e.g.

Code:
    if(thing.objtype in signs)
     sign := thing;
broadcast("Sign found. ObjType is: " + sign.objtype);
     break;
    endif


If it is a live server you better do it this way:

Code:
    if(thing.objtype in signs)
     sign := thing;
if(who.cmdlevel)
SendSysMessage(who, "Sign found. ObjType is: " + sign.objtype);
endif
     break;
    endif


You only need to recompile the script an unload it (if it is unloadable).


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 12, 2006 5:24 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Its a tile, but forget that, i just wnat a region please.. or if not then i guess houses will do..


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 6:19 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Ok, everyone that is trying to help thanks but forget all that because now ill just do i region, please guide me on what to do here is my current script:

Code:
use os;
use uo;
include "include/canAccess";
include "include/attributes";

const SEARCH_RANGE := 10;

program makevendor(who, deed)
  EraseObjProperty(who, "IsMeditating");
  EraseObjProperty(who, "HealTimer");
  if(!can_access(who, deed))
    return;
  endif
  if(!ReserveItem(deed))
    return;
  endif
  var place;
  if(who.multi.serial)
    var multi := who.multi;
    var sign;
    foreach thing in (multi.components)
      if(thing.objtype == 0xbd2)
        sign := thing;
        break;
      endif
    endforeach
    if(!sign)
      SendSysMessage(who, "You cannot place a vendor here.");
      return;
    endif
    if(!GetObjProperty(sign, "Public"))
      SendSysMessage(who, "You can only place vendors in public houses.");
      return;
    endif
    place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
    if(!place)
      SendSysMessage( who, "Your vendor has not been created");
      return;
    else
      SendSysMessage(who, "You have successfully created a vendor");
      SetObjProperty(place, "master", who.serial);
      SetObjProperty(place, "mn", who.name);
      SetObjProperty(place, "r", 1500);
      if(!DestroyItem(deed))
        RevokePrivilege(place, "invul");
        SetObjProperty(place, "guardkill", 1);
        ApplyRawDamage(place, (GetHp(place) + 5));
      endif
    endif
  else
   SendSysMessage( who, "You cannot place your vendor here");
   return;
  endif
endprogram



And i've got no idea where to start


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 12:04 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 770
Location: Chicago, IL USA
Do you want them to be able to place outside and in their house? Just confined to one region?

if(who.multi.serial)
.....
else
SendSysMessage( who, "You cannot place your vendor here");
return;
endif

that would be a good place to start...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 12:19 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
I want them to be able to place anywhere in that region AND thier houses outside of that region


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 2:51 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
I just realized how dumb i am.. Can a moderator move this topic to scripting support.. sorry


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 8:57 pm 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 770
Location: Chicago, IL USA
ok, so what you do here is

Code:
program makevendor(who, deed)
  EraseObjProperty(who, "IsMeditating");
  EraseObjProperty(who, "HealTimer");
  if(!can_access(who, deed))
    return;
  endif
  if(!ReserveItem(deed))
    return;
  endif
  var place;
  if(who.multi.serial)
    var multi := who.multi;
    var sign;
    foreach thing in (multi.components)
      if(thing.objtype == 0xbd2)
        sign := thing;
        break;
      endif
    endforeach
    if(!sign)
      SendSysMessage(who, "You cannot place a vendor here.");
      return;
    endif
    if(!GetObjProperty(sign, "Public"))
      SendSysMessage(who, "You can only place vendors in public houses.");
      return;
    endif
    CreateVendor(who, deed);
  elseif ((who.x > leftx) && (who.x < rightx) && (who.y > topy) && (who.y < bottomy))
    CreateVendor(who, deed);
  else
   SendSysMessage( who, "You cannot place your vendor here");
   return;
  endif
endprogram

function CreateVendor(who, deed)
    place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
    if(!place)
      SendSysMessage( who, "Your vendor has not been created");
      return;
    else
      SendSysMessage(who, "You have successfully created a vendor");
      SetObjProperty(place, "master", who.serial);
      SetObjProperty(place, "mn", who.name);
      SetObjProperty(place, "r", 1500);
      if(!DestroyItem(deed))
        RevokePrivilege(place, "invul");
        SetObjProperty(place, "guardkill", 1);
        ApplyRawDamage(place, (GetHp(place) + 5));
      endif
    endif
endfunction



then declare these variables at the top of your script

var leftx := // The leftmost X (or western border) of your region
var rightx := // The rightmost X (or eastern border)
var topy := // The topmost Y (or northern border)
var bottomy := // The bottommost border (or southern border)

Be aware that the script I put there does no other checking of any kind if you're within the region box unless you're in a house then it will do all house checks. If you want to add extra checks and restrictions for your region, add them after
elseif ((who.x > leftx) && (who.x < rightx) && (who.y > topy) && (who.y < bottomy))


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 9:26 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Thank you, no you didnt solve my problem, you opened a new gateway to how i could place vendors on these tiles :)

Simple simple simple..:

For further refrence:
Quote:
use os;
use uo;
include "include/canAccess";
include "include/attributes";

program makevendor(who, deed)
EraseObjProperty(who, "IsMeditating");
EraseObjProperty(who, "HealTimer");
if(!can_access(who, deed))
return;
endif
if(!ReserveItem(deed))
return;
endif
var place;
if(who.multi.serial)
var multi := who.multi;
var sign;
foreach thing in (multi.components)
if(thing.objtype == 0xbd2)
sign := thing;
break;
endif
endforeach
if(!sign)
SendSysMessage(who, "You cannot place a vendor here.");
return;
endif
if(!GetObjProperty(sign, "Public"))
SendSysMessage(who, "You can only place vendors in public houses.");
return;
endif
CreateVendor(who, deed);
elseif (0xecb9)
CreateVendor(who, deed);

else
SendSysMessage( who, "You cannot place your vendor here");
return;
endif
endprogram

function CreateVendor(who, deed)
var place := CreateNpcFromTemplate("playervendor", who.x, who.y, who.z);
if(!place)
SendSysMessage( who, "Your vendor has not been created");
return;
else
SendSysMessage(who, "You have successfully created a vendor");
SetObjProperty(place, "master", who.serial);
SetObjProperty(place, "mn", who.name);
SetObjProperty(place, "r", 1500);
if(!DestroyItem(deed))
RevokePrivilege(place, "invul");
SetObjProperty(place, "guardkill", 1);
ApplyRawDamage(place, (GetHp(place) + 5));
endif
endif
endfunction



Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 21, 2006 9:28 pm 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
Err i take that back.. sigh, it lets you place it anywhere in the world..


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 12:34 am 
Offline

Joined: Sat Feb 04, 2006 5:49 pm
Posts: 770
Location: Chicago, IL USA
what did you set leftx, rightx, topy, bottomy to?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 7:11 am 
Offline

Joined: Fri Apr 14, 2006 9:36 am
Posts: 240
I got it working, your s had a few bugs that i managed to fix, and its working great now thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 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