Page 1 of 1

Custom Housing Tool

Posted: Fri May 20, 2011 2:22 am
by RusseL
Hi Turley!
can you give us some examples please, what is Custom Housing Tool, how it's work,
example of syshook?

Re: Custom Housing Tool

Posted: Fri May 20, 2011 5:12 am
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

Re: Custom Housing Tool

Posted: Fri May 27, 2011 12:26 pm
by *Edwards
SendHousingTool(who,who.multi); is not found in any module. How can we use it?

Re: Custom Housing Tool

Posted: Fri May 27, 2011 8:55 pm
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);

Re: Custom Housing Tool

Posted: Tue May 31, 2011 1:16 pm
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).

Re: Custom Housing Tool

Posted: Tue May 31, 2011 7:03 pm
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..

Re: Custom Housing Tool

Posted: Sat Jun 04, 2011 3:29 am
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

Re: Custom Housing Tool

Posted: Sat Jun 04, 2011 7:55 am
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.

Re: Custom Housing Tool

Posted: Sun Jun 05, 2011 5:07 am
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

Re: Custom Housing Tool

Posted: Sun Jun 05, 2011 1:24 pm
by *Edwards
How to get the newest pol099Beta.exe for windows? I'd like to test it live!

Re: Custom Housing Tool

Posted: Sun Jun 12, 2011 1:35 pm
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 :)

Re: Custom Housing Tool

Posted: Sun Jun 12, 2011 3:07 pm
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"...

Re: Custom Housing Tool

Posted: Tue Jun 14, 2011 5:11 pm
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.

Re: Custom Housing Tool

Posted: Tue Jun 28, 2011 5:54 pm
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.

Re: Custom Housing Tool

Posted: Tue Jun 28, 2011 7:58 pm
by Turley
K thx for the input I hopefully have time this weekend.

Re: Custom Housing Tool

Posted: Sat Sep 03, 2011 12:16 am
by Turley
sorry for the delay check rev. 353

Re: Custom Housing Tool

Posted: Sat Sep 03, 2011 1:46 pm
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.