Custom Housing Tool

Here you can post threads specific to the current release of the core (099)
Post Reply
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Custom Housing Tool

Post by RusseL »

Hi Turley!
can you give us some examples please, what is Custom Housing Tool, how it's work,
example of syshook?
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Custom Housing Tool

Post by Turley »

mmmh
on my testserver i have added a foundation (multiid 0x13ec - 0x147b)
then i have a textcmd with:

Code: Select all

who.multi.setcustom(1);
SendHousingTool(who,who.multi);
(this should be better added into your sign gump)

this is enough to play around with it

my hook currently only has debug prints:

Code: Select all

Exported Function HookCustomHouseCommit(who,house, itemarray)
	print(itemarray);
	print(house.components);
	return 1;
EndFunction
this should be more like:

Code: Select all

(pseudocode)
Exported Function HookCustomHouseCommit(who,house, itemarray)
  if (!sendgumpyesno("are you sure"))
    return 0;
  var oldprice:=CInt(house.getprop("price"));
  var newprice:=CalcCosts(house.components,itemarray); // i think on osi its just a simple (house.components.size()+itemarray.size())*basecost
  house.setprop("price",newprice); // store it for the next commit
  var gold:=newprice - oldprice;
  if (gold>0)
    if (!who.spendgold(gold))
      return 0;
    endif
  else
    GiveGoldToPlayer(who,gold); // ...
  endif
  foreach component in house.components
    if (component.graphic >= 0x181D and component.graphic <= 0x1828)
      //link the teleporters with your teleportersystem
      //on osi teleporters with the same graphic get linked
    elseif (component.isa(POLCLASS_DOOR))
     //modify if needed for your doorsystem
    endif
  endforeach
  return 1;
endfunction
something like that
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Re: Custom Housing Tool

Post by *Edwards »

SendHousingTool(who,who.multi); is not found in any module. How can we use it?
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: Custom Housing Tool

Post by CWO »

That's because only cool people have it Edwards... :-P

joking aside, its a hidden feature of uo.em, you have to add the line in your uo.em yourself...


SendHousingTool(who, multi);
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Custom Housing Tool

Post by Terciob »

Turley, syshook was removed but scripts/misc/customhousecommit.ecl seems not work.

I've tested with this:

use uo;
program CustomHouseTool ( who, house, elem )
broadcast ("Size: " + elem.size());
house.acceptcommit(0);
return 1;
endprogram

But, no broadcast, and pol accept the commit even acceptcommit(0).
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Re: Custom Housing Tool

Post by *Edwards »

OMG!

Nobody said it before :blush:

Let's test this awesome tool now :D

It's frustrating to not have heard of it before.




Edit: Ok so it only calls the hook. I started to script the gump side the other day when someone told me it wasn't necessary because it's already built-in for the next release which is not coming soon I think. This might be the only major feature missing with POL. I'm just expecting it to come available for us very soon. Let's hope for the best..
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Custom Housing Tool

Post by Turley »

Terciob wrote:Turley, syshook was removed but scripts/misc/customhousecommit.ecl seems not work.

I've tested with this:

use uo;
program CustomHouseTool ( who, house, elem )
broadcast ("Size: " + elem.size());
house.acceptcommit(0);
return 1;
endprogram

But, no broadcast, and pol accept the commit even acceptcommit(0).
fixed in rev333
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Custom Housing Tool

Post by Terciob »

Thanks Turley script is running now.

But, acceptcommit() seems to not work properly yet: when i press commit button, script run okey but my chr is Not moved out of the house, the gump of editing tool remains opened on my screen and house design do not change even house.acceptcommit(1).
If i close the gump with right mouse button (the only way to close it) next "sendhousingtool (chr, house)" returns "House currently being waiting for a commit" even if i press commit button and use house.acceptcommit(1) on script before.
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Custom Housing Tool

Post by Turley »

You should print the result of .acceptcommit() :)
I changed the params its now (chr,1/0)
but i also missed 2 files to commit, check rev334
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Re: Custom Housing Tool

Post by *Edwards »

How to get the newest pol099Beta.exe for windows? I'd like to test it live!
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Re: Custom Housing Tool

Post by *Edwards »

It would be awesome if some new function uo.em are added to commit items around the worlds and not always into multis. If it's possible :D.

By the way, I test it today and it's simply funtastic! Good job again :)
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Re: Custom Housing Tool

Post by CWO »

*Edwards wrote:It would be awesome if some new function uo.em are added to commit items around the worlds and not always into multis. If it's possible :D.
likely not possible. I haven't looked into the packet breakdown yet but I know theres a packet that sends the revision number of the house to the client and if its newer than what the client has, the server will send the whole house piece by piece to the client for caching... And the client will hold only a limited number of houses so exploiting this for individual items will have a very nasty outcome if the items in the game world were individually counted as "houses"...
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Custom Housing Tool

Post by Terciob »

Rev334 is okey. I only miss a script running when player close the edit gump with mouse right click, because if necessary write some CProps on player on beginning of editing, can't erase later.
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Custom Housing Tool

Post by Terciob »

Need a error when DestroyMulti(multi) is called and house.house_editing is true. Also missing a house.cancel_editing (chr).
Something seems weird when click to change between floors, many times is necessary a Sync after this because downstairs just disappear.
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Custom Housing Tool

Post by Turley »

K thx for the input I hopefully have time this weekend.
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Custom Housing Tool

Post by Turley »

sorry for the delay check rev. 353
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Custom Housing Tool

Post by Terciob »

Amazing job Turley, thanks so much.

Hey, if you click on Restore without click on backup first entire house disappear even the foundation.

Last saturday (08/27) we tried use new core (350), but had bad time with it, weird troubles like this happen all the time:
Assertion Failed: my_multidefs_by_graphic.count( graphic ) != 0, multi\multidef.cpp, line 294
Shutting down due to assertion failure.
Client#22: Exception in message handler 0xd7: Assertion Failed: my_multidefs_by_graphic.count( graphic ) != 0, multi\multidef.cpp, line 294
0000: d7 00 19 03 42 37 55 00 0d 00 00 00 1d cf 00 00 ....B7U. ........
0010: 00 00 01 00 ff ff ff fe 0a ........ ........
Client#22: Exception in i/o thread: Assertion Failed: my_multidefs_by_graphic.count( graphic ) != 0, multi\multidef.cpp, line 294! (checkpoint=4)
Then we switch to old core and this stoped. Need recompile? i sow no changes in ecompile. I've tried re-uoconvert but had problem with graphic 0x0, seems like new uoconvert does not use any more 0x4000 > items.
Also, we had a very (a lot) weird invalid packet flood, from someone. All this is inside the file bellow.
Full pol.log: http://www.4shared.com/file/1kOPttVP/po ... 08-27.html

Yesterday we tried again use new core (252), had a looooot of crashes:
image: Image
This is just-to-report, i need to make more tests to get usefull information about this issue.

Our 'oficial core' are @334, with this we had only random crashes when players make commit on houses, but is rare.
Post Reply