1. Database Problem
- Posted by Lone_EverGreen_Ranger Feb 03, 2011
- 1485 views
Hello,
I am having trouble with my database. I am using Euphoria's default EDS. I'll post my code and my error.It says there is a problem with the names. I'm not sure what is going on. Everything appears to be correct. Perhaps the naming scheme is conflicting with something? I don't know.
ERROR: c:\euphoria\eurpgcs\rpgcsdb.ew:41 <0074>:: Errors resolving the following references: rpgcsdb.ew (41): MAP_NAME rpgcsdb.ew (41): Map_Name if db_insert(MAP_NAME,Map_Name) != DB_OK then
--Mapdata.e constant MAP_NAME = 1, MAP_TYPE = 2, MAP_OVERWORLD_TYPE = 3, MAP_DUNGEON_TYPE = 4, MAP_NORMAL_TYPE = 5, MAP_WIDTH = 6, MAP_HEIGHT = 7, MAP_SIZE = 8, MAP_ENTITIES = 9, MAP_LAYERS = 10, MAP_TILES = 11, MAP_GRAPHIC = 12, MAP_CONNECTION = 13, MAP_ID = 14, MAP_CONNECT_ONE = 15, MAP_CONNECT_TWO = 16, MAP_EVENTS = 17, MAP_OBJECTS = 18 sequence Map_Name = "NoName" integer Map_Type = 0 integer Map_Overworld = 1 integer Map_Dungeon = 2 integer Map_Normal = 3 atom Map_Width = 0 atom Map_Height = 0 atom Map_Size = Map_Width + Map_Height atom Map_Entites = 0 atom Map_Layers = 0 atom Map_Tiles = 0 atom Map_Connection = 1 atom Map_Connection_Two = 2 atom Map_Connections = Map_Connection + Map_Connection_Two atom Map_ID = 0 atom Map_Events = 0 atom Map_Objects = 0 sequence Map_Data = {} sequence gMap_Data = {Map_Size,Map_Entites,Map_Layers,Map_Tiles,Map_Connections,Map_ID,Map_Events,Map_Objects} sequence sMap_Connection = {Map_Name} sequence sMap_Connection_Two = {Map_Name}
--RPGCSdb.ew include std/eds.e include std/get.e include std/sort.e include std/filesys.e include std/io.e include std/os.e include Include/herodata.e include Include/enemydata.e include Include/bossdata.e include Include/vehicledata.e include Include/itemdata.e include Include/element.e include Include/attributedata.e include Include/npcdata.e include Include/mapdata.e include Include/weapondata.e include Include/shopdata.e include Include/attackdata.e include Include/spelldata.e include Include/skilldata.e include Include/sedata.e include Include/bgdata.e include Include/scdata.e include Include/tiledata.e include Include/classdata.e if db_create("EuRPGData", DB_LOCK_NO) != DB_OK then puts(1,"Database could not be created!\n") abort(1) end if if db_open("EuRPGData", DB_LOCK_NO) != DB_OK then puts(1,"Could not open database!\n") abort(1) else if db_create_table("MapTable") != DB_OK then puts(1,"Could not create map table!\n") abort(1) else if db_insert(MAP_NAME,Map_Name) != DB_OK then puts(1,"Could not insert map data!\n") abort(1) end if end if end if
2. Re: Database Problem
- Posted by DerekParnell (admin) Feb 03, 2011
- 1466 views
Hello,
I am having trouble with my database. I am using Euphoria's default EDS. I'll post my code and my error.It says there is a problem with the names. I'm not sure what is going on. Everything appears to be correct. Perhaps the naming scheme is conflicting with something? I don't know.
ERROR: c:\euphoria\eurpgcs\rpgcsdb.ew:41 <0074>:: Errors resolving the following references: rpgcsdb.ew (41): MAP_NAME rpgcsdb.ew (41): Map_Name if db_insert(MAP_NAME,Map_Name) != DB_OK then
Ok, the message is a bit ambiguous. Those names can't be resolved because they can't be seen and not because they conflict with anything.
They can't be seen because they have been defined as 'local' scope within 'mapdata.e', which means that only code inside mapdata.e can see them.
I'm assuming you are using Eu4, so change the definition to ...
public constant MAP_NAME = 1, ... public sequence Map_Name = "NoName" ETC ETC ETC
You might also consider using enum instead of constant.
public enum MAP_NAME, MAP_TYPE, MAP_OVERWORLD_TYPE, MAP_DUNGEON_TYPE, etc etc etc
3. Re: Database Problem
- Posted by Lone_EverGreen_Ranger Feb 03, 2011
- 1475 views
Hello,
I am having trouble with my database. I am using Euphoria's default EDS. I'll post my code and my error.It says there is a problem with the names. I'm not sure what is going on. Everything appears to be correct. Perhaps the naming scheme is conflicting with something? I don't know.
ERROR: c:\euphoria\eurpgcs\rpgcsdb.ew:41 <0074>:: Errors resolving the following references: rpgcsdb.ew (41): MAP_NAME rpgcsdb.ew (41): Map_Name if db_insert(MAP_NAME,Map_Name) != DB_OK then
Ok, the message is a bit ambiguous. Those names can't be resolved because they can't be seen and not because they conflict with anything.
They can't be seen because they have been defined as 'local' scope within 'mapdata.e', which means that only code inside mapdata.e can see them.
I'm assuming you are using Eu4, so change the definition to ...
public constant MAP_NAME = 1, ... public sequence Map_Name = "NoName" ETC ETC ETC
You might also consider using enum instead of constant.
public enum MAP_NAME, MAP_TYPE, MAP_OVERWORLD_TYPE, MAP_DUNGEON_TYPE, etc etc etc
Ah, I see. Yes I am using Eu4. So that's what I was doing wrong. Thanks.
4. Re: Database Problem
- Posted by Vinoba Feb 04, 2011
- 1372 views
It is a good practice in any procedural programing language to define all Public variables in one public section or subroutine or what have you at the start of a project. Also a good idea to have all those names to start with MYPUB, or an abbreviation of the main theme of your work, such as in your case, MYMAP OR THEMAP, or something like that.
5. Re: Database Problem
- Posted by DerekParnell (admin) Feb 04, 2011
- 1302 views
It is a good practice in any procedural programing language to define all Public variables in one public section or subroutine or what have you at the start of a project.
Well the jury is still out on that one. There are arguments for not having any public variables at all.
Also a good idea to have all those names to start with MYPUB, or an abbreviation of the main theme of your work, such as in your case, MYMAP OR THEMAP, or something like that.
With Euphoria, you no longer need to mark your public symbols this way. The namespace concept allows one to name your public symbols however you like and then refer to them using the namespace for the include file.
Eg ...
-- mymod.e --- namespace mypub public enum NAME, ADDRESS, TELEPHONE
and then reference it thus
include mymod.e data[mypub:NAME]
6. Re: Database Problem
- Posted by Lone_EverGreen_Ranger Feb 05, 2011
- 1215 views
It is a good practice in any procedural programing language to define all Public variables in one public section or subroutine or what have you at the start of a project.
Well the jury is still out on that one. There are arguments for not having any public variables at all.
Also a good idea to have all those names to start with MYPUB, or an abbreviation of the main theme of your work, such as in your case, MYMAP OR THEMAP, or something like that.
With Euphoria, you no longer need to mark your public symbols this way. The namespace concept allows one to name your public symbols however you like and then refer to them using the namespace for the include file.
Eg ...
-- mymod.e --- namespace mypub public enum NAME, ADDRESS, TELEPHONE
and then reference it thus
include mymod.e data[mypub:NAME]
Thanks for all the help. Though there is one last thing. What is the best way about going in creating a database? I'm using Euphoria's default EDS of course. Just wondering if there is a better way of going about making a database.