Cantr Objects Database Program

General out-of-character discussion among players of Cantr II.

Moderators: Public Relations Department, Players Department

User avatar
Anthony Roberts
Posts: 2578
Joined: Mon Feb 02, 2004 11:45 pm
Location: Chatham, Ontario, Canada

Postby Anthony Roberts » Sat Mar 20, 2004 3:34 am

Don't thank me. Not a lot anyway. :D

Thank Jos for just a great game! Thank the Cantr staff for keeping it together and better everyday! And thank Jason Kasuo for compiling a database with all that information so that I didn't need to waste any time logged in :P

OH! I found a bug myself.

For some dumbass reason, the program will NOT fun on a direct drive location. (Ie: Unzip it into a folder. Like C:\Cantr. It won't run directly from C:\) - At least, it's not working on my drive. Gives me an error "Can't find file C:\\cantr.mdb" - And I know why.

I have the program look for the file "\cantr.mdb" - Notice the \ before it? That's so it NEEDS to be in a folder, so instead of looking for C:\Cantrcantr.mdb it looks for C:\Cantr\cantr.mdb - Get it? Good. So, unzip and run in a folder.

Also, holy crap. The database file is 13 Megs. Didn't think it was that big. But the ZIp file is 778 Kilobytes, so it's less than 1 meg. The database file Jason gave me was 800 Kilobytes, and I edited it so much that it's 13 megs? LOL. Oh well.
-- Anthony Roberts
User avatar
Anthony Roberts
Posts: 2578
Joined: Mon Feb 02, 2004 11:45 pm
Location: Chatham, Ontario, Canada

Postby Anthony Roberts » Sat Mar 20, 2004 3:37 am

Nick wrote:Anthony, if you want to have unlimited ammounts of custom resources to add, you can change the code so that a variable counts how many are added and you can redimension the array(s) containing the information about the resource.


Can't do that. I did that at first, but it won't work -BECAUSE- the entries WILL NOT save into the Database file. I need to create a new column for every entry (New Resource). So I have added 10 blank columns in the database file to make 10 custom resources.

I will change this later, probably, to make it more optimal and use an .INI file or .TXT or something, so that the raw resources aren't stored in the Database and then can have unlimited.

Get what I'm saying? o.o;
-- Anthony Roberts
User avatar
Nick
Posts: 3606
Joined: Tue Jul 15, 2003 8:27 pm
Location: Halifax, Canada

Postby Nick » Sat Mar 20, 2004 3:48 am

You dont really need a database file to store all that, a simple string array will work...
User avatar
nitefyre
Posts: 3528
Joined: Sat Nov 22, 2003 3:29 am
Location: New York City
Contact:

Postby nitefyre » Sat Mar 20, 2004 3:50 am

Anthony wrote:
Nick wrote:Anthony, if you want to have unlimited ammounts of custom resources to add, you can change the code so that a variable counts how many are added and you can redimension the array(s) containing the information about the resource.


Can't do that. I did that at first, but it won't work -BECAUSE- the entries WILL NOT save into the Database file. I need to create a new column for every entry (New Resource). So I have added 10 blank columns in the database file to make 10 custom resources.

I will change this later, probably, to make it more optimal and use an .INI file or .TXT or something, so that the raw resources aren't stored in the Database and then can have unlimited.

Get what I'm saying? o.o;


Nope O.o not a single word.

But it works for me, I just cut and paste it into my Cantr folder. =D
User avatar
Anthony Roberts
Posts: 2578
Joined: Mon Feb 02, 2004 11:45 pm
Location: Chatham, Ontario, Canada

Postby Anthony Roberts » Sat Mar 20, 2004 3:54 am

Nick wrote:You dont really need a database file to store all that, a simple string array will work...


Either I don't get what you're saying, or you don't get what I'm saying =\

What I'm saying is... if I used a String Array, I'd have those new resources. Yes. BUT, where would they be saved? -In the Database- BUT. They can't be saved in the database. Why? Because each entry needs a new column entry. Which means, I need to know exactly how many custom resources they're going to add, maximum. Get it? O.o;

In order to get this to work, though, without the database file, would be to save the string array into another binary file. I think this is what you're saying, and what I've already said :P

...Maybe.
-- Anthony Roberts
User avatar
Nick
Posts: 3606
Joined: Tue Jul 15, 2003 8:27 pm
Location: Halifax, Canada

Postby Nick » Sat Mar 20, 2004 3:57 am

Oh yes of course, the way you are actually saving the data.
Yes, I would think a .TXT file would be the best way to go about that.
User avatar
Anthony Roberts
Posts: 2578
Joined: Mon Feb 02, 2004 11:45 pm
Location: Chatham, Ontario, Canada

Postby Anthony Roberts » Sat Mar 20, 2004 4:04 am

Yep, .TXT file would be good. Encoded one at that. Don't want people opening it up and fiddling with the data, then running the program and going "Oh my gorsh! It dun work. I vonder whyz!?" - Of course, who talks like that? Not anyone I know.

I'll change it so it's like that....... tommorow. I'm gonna work on the program more....... tommorow.
-- Anthony Roberts
User avatar
Nick
Posts: 3606
Joined: Tue Jul 15, 2003 8:27 pm
Location: Halifax, Canada

Postby Nick » Sat Mar 20, 2004 4:08 am

You could fool more people just by making it a .can file or any random name and just have it work like a text file. Most people wont bother trying to open it with notepad. :lol:
User avatar
Anthony Roberts
Posts: 2578
Joined: Mon Feb 02, 2004 11:45 pm
Location: Chatham, Ontario, Canada

Postby Anthony Roberts » Sat Mar 20, 2004 4:11 am

It won't fool me. I try to open every file that looks unique, or is a .dat or .ini file :P Just to see what program mechanics I can fiddle with.

In any case, if I use any extension, it's .sces (Spaz Co. Enterprises Save), .scef (Spaz Co. Enterprises File), or .sms (SpazMan Save) :D
-- Anthony Roberts
User avatar
Nick
Posts: 3606
Joined: Tue Jul 15, 2003 8:27 pm
Location: Halifax, Canada

Postby Nick » Sat Mar 20, 2004 6:08 am

Well if theyre smart enough to do that hopefully theyre smart enough to make a backup copy :lol:
User avatar
Junesun
Administrator Emeritus
Posts: 807
Joined: Sat Feb 07, 2004 9:24 am
Location: Berlin, Germany
Contact:

Postby Junesun » Sat Mar 20, 2004 7:06 am

Anthony, there's a way to tell VB to create a new column in an Access database. You can even have it create a new table. Unfortunately I only used it once in my vocabulary-teaching program; I don't know it by heart but I'll look it up and post it here when I'm on the other PC. I'll also test your program :-)

Judith
User avatar
Spectrus_Wolfus
Posts: 910
Joined: Tue Nov 04, 2003 3:09 am
Location: Sydney, Australia

Postby Spectrus_Wolfus » Sat Mar 20, 2004 7:45 am

dunno if it's just me or if i need another programme but i can't even get the thing to run it gives me a run time error in axtive x
User avatar
Junesun
Administrator Emeritus
Posts: 807
Joined: Sat Feb 07, 2004 9:24 am
Location: Berlin, Germany
Contact:

Postby Junesun » Sat Mar 20, 2004 10:27 am

Ok, here's the code for adding a column to an Access database:

-----------------------------------------------------------------------------------

Dim dbsYourDB As Database
Dim wrkLocal As Workspace
Set wrkLocal = CreateWorkspace("", "admin", "")
Set dbsYourDB = wrkLocal.OpenDatabase(App.Path & "\xyz.mdb")
Dim tblNew As TableDef
Set tblNew = dbsYourDB.TableDefs("Name of your table")
With tblNew
.Fields.Append .CreateField("Name of the new column", dbText)
End With

----------------------------------------------------------------------------------

This opens the database xyz.mdb, assuming it's in the same path as the program exe (App.Path), goes to the table called "Name of your table" and inserts the column "Name of the new column" as a Text field. If you need another field type, you can find the list of type constants in the category DataTypeEnum in the DAO library (part of the object catalogue). I think you can take it from here.

Judith
User avatar
Jos Elkink
Founder Emeritus
Posts: 5711
Joined: Mon Jul 14, 2003 1:17 pm
Location: Dublin, Ireland
Contact:

Postby Jos Elkink » Sat Mar 20, 2004 1:56 pm

When I run the application, I get 'runtime error 13, type mismatch' ... anyone else who experienced this? :)
User avatar
Lone Wolf
Posts: 385
Joined: Tue Jan 13, 2004 8:55 am
Location: Canada

Postby Lone Wolf » Sat Mar 20, 2004 2:30 pm

A couple of things

First Anthony Thank you for doing all this work. You are the man...nest to Jos....and well...never mind lol

But I'm also getting a run-time error

Run-time Error '429':
Activex component can't create object

If I had more knowledge in codes I might have been able to figure this out my self........let this be lesson to everyone...stay in school and don't get kicked out for breaking some jerks hand after he slaps his girlfriend. :roll: Just stay in school. :D :D
Some are friends of the Wolf.....others are Dinner

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest