About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Fidel
Beginner


Joined: 07 Oct 2009
Posts: 19
Location: Poland

PostPosted: 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
Code:

#NO function()

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:
Code:

dbVar.1
dbVar.2


Which returned first and second key so it was
Code:

Key1
Key2


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
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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
Reply with quote
Fidel
Beginner


Joined: 07 Oct 2009
Posts: 19
Location: Poland

PostPosted: Mon Jun 14, 2010 10:21 pm   
 
Great!

Thanks for your reply
Reply with quote
Fidel
Beginner


Joined: 07 Oct 2009
Posts: 19
Location: Poland

PostPosted: 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
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Jun 22, 2010 5:30 pm   
 
Confirmed the bug with %dbkeys(@dbvar).1 not working and have added it to the bug list.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net