I'm trying to modify the package sendbuywindow, prentem modify the values of prices and description of the name.
using the code below does not get any success yet, it seems that the package remains unchanged.
Code: Select all
use uo;
use os;
use storage;
use polsys;
const OFFSET_CMD := 0;
const OFFSET_BLOCK := 1;
const OFFSET_ID := 3;
const OFFSET_N_ITEMS := 7;
const OFFSET_ITEM := 8;
program openbuywindow()
print( "INSTALLING: New Buy Window..." );
return 1;
endprogram
exported function newbuywindow(who, byref packet)
Broadcast(packet);
var cmd := packet.GetInt8(OFFSET_CMD);
var block := packet.GetInt16(OFFSET_BLOCK);
var id := packet.GetInt32(OFFSET_ID);
var num_items := packet.GetInt8(OFFSET_N_ITEMS);
var backpack := SystemFindObjectBySerial(id);
var length:=OFFSET_ITEM;
var n_items:=0;
var tamm;
var name;
var items_backpack:=EnumerateItemsInContainer(backpack);
items_backpack.Reverse();
foreach items in items_backpack;
packet.SetInt32(length, items.VendorSellsFor + 100 );
name:="new "+items.desc;
packet.SetInt8(length+4, len(name));
packet.SetString(length+4+1, name,1);
length:=length+4+1+(len(name));
sleepms(1);
endforeach
return 1;
endfunctionAnother question is about the values of BYTE [1] and cmd BYTE [2] blockSize what they mean? I tried to create the package from the beginning too, but I do not know what values I assign to cmd and blocksize.
What am I doing wrong?