Giwo: What's the new format of CreateBlankItem and CreateDFNItem?
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
Giwo: What's the new format of CreateBlankItem and CreateDFNItem?
Neither seems to work any longer....all I get is a message in console saying 7 arguments are required..
-= Ho Eyo He Hum =-
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
CreateBlankItem( socket, character, amount, "itemName", isStackable, [isString], colour, objectType, inPack, bSend );
note [isString] is optional, so 9-10 args
CreateDFNItem( socket, character, "scriptSection", unused true/false, [amount], [objectType], [inPack], [autoStack(unused)] )
Takes 4-8 params, the last 4 are all optional (but must be in that order if used).
note [isString] is optional, so 9-10 args
CreateDFNItem( socket, character, "scriptSection", unused true/false, [amount], [objectType], [inPack], [autoStack(unused)] )
Takes 4-8 params, the last 4 are all optional (but must be in that order if used).
Scott
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
Well, I think what I'm going to do for the JS engine is map the object type enumerator to a string. IE objectType "item" = OT_ITEM, etc.
The numbers, as they are, are not at all in any order (since they are an enum in the source).
OT_CBO = 0
OT_CHAR = 1
OT_ITEM = 2
OT_MULTI = 3
OT_BOAT = 4
OT_SPAWNER = 5
Note that for your usage (in CreateBlank and CreateDFN Item) only OT_ITEM (IE 2) and OT_SPAWNER (IE 5) are valid.
Thus 2 for a normal item, or 5 for a spawner.
The numbers, as they are, are not at all in any order (since they are an enum in the source).
OT_CBO = 0
OT_CHAR = 1
OT_ITEM = 2
OT_MULTI = 3
OT_BOAT = 4
OT_SPAWNER = 5
Note that for your usage (in CreateBlank and CreateDFN Item) only OT_ITEM (IE 2) and OT_SPAWNER (IE 5) are valid.
Thus 2 for a normal item, or 5 for a spawner.
Scott
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
Hm
This crashes UOX3 for me:
(Part of) the callstack:
This crashes UOX3 for me:
Code: Select all
var itemMade = CreateDFNItem( pUser.socket, pUser, "0x0df8", false, 1, 2, true, false ); //give the player some woolUOX::cBaseObject::GetObjType() line 893 + 3 bytes
UOX::cWeight::subtractItemWeight(UOX::cBaseObject * 0xff00ff06, UOX::CItem * 0x06cc50d8) line 295 + 8 bytes
UOX::CItem::SetAmount(unsigned long 3) line 555
UOX::cItem::CreateScriptItem(UOX::cSocket * 0x06ccccd0, UOX::CChar * 0x06cc5730, std::basic_string<char,std::char_traits<char>,std::allocator<char> > {0x0096ddc1 "0x0df8"}, unsigned long 3, UOX::ObjectType OT_CHAR, unsigned char 0) line 276
UOX::SE_CreateDFNItem(JSContext * 0x01cf9640, JSObject * 0x01ceda58, unsigned int 8, long * 0x02b63614, long * 0x0012e428) line 741 + 57 bytes
JS32! 1001fd71()
01cdb9c8()
01cf9640()
01d17bf8()
01d33348()
01d50f58()
01d6e9b0()
01d8c590()
01daa0b8()
01dc55f8()
01de5968()
...
..
.
-= Ho Eyo He Hum =-
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
I'm seeing some weirdness there....
for one thing, it looks like the amount is 3 instead of 1.
But most importantly, it looks like it's creating a character rather than an item, notice it says UOX::ObjectType OT_CHAR
I'm going to have to watch the JS engine and see if it's modifying values somewhere.
for one thing, it looks like the amount is 3 instead of 1.
But most importantly, it looks like it's creating a character rather than an item, notice it says UOX::ObjectType OT_CHAR
I'm going to have to watch the JS engine and see if it's modifying values somewhere.
Scott
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
Heh, ewps
Was looking at old source for params for those two functions *smacks self*
This is the format...
CreateDFNItem( socket, character, "itemsection", [amount], [objectType], [spawnInPack(true/false)] );
Min 3 args, max 6 args
CreateBlankItem( socket, character, amount, "itemName", ID, color, objectType, spawnInPack(true/false) );
Must be 7 args
Was looking at old source for params for those two functions *smacks self*
This is the format...
CreateDFNItem( socket, character, "itemsection", [amount], [objectType], [spawnInPack(true/false)] );
Min 3 args, max 6 args
CreateBlankItem( socket, character, amount, "itemName", ID, color, objectType, spawnInPack(true/false) );
Must be 7 args
Scott
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
So...
becomes
?
And here I've already gone through all my scripts and fixed 'em up to use 2
heh..
Code: Select all
var itemMade = CreateDFNItem( pUser.socket, pUser, "0x103b", 1, 2, true ); // makes a loaf of breadCode: Select all
var itemMade = CreateDFNItem( pUser.socket, pUser, "0x103b", 1, "ITEM", true ); // makes a loaf of breadAnd here I've already gone through all my scripts and fixed 'em up to use 2
-= Ho Eyo He Hum =-
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
Apparently it's only the CreateDFNItem which works.
The following gives an error in console:
The error:
The following gives an error in console:
Code: Select all
var tempItem = CreateBlankItem( pSock, pUser, 1, "#", 0x04a9, 0x0, "ITEM", false );| ERROR: CreateBlankItem: Invalid number of arguments (takes 7)
-= Ho Eyo He Hum =-