You're right. Well as you said the functions already exist, they're just not "public" (since I thought they would just be used internally) but they will be in the next version.Well in my case, I'm trying to make a complete engine where I can make tables on the fly using the exe, and not having to go into the gmk changing everything. Also, that code snippet I posted above is a good example on how to achieve that. I'm sure that other people will try to do the same thing, so it wouldn't hurt to add.
Gm Database System v10.3
#21
Posted 27 November 2009 - 05:56 AM
#22
Posted 27 November 2009 - 06:11 AM
db_entry_count(); has 3 arguments, but doesn't/shouldn't it return how many entries are in a single column? (So it should be (table id, column) I guess)
Also, I got this error
___________________________________________
ERROR in
action number 1
of Draw Event
for object obj_example:
In extension function db_entry_count:
In extension function db_entry_get_pos_all:
Error in code at line 14:
for (n = 0; n < ds_list_size(global.db_list_entries[argument0, colpos]); n += 1)
at position 65: Negative array index
I assume the error is a result of this code:
//draw the values
for (m = 0; m < db_entry_count(table, n-1, 1); m += 1)
{
if (n == 0)
{
value = string(m);
}
else
{
value = db_entry_get_pos(table, n-1, m);
}
//if this entry is selected, change the color
if (selectedrow == m)
{
draw_set_color(c_orange);
if(selectedcol+1 == n && selectedcol>-1)draw_set_color(c_yellow);
}
draw_text(20 + n * 110, 76 + m * 22, value);
draw_set_color(c_white);
}
Edited by brod, 27 November 2009 - 06:15 AM.
#23
Posted 27 November 2009 - 02:37 PM
Counts the number of entries where the value of the given column corresponds to the given value. Returns the number of entries found.
If you want to count the number of entries in a table (it will be the same for every column), use db_table_get_size().
Also can I please have your complete script so I know what the values of n are in this piece of code? Thank you!
#24
Posted 27 November 2009 - 02:55 PM
I am having a very frustrating problem though, for some reason, this keeps on returning the default value when I try to put in a decimal value..
if (menu == 0)
{
//add entry
var exe;
exe = "db_entry_add(" +string(table)+ ", " +string(db_column_count(table))+ ", ";
for(a=0;a<db_column_count(table);a+=1)
{
if(db_column_get_type(table, a)==0)
{
exe+= string(get_integer(db_column_get_name(table, a), 0)); //always return 0 when I put in any decimal value
}
else
{
exe+= '"'+get_string(db_column_get_name(table, a),db_column_get_default(table, a))+'"';
}
if(a<db_column_count(table)-1)exe+=", ";
else exe+=")";
}
execute_string(exe);
}
Edited by brod, 27 November 2009 - 02:56 PM.
#25
Posted 27 November 2009 - 08:09 PM
#26
Posted 27 November 2009 - 10:53 PM

damn. Well that ruins my plans. Guess I'll have to come up with something else.
Edited by brod, 27 November 2009 - 11:59 PM.
#27
Posted 27 November 2009 - 11:12 PM
#28
Posted 28 November 2009 - 12:00 AM
#29
Posted 28 November 2009 - 01:12 AM
#30
Posted 28 November 2009 - 01:55 AM
But yeah, I'm done bickering and annoying you, thanks again for the awesome extension, GREAT IDEA!
#31
Posted 28 November 2009 - 04:25 AM
#32
Posted 28 November 2009 - 07:29 AM
I have the pleasure to announce the release of VERSION 10!
NEW in version 10.0
- Major change in the columns system to enhance flexibility: columns now have ID's, which you can save as variables to use in function calls (you can still use the column name directly, but not the position)
- New functions db_column_insert(), db_column_destroy(), many new db_column_get_* functions
- Ability to sort by more than one column with the new db_table_sort_multiple() function
- Improved the example, now has drag & drop and the ability to add, insert and destroy columns
- Solved a bug in the shuffle function, that prevented it from working under certain conditions
- Added arguments to change the size of the drawing in db_table_draw()
- Changed a bit the bahevior of the function db_table_read()
- Optimized a few scripts
- Shorter and cleaner argument names in the script editor help panel
#33
Posted 28 November 2009 - 02:42 PM
Edited by brod, 28 November 2009 - 03:09 PM.
#34
Posted 07 December 2009 - 12:14 PM
But could you put in the table data in a .ini file?
#35
Posted 07 December 2009 - 11:20 PM
#36
Posted 26 December 2009 - 05:35 AM
#37
Posted 10 January 2010 - 02:29 AM
One thing though, is it fast?
- Alex
EDIT: Awesome, compatible with GM8
Edited by Rafferty97, 10 January 2010 - 02:31 AM.
#38
Posted 10 January 2010 - 03:15 PM
Speed shouldn't be a problem!One thing though, is it fast?
#39
Posted 14 March 2010 - 09:08 PM
#40
Posted 05 April 2010 - 09:37 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











