Almost done the npc to create guild and wh pass. Need 1 more help.

06/18/2009 20:44 painkiller199202#1
Hi all, im almost done the npc to create guild, so iŽll be happy if someone can help me how to make this back to the original position.

Thanks for that who can help me :)

IŽll release it soon :handsdown:


Edit: lol iŽve done, just forgot the End(CSocket);

And now how i can make it really set a password? Any help? thanks
06/18/2009 20:46 CIRASH#2
what do you need???
06/18/2009 22:16 n0mansland#3
Quote:
what do you need???
look in his pics the black box and the OK button


EDIT looks like he fixed it

Quote:
And now how i can make it really set a password? Any help? thanks

Thank god you're releasing it IDK how to do that like the box and stuff
06/18/2009 22:29 Zeroxelli#4
Input box?

Code:
                            Text("This is a test.", CSocket);
                            Input(2, CSocket);
                            Link("Nevermind.", 255, CSocket);
                            Face(53, CSocket);
                            End(CSocket);
06/18/2009 22:32 n0mansland#5
Well that helps lol anyway lets get back to his post now.
06/18/2009 22:37 painkiller199202#6
Quote:
Originally Posted by Zeroxelli View Post
Input box?

Code:
                            Text("This is a test.", CSocket);
                            Input(2, CSocket);
                            Link("Nevermind.", 255, CSocket);
                            Face(53, CSocket);
                            End(CSocket);
Yea this is what i did, i just need to make that work and set a password and create a guild ;D
06/18/2009 22:51 Zeroxelli#7
If I recall correctly, you would have to read the data of the packet sent and not just the ID. You should get input via that (As, it sends it back and handles the LinkBack)
06/18/2009 23:58 CIRASH#8
I dont think he understands that zero xD
06/19/2009 00:15 Zeroxelli#9
in Packetprocessor.cs find
Code:
					case 2031: //Initial NPC talk
						{
							int ID = ReadLong(Data, 4);
							Handler.NpcTalk(CSocket, ID, 0);
							break;
						}
					case 2032: //Reply NPC Talk
						{	
							int ID = CSocket.Client.LastNPC;
							int LinkBack = Data[10];
							if(LinkBack != 255)
								Handler.NpcTalk(CSocket, ID, LinkBack);
							break;
						}
and change it to
Code:
					case 2031: //Initial NPC talk
						{
							int ID = ReadLong(Data, 4);
							Handler.NpcTalk(CSocket, ID, 0, "");
							break;
						}
					case 2032: //Reply NPC Talk
						{	
							int ID = CSocket.Client.LastNPC;
                            string Input = string.Empty;
                            for (int i = 1; i <= Data[13]; i++)
                                Input += Convert.ToChar(Data[13 + i]);
							int LinkBack = Data[10];
							if(LinkBack != 255)
								Handler.NpcTalk(CSocket, ID, LinkBack, Input.Replace('~', ' '));
							break;
						}
And in NpcTalk.cs find
Code:
public static void NpcTalk(ClientSocket CSocket, int ID, int LinkBack)
and change it to
Code:
public static void NpcTalk(ClientSocket CSocket, int ID, int LinkBack, string InStr)
Again in Packetprocessor.cs find
Code:
case 10003: // Guild guy
or make it if you haven't already. Replace it and its contents with:
Code:
                case 10003: // Guild guy
                    {
                        if (LinkBack == 0)
                        {
                            Text("This is a test.", CSocket);
                            Input(1, CSocket);
                            Link("Nevermind.", 255, CSocket);
                            Face(53, CSocket);
                            End(CSocket);
                        }
                        else if (LinkBack == 1)
                        {
                            Text("You gave me: " + InStr, CSocket);
                            Link("Thanks.", 255, CSocket);
                            Face(53, CSocket);
                            End(CSocket);
                        }
                        break;
                    }
That should get you started.
06/19/2009 00:36 InfamousNoone#10
Why use teh ugliez for loop when methods such as the following, already exist (the sbyte* way is the fastest at runtime btw):

Code:
					
					case 2031: //Initial NPC talk
						{
							int ID = ReadLong(Data, 4);
							Handler.NpcTalk(CSocket, ID, 0, "");
							break;
						}
					case 2032: //Reply NPC Talk
						{	
							int ID = CSocket.Client.LastNPC;
							string Input = System.Text.Encodnig.ASCII.GetString(Data, 14, Data[13]);
							int LinkBack = Data[10];
							if(LinkBack != 255)
								Handler.NpcTalk(CSocket, ID, LinkBack, Input.Replace('~', ' '));
							break;
						}
Code:
					
					case 2031: //Initial NPC talk
						{
							int ID = ReadLong(Data, 4);
							Handler.NpcTalk(CSocket, ID, 0, "");
							break;
						}
					case 2032: //Reply NPC Talk
						{	
							int ID = CSocket.Client.LastNPC;
							string Input;
							fixed (byte* pData = Data)
								Input = new string((sbyte*)(pData+14), 0, Data[13]);
							int LinkBack = Data[10];
							if(LinkBack != 255)
								Handler.NpcTalk(CSocket, ID, LinkBack, Input.Replace('~', ' '));
							break;
						}
Just throwing it out there.
06/19/2009 00:51 Zeroxelli#11
Because, Microsoft says it themselves.
Quote:
The fixed statement is only permitted in an unsafe context.
[Only registered and activated users can see links. Click Here To Register...]

Of course, it's faster and easier. But, it takes more for someone who doesn't understand it to have to mark functions using this as unsafe. It just causes more confusion for those who don't understand it. (And yes; personally, I do use it. Just saying, for newbies it's troublesome.)
06/19/2009 00:57 InfamousNoone#12
Quote:
Originally Posted by Zeroxelli View Post
Because, Microsoft says it themselves. [Only registered and activated users can see links. Click Here To Register...]

Of course, it's faster and easier. But, it takes more for someone who doesn't understand it to have to mark functions using this as unsafe. It just causes more confusion for those who don't understand it. (And yes; personally, I do use it. Just saying, for newbies it's troublesome.)
There's nothing unsafe about it what so ever in the context I posted. Microsoft simply deems it unsafe because it uses a pointer. No, you don't need to mark the function unsafe, you can create an "unsafe block"
Code:
unsafe {
  // ...
}
But sure you newbie argument holds up fine though, but when have they ever wanted to understand code given to them?
06/19/2009 01:03 Zeroxelli#13
Ah, right. unsafe block sounds useful =P

And, there are few who do want to understand. People bug me on MSN all the time about wanting to learn, problem is they don't have the capacity to take their time and learn things right.
06/19/2009 05:30 arab4life#14
and we got a winner
06/19/2009 06:08 CIRASH#15
I ACTUALLY am learning from posts like this