|
You last visited: Today at 15:14
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.
08/11/2010, 14:19
|
#1
|
elite*gold: 0
Join Date: Dec 2008
Posts: 493
Received Thanks: 72
|
[Question]NPC Dialogue from Ini
Ok so ive been messing with NPC dialogue, trying to find a good way to load them and make them editable while the server is running.
Using COSX 5065 (i think) ive managed to load npc dialogue from an ini, and they are editable while the server is running BUT i still have the NPC options cases still hard coded.
Would it be a good idea to keep these hard coded (limiting the edit-ability to just the text)
Or should i go for a full rewrite of the npc dialogue area.
This is based on a crappy source but if i can implement it i can put it into a better source or release it.
How would i go about De-hard coding the options case or make it adaptable to as many options i write into the ini.
Any help, comments etc. is appreciated.
|
|
|
08/11/2010, 17:49
|
#2
|
elite*gold: 0
Join Date: Sep 2008
Posts: 1,683
Received Thanks: 506
|
Id rather use something different than INI files, and use a very basic script language.
Which reads dialogs and actions such as Command("@tele x y id"); which would teleport.
Depending on your skill of course.
You could also create for instance VB files and use the VB syntax, and create a parser for it, which will read the VB syntax / script syntax.
|
|
|
08/11/2010, 18:29
|
#3
|
elite*gold: 0
Join Date: Jan 2008
Posts: 1,443
Received Thanks: 1,175
|
The INI File isn't a good idea. To combine the external and the internal system, it's a good idea. As Basser said, for your external system, a script language will be faster and better. Personaly, I use a binary structure.
The binder is if you want the option selected. The page is like all the possibility of the option.
Code:
if (Binder == 0)
{
if (Page[0].Req == OK)
{
...
}
}
Code:
Char[3] -> Identifier
Int32 -> UniqId
Char[32] -> Name
Int16 -> Face
UInt8 -> Binder Count
**** Binder Start ****
UInt8 -> Page Count
*** Page Start ***
UInt8 -> Requirement Count
UInt8 -> Reward Count
UInt8 -> Option Count
** Requirement Start **
UInt8 -> Type
UInt8 -> Operator
Boolean -> IsString
if (true)
Char[32] -> Value
else
Int32 -> Value
** Requirement End **
** Reward Start **
UInt8 -> Type
UInt8 -> Operator
Boolean -> IsString
if (true)
Char[32] -> Value
else
Int32 -> Value
** Reward End **
Boolean -> Text Exist
if (true)
{
Int16 -> Length
Char[] -> Text
}
** Option Start **
UInt8 -> UniqId
UInt8 -> Length
Char[] -> Text
** Option End **
*** Page End ***
**** Binder End ****
|
|
|
08/11/2010, 19:21
|
#4
|
elite*gold: 0
Join Date: Dec 2008
Posts: 493
Received Thanks: 72
|
Quote:
Originally Posted by Basser
Id rather use something different than INI files, and use a very basic script language.
Which reads dialogs and actions such as Command("@tele x y id"); which would teleport.
Depending on your skill of course.
You could also create for instance VB files and use the VB syntax, and create a parser for it, which will read the VB syntax / script syntax.
|
Well i dont know VB; wouldnt that require me to compile it each time i add something?
Quote:
Originally Posted by CptSky
The INI File isn't a good idea. To combine the external and the internal system, it's a good idea. As Basser said, for your external system, a script language will be faster and better. Personaly, I use a binary structure.
The binder is if you want the option selected. The page is like all the possibility of the option.
Code:
if (Binder == 0)
{
if (Page[0].Req == OK)
{
...
}
}
Code:
Char[3] -> Identifier
Int32 -> UniqId
Char[32] -> Name
Int16 -> Face
UInt8 -> Binder Count
**** Binder Start ****
UInt8 -> Page Count
*** Page Start ***
UInt8 -> Requirement Count
UInt8 -> Reward Count
UInt8 -> Option Count
** Requirement Start **
UInt8 -> Type
UInt8 -> Operator
Boolean -> IsString
if (true)
Char[32] -> Value
else
Int32 -> Value
** Requirement End **
** Reward Start **
UInt8 -> Type
UInt8 -> Operator
Boolean -> IsString
if (true)
Char[32] -> Value
else
Int32 -> Value
** Reward End **
Boolean -> Text Exist
if (true)
{
Int16 -> Length
Char[] -> Text
}
** Option Start **
UInt8 -> UniqId
UInt8 -> Length
Char[] -> Text
** Option End **
*** Page End ***
**** Binder End ****
|
i have no idea what this is lmao
|
|
|
08/12/2010, 23:09
|
#5
|
elite*gold: 0
Join Date: Jun 2009
Posts: 787
Received Thanks: 314
|
If you're on MSN i'll help you (that means get on).
|
|
|
09/10/2010, 20:15
|
#6
|
elite*gold: 0
Join Date: May 2010
Posts: 13
Received Thanks: 0
|
where can i find the npcdialog,cs ?? plzz answer..
|
|
|
09/11/2010, 02:05
|
#7
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
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)
|
|
|
09/11/2010, 04:22
|
#8
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Quote:
Originally Posted by pro4never
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)
|
^^ Fail.
|
|
|
09/11/2010, 05:11
|
#9
|
elite*gold: 0
Join Date: Jul 2010
Posts: 223
Received Thanks: 23
|
Hm.. well I'm working on mine being full MySQL. Spawns through a MySQL and loads dialogs through MySQL. That way when someone comes and says "this NPC has a spelling mistake!", you can edit it without taking down the server! =o
Good idea or... bad idea? lol
Because I've never made an NPC System!
|
|
|
09/11/2010, 05:15
|
#10
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
Problem with npcs based on sql is that it's SO much harder to do complex npcs that way....
sql is not exactly a friendly scripting language...
personally I'd chose .ini files over that any day with basic functions for checking things...
IronPython is the best option according to saint. The way me and Schmidty were doing it apparently causes memory leaks if done incorrectly... so yah... iron python or something similar is a great way to do things. External scripts ftw
|
|
|
09/11/2010, 06:49
|
#11
|
elite*gold: 80
Join Date: Sep 2007
Posts: 642
Received Thanks: 168
|
Quote:
Originally Posted by pro4never
Problem with npcs based on sql is that it's SO much harder to do complex npcs that way....
sql is not exactly a friendly scripting language...
personally I'd chose .ini files over that any day with basic functions for checking things...
IronPython is the best option according to saint. The way me and Schmidty were doing it apparently causes memory leaks if done incorrectly... so yah... iron python or something similar is a great way to do things. External scripts ftw
|
You have to admit, my way was pretty good until Dream-Crusher came into play =p
|
|
|
09/11/2010, 07:01
|
#12
|
elite*gold: 0
Join Date: Jul 2010
Posts: 223
Received Thanks: 23
|
Quote:
Originally Posted by pro4never
Problem with npcs based on sql is that it's SO much harder to do complex npcs that way....
sql is not exactly a friendly scripting language...
personally I'd chose .ini files over that any day with basic functions for checking things...
IronPython is the best option according to saint. The way me and Schmidty were doing it apparently causes memory leaks if done incorrectly... so yah... iron python or something similar is a great way to do things. External scripts ftw
|
The only problem with ini files: "file in use" errors (rare but annoying).
I think i'm going to code the less demanding NPCs with the MySQL database then... and figure out something for the others. Thanks! =]
|
|
|
09/11/2010, 07:17
|
#13
|
elite*gold: 0
Join Date: Oct 2009
Posts: 8,783
Received Thanks: 5,304
|
Quote:
Originally Posted by -Fáng-
The only problem with ini files: "file in use" errors (rare but annoying).
I think i'm going to code the less demanding NPCs with the MySQL database then... and figure out something for the others. Thanks! =]
|
o.O
Make sure no other process is using the file?
Not that big a problem.
|
|
|
09/11/2010, 07:23
|
#14
|
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,379
|
Quote:
Originally Posted by .Arco
o.O
Make sure no other process is using the file?
Not that big a problem.
|
He just needs to queue the npc or lock access until current operation is finished. if multiple people are trying to use the same npc during the same fraction of the second it can give errors such as that.
It's VERY unlikely and very simple to fix... not really much of an issue.
|
|
|
09/11/2010, 07:51
|
#15
|
elite*gold: 0
Join Date: Jul 2010
Posts: 223
Received Thanks: 23
|
Quote:
Originally Posted by pro4never
He just needs to queue the npc or lock access until current operation is finished. if multiple people are trying to use the same npc during the same fraction of the second it can give errors such as that.
It's VERY unlikely and very simple to fix... not really much of an issue.
|
Kinda like what I did with the SaveCharacter problem I guess.
Well I'll look into it more I guess as an option. Thanks =]
|
|
|
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 15:14.
|
|