yeah, I made the minebot purly from the former, I've got the blocks *somewhat* the location is still kinda boggling though. Block at first start out going from 0,0,0, then each block from there you add 256 to it, i found that not to be the case farther out in the map, but its a start.
afaik (I'm probably wrong if you coders are having problems with it :wink.gif:), block positions are normal whereas player positions are 32 per block (if you wanted to go to the middle of block 5, 4, 6 you would go to 144, 112, 176 (which is 32*4+16, 32*3+16, 32*5+16)
But, like I said, if you guys haven't figured it out yet then it's probably more complicated than that.
Or maybe you're just talking about something completely different. Sorry for wasting your time in that case :oops:
Player coordinates are fixed-point values with the lowest 5 bits representing the fractional position (i.e. divide by 32 to get actual position in terms of block coordinates). The angle parameters are scaled such that a value of 256 would correspond to 360 degrees.
Rollback Post to RevisionRollBack
Minecraft Name: KakashiSuno
I'm known as Kakashi, Kaka, KS, and the Coal Ninja =)
Yeah, I read that over a few times, and I can't understand what it says.
lowest 5 bits representing the fractional position (i.e. divide by 32 to get actual position in terms of block coordinates) <-- Lowest 5? what if its pos 8 x 8 x 8? then its... ????????????? sdasdasddas.
8 in binary is 1000, so you need to add 5 zeroes like this: 100000000
If you want to do the reverse operation you need to do a bit shift: int realPos = pos >> 5
You'll probably have to reverse the byte order as well because Java is big endian (look it up on Wikipedia).
if I want him to goto 8 8 8, i send him to 1, 1, 1...
8 in binary is 1000, so you need to add 5 zeroes like this: 100000000
If you want to do the reverse operation you need to do a bit shift: int realPos = pos >> 5
You'll probably have to reverse the byte order as well because Java is big endian (look it up on Wikipedia).
Ok, so what your saying is take the position, in this case, 8, 8, 8.
Convert it to a binary, making it 1000, then add 5 zeros. 100000000
and that would make the real position 100000000, 100000000, 100000000 ?
Then to reverse you do Dim realPos = pos [Greater than] [Greaterthan] 5 ...
I don't know if the VB.NET syntax is right but looking here it seems the code would be the following:
Dim packetX As Short = CShort((playerX << 5))
Dim playerX As Short = CShort((packetX >> 5))
The first line translates a packet position into a real "block position", use this when you receive the packet.
The second line translates a a real "block position" into packet position, use this when you send the packet.
You obviously need to do the operation on X, Y and Z.
Let me know if it works. If it doesn't you'll probably have to reverse the byte order.
Second one: Tried a location of 1, and 3. which returned 0.
First one: doesn't return a realtive block number, but i have no clue how to reverse, you mean reverse the order?
EDIT: Updated, added !Follow and cleaned up the code a bit to speed everything up.
To use !Follow insert a number (0 being the bottom most number, 255 being the max), then have someone on the admin list type !Follow. the bot will then (Very annoyingly) follow the person with the player number of whatever you put in the box. If the player is standing still, no problem, but once you move, and then you stop, it will follow you until you type !follow again to turn it off.
This might help you. This function converts an integer into a big endian short.
Private Function ToBigEndian(tInt As Integer) As String
Dim xint As Integer
xint = tInt
Dim lower As String, upper As String, xlower As Integer, xupper As Integer
xlower = xint Mod 256
xupper = xint \ 256
lower = Hex(xlower)
upper = Hex(xupper)
If Len(lower) < 2 Then lower = "0" & lower
If Len(upper) < 2 Then upper = "0" & upper
ToBigEndian = upper & " " & lower
End Function
For example if you want to place a block at 100, 50, 10:
Dim xhex as string, yhex as string, zhex as string
xhex = ToBigEndian(100)
yhex = ToBigEndian(50)
zhex = ToBigEndian(10)
These strings (xhex,yhex,zhex) now contain your 2-byte short, in network order, ready to be sent to the server.
Hope it helps, I'm making a bot in VB as well and this took me a while to figure out.
Awesome, it should help greatly. thank you very much. my bot is open source, feel free to look around what i have, and PM me if you need help with anything that i might be able to help with.
EDIT: Block location works flawlessly, and player location is alot more fine-tuned. where before 1, 1, 1 would be 8,8,8 (according to WoM Client), it is now just a fraction away from 0,0,0
so location has been improved, and block location is great (Though converting block location still isn't perfect, if I could get a From big endian function, things would be great, as it should also then allow me to read locations.
Also, I'm going to work on a playerlist function.. We'll see how it works out ._.
EDIT: Playerlist works well, I even edited the !follow command to work so whoever said !follow gets followed.
Only issue is if the bot joins while there are people still on the server, it may not get every player because the packets are sent so fast the bot can't handle it. So for it to work correctly, and for the playerlist to work correctly, the bot has to sign on before anyone else.
I'm guessing that threading would fix this issue, so i will look into threading and a few other things.
Not that, I have something simular to that that i've used in the past
Public Function Dec(ByVal HexNum As String) As Integer
If HexNum = "" Then HexNum = "0"
Dec = CInt("&H" & HexNum)
End Function
EDIT: Nvm, managed to get it. now i have loactions working almost flawlessly. Sweet.
Function to convert:
(note: Imports System)
Public Function frombigendian(ByVal yourshort As Short)
Dim mybyte() As Byte
mybyte = BitConverter.GetBytes(yourshort).Reverse.ToArray()
frombigendian = BitConverter.ToInt16(mybyte, 0)
End Function
- Thanks to Crackheads, managed to get movement working right. now if you see your location in the WoM Client or elsewhere, you can use the change location command with the location that you have entered, and it will go to that location (Note for WoM Client users, the XYZ pos shown at the title bar of the client, are in the order of X Z Y, Keep this in mind when changing location)
- Also thanks to crackheads, block placement works better.
- Code cleaned up a bit
- Added !Players -- View all online players *That are on the bot's player list, to the right of the chat box*
- Edited !Follow -- Makes the bot follow the person who initiated the command around until they type !Follow again, rather than just whoever's number is in the box.
- Facing and head orientation fixed up a slight bit, but its still not perfect. but i don't think there will be any more upside down heads.
-----
Thats it for the changes. I was unable to upload the source code right now, but i will upload it as soon as i can get the SVN working right.
for now, just updated the readme.txt and the zip file that has the bot.
EDIT: Bot threading: Fail, it never ends up processing data..
Bot Hard Threading (2 processer modules, and the bot auto-chooses which one to use): Fail, didn't receive anything after the handshake.
Hm.. if you could do that again, but expand the details tab and copy/paste what it says in here.
I think i know what caused it, if you could also tell me what version of the .NET Framework you have installed? (2.0, 3.5, 4.0 beta) and try installing the latest version of it (3.5) and see if it works.
Details:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load file or assembly 'Microsoft.VisualBasic.PowerPacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualBasic.PowerPacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualBasic.PowerPacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Minebot.Jail.InitializeComponent()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
--- End of inner exception stack trace ---
at Minebot.My.MyProject.MyForms.Create__Instance__[T](T Instance)
at Minebot.Form1.SetJailToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Anyhow, is there anyway to check my .NET Framework?
Edit:When I try to install 3.5, nothing happens. I'm assuming this means I have it already.
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
tell it to place a block at 0,0,0, 36,0,0, and 256,0,0
you should get 2 blocks.
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
But, like I said, if you guys haven't figured it out yet then it's probably more complicated than that.
Or maybe you're just talking about something completely different. Sorry for wasting your time in that case :oops:
I'm known as Kakashi, Kaka, KS, and the Coal Ninja =)
lowest 5 bits representing the fractional position (i.e. divide by 32 to get actual position in terms of block coordinates) <-- Lowest 5? what if its pos 8 x 8 x 8? then its... ????????????? sdasdasddas.
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
If you want to do the reverse operation you need to do a bit shift: int realPos = pos >> 5
You'll probably have to reverse the byte order as well because Java is big endian (look it up on Wikipedia).
Script to edit Minecraft maps with Paint3D
If you want them to be in 8,8,8 - send them to 256,256,256 (8 * 32 = 256)
Ok, so what your saying is take the position, in this case, 8, 8, 8.
Convert it to a binary, making it 1000, then add 5 zeros. 100000000
and that would make the real position 100000000, 100000000, 100000000 ?
Then to reverse you do Dim realPos = pos [Greater than] [Greaterthan] 5 ...
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
The first line translates a packet position into a real "block position", use this when you receive the packet.
The second line translates a a real "block position" into packet position, use this when you send the packet.
You obviously need to do the operation on X, Y and Z.
Let me know if it works. If it doesn't you'll probably have to reverse the byte order.
Script to edit Minecraft maps with Paint3D
First one: doesn't return a realtive block number, but i have no clue how to reverse, you mean reverse the order?
EDIT: Updated, added !Follow and cleaned up the code a bit to speed everything up.
To use !Follow insert a number (0 being the bottom most number, 255 being the max), then have someone on the admin list type !Follow. the bot will then (Very annoyingly) follow the person with the player number of whatever you put in the box. If the player is standing still, no problem, but once you move, and then you stop, it will follow you until you type !follow again to turn it off.
Also, added everything to the SVN now.
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
I think you're swapping them - a packet position of 1 and 3 *is* a real position of 0.
Script to edit Minecraft maps with Paint3D
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
For example if you want to place a block at 100, 50, 10:
These strings (xhex,yhex,zhex) now contain your 2-byte short, in network order, ready to be sent to the server.
Hope it helps, I'm making a bot in VB as well and this took me a while to figure out.
EDIT: Block location works flawlessly, and player location is alot more fine-tuned. where before 1, 1, 1 would be 8,8,8 (according to WoM Client), it is now just a fraction away from 0,0,0
so location has been improved, and block location is great (Though converting block location still isn't perfect, if I could get a From big endian function, things would be great, as it should also then allow me to read locations.
Also, I'm going to work on a playerlist function.. We'll see how it works out ._.
EDIT: Playerlist works well, I even edited the !follow command to work so whoever said !follow gets followed.
Only issue is if the bot joins while there are people still on the server, it may not get every player because the packets are sent so fast the bot can't handle it. So for it to work correctly, and for the playerlist to work correctly, the bot has to sign on before anyone else.
I'm guessing that threading would fix this issue, so i will look into threading and a few other things.
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
Simply pass the short into this function. (excluding spaces between bytes)
Tada, integer.
EDIT: Nvm, managed to get it. now i have loactions working almost flawlessly. Sweet.
Function to convert:
(note: Imports System)
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
- Thanks to Crackheads, managed to get movement working right. now if you see your location in the WoM Client or elsewhere, you can use the change location command with the location that you have entered, and it will go to that location (Note for WoM Client users, the XYZ pos shown at the title bar of the client, are in the order of X Z Y, Keep this in mind when changing location)
- Also thanks to crackheads, block placement works better.
- Code cleaned up a bit
- Added !Players -- View all online players *That are on the bot's player list, to the right of the chat box*
- Edited !Follow -- Makes the bot follow the person who initiated the command around until they type !Follow again, rather than just whoever's number is in the box.
- Facing and head orientation fixed up a slight bit, but its still not perfect. but i don't think there will be any more upside down heads.
-----
Thats it for the changes. I was unable to upload the source code right now, but i will upload it as soon as i can get the SVN working right.
for now, just updated the readme.txt and the zip file that has the bot.
EDIT: Bot threading: Fail, it never ends up processing data..
Bot Hard Threading (2 processer modules, and the bot auto-chooses which one to use): Fail, didn't receive anything after the handshake.
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
Any solution?
I think i know what caused it, if you could also tell me what version of the .NET Framework you have installed? (2.0, 3.5, 4.0 beta) and try installing the latest version of it (3.5) and see if it works.
D3 Server! [Advanced, Custom physics / Anti-Greif / RP]
Server Status:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details. The error is: Could not load file or assembly 'Microsoft.VisualBasic.PowerPacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualBasic.PowerPacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualBasic.PowerPacks.Vs, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Minebot.Jail.InitializeComponent()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
--- End of inner exception stack trace ---
at Minebot.My.MyProject.MyForms.Create__Instance__[T](T Instance)
at Minebot.Form1.SetJailToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
Minebot
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///G:/Home/Minebot/Minebot/Minebot.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Winsock Orcas
Assembly Version: 4.0.0.0
Win32 Version: 4.0.0.0
CodeBase: file:///G:/Home/Minebot/Minebot/Winsock%20Orcas.DLL
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Anyhow, is there anyway to check my .NET Framework?
Edit:When I try to install 3.5, nothing happens. I'm assuming this means I have it already.