Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 00:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Question]NPC Dialogue from Ini

Discussion on [Question]NPC Dialogue from Ini within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old 09/11/2010, 08:49   #16
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
Quote:
Originally Posted by -Fáng- View Post
Kinda like what I did with the SaveCharacter problem I guess.
Well I'll look into it more I guess as an option. Thanks =]
And my response to that?
FileShare.Read
Learn it.
Arcо is offline  
Old 09/11/2010, 09:23   #17
 
Ian*'s Avatar
 
elite*gold: 0
Join Date: Nov 2006
Posts: 805
Received Thanks: 464
MySQL works fine to read it, actually any method really works just fine.

p4n's .npc files assuming it's just plain text he's parsing, so it's pretty much the equivalent to an ini file.

As long as you read it once and store it in a variable somewhere they're all the same.
Don't read it each time the npc is accessed :P
Ian* is offline  
Thanks
1 User
Old 09/11/2010, 14:15   #18
 
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
Quote:
Originally Posted by Ian* View Post
MySQL works fine to read it, actually any method really works just fine.

p4n's .npc files assuming it's just plain text he's parsing, so it's pretty much the equivalent to an ini file.

As long as you read it once and store it in a variable somewhere they're all the same.
Don't read it each time the npc is accessed :P
Defeats an advantage of having an inline system (modify scripts while running).

You need some way to check whether the script has been modified before you reload it (or just have a command to manually reload the script into said variable).
_tao4229_ is offline  
Old 09/11/2010, 23:12   #19
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,226
Received Thanks: 868
Quote:
Originally Posted by pro4never View Post
My server is using full C# syntax stored as .npc files which are debugged and executed at runtime when requested (that way if there are errors it's not executed which would cause crashing/issues)
I'm using the .npc file idea I will have it like 12111.npc 12111 = npc id
the structure inside is just
Code:
case 0:
{
Text("Testing..");
Link("Hi", 255);
break;
}
Then I still need to write the hardest part which is read the npc dialog for now I will have npc dialog in database as follows:
Code:
case 12111:
{
switch(npcRequest.optionID)
{
File.FindAndRead(12111);
}
break;
}
then eventually ill change the whole system so all of it is in the .npc file.
so when clicking an npc it does
Code:
File.FindAndRead(npcrequest.ID);
=]
However I need abit of help in the FindAndRead void will post problems later.

btw .npc is just text file.
#edit
Need help!
So my void is as follows
Code:
public static void FindAndRead(uint NpcID, GameState client)
        {
            Console.WriteLine("NPC Being accessed: {0}", NpcID);
            string DialogPath = Constants.NpcDialogs + NpcID;
            if (File.Exists(DialogPath))
            {
                Dialogs dialog = new Dialogs();
                dialog.Client = client;
                dialog.Replies = new List<NpcReply>();

                File.Open(DialogPath, FileMode.Open);
                string[] Dialog = File.ReadAllLines(DialogPath);
                if (Dialog.Contains("case 0:"))
                {
                }
            }
        }
But have NO idea how to read a file like this:
Code:
switch(NpcRequest.OptionID)
{
case 0:
{
Text("Testing..");
Link("Hi", 255);
break;
}
}
I just need to read a line and take action
Code:
File.ReadLine("switch(Npcrequest.optionID))
{" { ((Npc.Add "switch(Npcrequest.optionID))"{)) 
int case;
if case = 0 { if File.Contains("case " + case") Npc.Add "case 0:");
something like that but have no idea. ;s
_DreadNought_ is offline  
Old 09/12/2010, 01:00   #20
 
Ian*'s Avatar
 
elite*gold: 0
Join Date: Nov 2006
Posts: 805
Received Thanks: 464
Quote:
Originally Posted by _tao4229_ View Post
Defeats an advantage of having an inline system (modify scripts while running).

You need some way to check whether the script has been modified before you reload it (or just have a command to manually reload the script into said variable).
Yeah, could just make a reload button on your server gui ;P
Ian* is offline  
Reply


Similar Threads Similar Threads
[REL] Fixed dialogue with proper grammar npcs for CoEmu v2
06/06/2010 - CO2 PServer Guides & Releases - 24 Replies
Hey, Even for contributing the easiest things possible to create it is still a need to have proper npcs. Feel free to press thanks, if you don't i don't care either way. **PrizeNPC In character.cs Then the npc itsself:



All times are GMT +1. The time now is 00:04.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.