Solved Packet question

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Wynnevir

Well-Known Member
Jul 9, 2017
1,015
62
48
30
Elsewhere
Skript: Bensku 2.2 dev 29
MC: 1.12.1

Right so I'm trying to comprehend packets. Can someone tell me what I'm doing incorrect here and why it doesn't work? My only goal with this code is just exploring what syntax works to better understand it.
So in testing this works:
code_language.skript:
on packet event play_server_open_sign_editor:
    broadcast "test"
But this can't be understood as an event. That's the error on reload.
code_language.skript:
command /test:
    trigger:
        send player packet play_server_open_sign_editor

addons: Mundosk, tuske, skquery, wolvsk, skrayfall, sharpsk, skellet (all up to date)
ProtocolLib
 
Last edited:
Yes, sorry should have included that. I do have the most recent version of ProtocolLib, and that first test code does work. if I place a sign it broadcasts "test".
Crap, I should have recognized that your first code actually works because I thought it didn't.

Have you tried something like this:
code_language.skript:
set {_packet} to new play_server_open_sign_editor packet
send player packet {_packet}
 
Crap, I should have recognized that your first code actually works because I thought it didn't.

Have you tried something like this:
code_language.skript:
set {_packet} to new play_server_open_sign_editor packet
send player packet {_packet}
Yass, that works. So make packet then send packet. Thank you so much:emoji_grinning:
onward to some more testing
 
While that does work, I'm not sure if you know but the "new %packettype% packet" syntax just makes a container for it, sending/recieving the container won't really do anything
 
While that does work, I'm not sure if you know but the "new %packettype% packet" syntax just makes a container for it, sending/recieving the container won't really do anything
Are you able to elaborate a bit more on what you mean by "won't do anything"? Does that mean I cannot get the information from the packet?
 
Are you able to elaborate a bit more on what you mean by "won't do anything"? Does that mean I cannot get the information from the packet?
Pikachu meant that the already mentioned expression is just a packet container, that means it has no information in it, its sole purpose is being sent to the client/server and for that you have to set the information in them manually. For example, this packet needs of a location, which should be the location of the displayed sign. In that case you would do something like:

code_language.skript:
#This is the container, which does nothing by itself
set {_packet-container} to new play_server_open_sign_editor packet

set location pinfo 0 of {_packet-container} to location(0, 4, 0, event-world) #Supposing there is a sign on this location.

#Now that we have the information we want in the packet container, we can send it.
send player packet {_packet-container}
 
Pikachu meant that the already mentioned expression is just a packet container, that means it has no information in it, its sole purpose is being sent to the client/server and for that you have to set the information in them manually. For example, this packet needs of a location, which should be the location of the displayed sign. In that case you would do something like:

code_language.skript:
#This is the container, which does nothing by itself
set {_packet-container} to new play_server_open_sign_editor packet

set location pinfo 0 of {_packet-container} to location(0, 4, 0, event-world) #Supposing there is a sign on this location.

#Now that we have the information we want in the packet container, we can send it.
send player packet {_packet-container}
Okay, I understand:emoji_slight_smile: thank you!
 
Status
Not open for further replies.