Author | Message | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ![]() Ok, so i decided Id try and make a better PubEditor called PubExplore. Ive set up a few things, and was wondering how i would begin to read the Pub files. Ive opened it in notepad and i am wondering how xD. Anyone know anything about it? --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| ![]() What language?
|
| ![]() Visual Basic, im going to try it in that because of how simple VB is. If not, ill prolly go to C# --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| ![]() If you make it C++ I can help you out alot I'm very well with WINAPI.
|
| ![]() Lol, im not good at all in C++. Ive been meaning to learn it but i procrastinate alot :P --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| ![]() Pub file readers are pretty easy to make if you know what you're doing. I made one in C# (twice -.-) and one in PHP just from looking at the eoserv source code. If you use eodata.cpp/hpp as a reference then its easy enough to port it to another language. I've never worked with editing though, only opening. Good luck! --- class EOSERV { Programmer | Oldbie Open source EO Client: https://github.com/ethanmoffat/EndlessClient };
|
| ![]() Haha, thanks for the advice. Ima get on that tomorow. I cant sleep right now so i started adding stuff into my site XD What i intended on doing is also loading the GFX drop views and etc. I got them loading thanks tolookingatthesourceofDesmond's Map editor.
Derp, i feel stupid now lol. data(0) = new EIFData
These problems have been fixed. --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| ![]() Number is a function that is in Packet.cpp/.hpp. It is a function that turns the byte numbers stored in the pub file and makes them into the correct values. It uses some constants which I believe are also defined in Packet.hpp. The question mark is an operator (I can never remember its name). You can use it for assigning a variable in place of an if statement, its a shorthand notation. Say you have an int x that is assigned an arbitrary value and you want to assign int y based on the value of x. int y = x > 5 ? 2 : 7; This is equivalent to: int y; if(x > 5) Much simpler with the shorthand! --- class EOSERV { Programmer | Oldbie Open source EO Client: https://github.com/ethanmoffat/EndlessClient };
|
| ![]() Sweet, now all i need is the number function. I found this in packet.cpp : unsigned int PacketProcessor::Number(unsigned char b1, unsigned char b2, unsigned char b3, unsigned char b4) { if (b1 == 0 || b1 == 254) b1 = 1; if (b2 == 0 || b2 == 254) b2 = 1; if (b3 == 0 || b3 == 254) b3 = 1; if (b4 == 0 || b4 == 254) b4 = 1; --b1; --b2; --b3; --b4; return (b4*PacketProcessor::MAX3 + b3*PacketProcessor::MAX2 + b2*PacketProcessor::MAX1 + b1); } Would this happen to be it? Also i ran into another problem. for ($i = 0; $i < $len; ++$i) What would the equivelant VB.NET to this? --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| ![]()
Yes that's to convert it to a number.
13 years, 41 weeks ago
The other question I believe is:
FOR i=0 TO 10
NEXT i --- I am an alien and not crazy!
|
| ![]() Desmond Taylor posted: (23rd Jul 2011 10:04 pm)Well i know the format im just wondering how to do it with the other 2 parameters. Ive almost got the class worked out i just need this and to convert the number function to VB, then the next classes should be alot easier.
--- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| ![]() I'm not that good with VB anymore but for the second part it's definatly like this. DIM len = 10 FOR i=0 TO len --- I am an alien and not crazy!
|
| ![]() Hmm. Ive read a few things on for loops and this is what describes it. for (expr1; expr2; expr3) statement Edit: This helped me s little bit more. for ( initialize a counter; conditional statement; increment a counter){ do this code; } For i=0 To Len If i < Len then ' Now i just need to know what ++$1 is. End If Next Edit2: Does this look about right? It works fine. Shared Function Number(b1, b2, Optional b3 = 0, Optional b4 = 0) If b1 = 0 Or b1 = 254 Then b1 = 1 End If If b2 = 0 Or b2 = 254 Then b2 = 1 End If If b3 = 0 Or b3 = 254 Then b3 = 1 End If If b4 = 0 Or b4 = 254 Then b4 = 1 End If Return (b4 * 253 + b3 * 64009 + b2 * 16194277 + b1) End Function --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer
|
| ![]() b2, b3, b4 all have default parameters of 254. I don't know anything about vb but I'm guessing declaring those parameters optional and setting them to 254 is the equivalent. You also have to decrement each parameter. (--b1; --b2; --b3; --b4;) And your constants in the return statement are backwards. MAX3 is the largest and MAX1 is the smallest. --- class EOSERV { Programmer | Oldbie Open source EO Client: https://github.com/ethanmoffat/EndlessClient };
|
| ![]()
[Solved problems removed] Edit : Ok i succesfully recieved the names of thoose ids. 1,2,3,4 so on. im guessing i did something right. Edit2 : Yes! I got it now :D Its read every single name perfectly and im pretty sure it works with the other things. Now i just gotta add the rest of the algorithm data and EIFReader class is finished :D Thanks guys for your help!
Fixed that. Now the tons shows up as a huge number. Why? Anyone know? It only shows up on the ones with : OData.Number(Asc(FileData.Substring(FI, 1)), Asc(FileData.Substring(FI + 1, 1))) Also, it only counts items up to 315? --- Andrewbob - I would be on the fucking copter of rofls Programmer, Web Developer, and Graphics Designer |