 |
Fidel Beginner
Joined: 07 Oct 2009 Posts: 19 Location: Poland
|
Posted: Mon Jun 14, 2010 10:04 pm
[3.19d] Two changes after update |
Hi,
I have just updated cmud to newest beta version and some of my scripts are not working.
First is that calling a function using
or
Code: |
WindowName:#NO function()
|
, does not work
I have easily fixed it by changing #NO to #EXECUTE (which earlier didn't work fine)
I don't know if it is a bug or intended functionality. #NO was always little strange for me :)
Second:
Having a variable of type Database Record for example named dbVar:
Code: |
Key1 = Value1
Key2 = Value2
Key3 = Value3
|
In earlier version I used:
Which returned first and second key so it was
Now it returns values instead of keys, so it works as %db() function.
Is it a bug?
If not, how can I get key number x ?
I think that workaround could be to get all the keys as list and then key number x using %item().
I have not tested that, so I will update when its done. I'm not sure if this is going to work because of hash functions used in list DB variables.
Thanks for your help
Fidel |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jun 14, 2010 10:17 pm |
1) #NOOP was deprecated in the recent version. You need to use #CALL to call a function, and the proper syntax is:
#CALL @function()
for user defined functions, or
#CALL %function()
for zScript functions. You were missing the @ or the % in front of your function name.
2) @dbvar.1 was always supposed to return the first *value* in a table or list, and not the key. To get the key name, you can use the %dbkeys function and do something like this:
#SHOW %dbkeys(@dbvar).1 |
|
|
 |
Fidel Beginner
Joined: 07 Oct 2009 Posts: 19 Location: Poland
|
Posted: Mon Jun 14, 2010 10:21 pm |
Great!
Thanks for your reply |
|
|
 |
Fidel Beginner
Joined: 07 Oct 2009 Posts: 19 Location: Poland
|
Posted: Tue Jun 22, 2010 9:56 am |
I have to return to this topic.
In version 3.19d and 3.19f it worked fine, but now calling %dbkeys(@dbvar) gives rows in different order than it is in variable (hashing?). Is there any way to get key in line x from DB Variable?
And more:
When variable content are two pairs
Dwarf 1
Elf 2
calling #SHOW %dbkeys(@inniKondycje).1
Will show "Dwarf|Elf.1" or "Elf|Dward.1" instead of first value of a list |
|
|
 |
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jun 22, 2010 12:47 pm |
Unless you specify a type of sort order for a db variable, the order of keys cannot be relied on. You need to either specify a sort order, or use a different method--there are likely other ways to do what you actually want which don't rely on a specific order.
But you're right that %dbkeys(@dbvar).1 does not work now. |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 22, 2010 5:30 pm |
Confirmed the bug with %dbkeys(@dbvar).1 not working and have added it to the bug list.
|
|
|
 |
|
|