So I want to start fiddling around with using packets. I want to start really simple.
Can someone help me write an addon that simply trades an item to an NPC ? Buys an item from NPC? I don't know how to record incoming packets.
Posted 06 April 2015 - 08:23 PM
So I want to start fiddling around with using packets. I want to start really simple.
Can someone help me write an addon that simply trades an item to an NPC ? Buys an item from NPC? I don't know how to record incoming packets.
Posted 06 April 2015 - 08:45 PM
I strongly recommend against trying to start with buying from or selling to NPCs, screwing it up is a very good way to get yourself banned.
Posted 06 April 2015 - 08:47 PM
I strongly recommend against trying to start with buying from or selling to NPCs, screwing it up is a very good way to get yourself banned.
It's okay I'm practicing on my private server.
Posted 07 April 2015 - 05:20 AM
You should hit us up on IRC, people are always happy to help (if you catch them awake). But it's a lot to explain sometimes and requires a bit of dialogue, forums are not a good place to get started with this. Until then you can check out this addon to help you analyze packets. Like Iryoku said, buying/selling is a bit dangerous if you don't do it right, but it's actually rather simple to get right, as long as you know how to do it.
Posted 08 April 2015 - 04:20 AM
If this addon does what I think it does that would be perfect. However, I don't know how to work it.
//packetviewer start? record?
Posted 08 April 2015 - 07:45 AM
Posted 09 April 2015 - 08:23 AM
How do I format
{ctype='unsigned int[9]'
I understand that 'unsigned int' = I but what do I put for unsigned int[9]
Posted 09 April 2015 - 11:16 AM
What do you mean, I? For packing? You shouldn't need to do it manually. You should be able to assign values directly:
packets = require('packets') p = packets.new('outgoing', id) p['Something 1'] = 300 p['Something 2'] = 4545 p['Something 5'] = 12
Posted 09 April 2015 - 06:13 PM
require('pack')
windower.register_event('incoming chunk',function(id, data)
if id ==0x017then
local header, mode, gm, zone, sender, message = data:unpack('iCBHS16z')
if mode ==0then
local new_mode =1
local adjusted_data ='iCBHS16z':pack(header, new_mode, gm, zone, sender, message)
return adjusted_data
end
end
end)
I've been fooling around with it that way. How would I write the above using the method you're telling me to use?
Posted 09 April 2015 - 10:13 PM
packets = require('packets') windower.register_event('incoming chunk', function(id, data) if id ~= 0x017 then return end packet = packets.parse('incoming', data) packet['Mode'] = 1 return packets.build(packet) end
Posted 09 April 2015 - 10:15 PM
It even says on the very page you got your example from:
Note that this is just demonstrative for how string.pack and string.unpack can be used. For general packet reading and manipulation you may want to use the Packets library.
Posted 09 April 2015 - 10:24 PM
packets = require('packets') windower.register_event('incoming chunk', function(id, data) if id ~= 0x017 then return end packet = packets.parse('incoming', data) packet['Mode'] = 1 return packets.build(packet) endsuhweeeeeeeet thanks a ton.
edit: just tried to load that addon and it says lua run time error attempt to call string.
Posted 10 April 2015 - 02:40 AM
packets = require('packets') windower.register_event('incoming chunk', function(id, data) if id ~= 0x017 then return end packet = packets.parse('incoming', data) packet['Mode'] = 1 return packets.build(packet) end)
That one wasn't terrible to spot, but generally speaking it's been my experience that, unless you can easily spot the error that's causing the file to return that error message, you should immediately give up and toss the code into an IDE. That error message means nothing.
Posted 10 April 2015 - 02:48 AM
packets = require('packets') windower.register_event('incoming chunk', function(id, data) if id ~= 0x017 then return end packet = packets.parse('incoming', data) packet['Mode'] = 1 return packets.build(packet) end)That one wasn't terrible to spot, but generally speaking it's been my experience that, unless you can easily spot the error that's causing the file to return that error message, you should immediately give up and toss the code into an IDE. That error message means nothing.
what was the error?
Posted 10 April 2015 - 05:12 AM
nvm see it after staring for like 10minutes lol
Posted 14 April 2015 - 05:15 AM
If I'm trying to edit a packet that involves an item's name how do I properly do that?
packet['Item'] = 'item name here' gives me an error saying it expected a # but got string.
Posted 14 April 2015 - 05:59 AM
figured it out
Posted 14 April 2015 - 06:03 AM
I'm not aware of any packet that uses item names. Can you tell me which one it is?
Posted 14 April 2015 - 09:25 PM
it's item IDs
perhaps you can help me out a bit.
I broke my Send delivery box (0x04B) there is an item stuck in delivery slot 0 (first box) that I can't remove and I can't send anything else or do anything anymore.
0 members, 1 guests, 0 anonymous users