|
Articval Novice
Joined: 01 Jun 2005 Posts: 47
|
Posted: Tue Mar 24, 2009 11:40 am
A cleaner way to do the same? (Handling a variable's data) |
Hi all!!
Still getting adapted to Cmud, and guessing there sould be a new function such as %db() but for variables, which would make things simpler:
Lets think we have one bag for every PJ, containing diferent short of things.
We create an alias, called: BagContainingPjnick
In this alias, we have a list such as the one i send u as image:
The way I would access the "food slot" for example, in Zmud, would be:
@{BagContaining@{PjNick}.Food} @{BagContainingPjNick.Food} mushroom
Any new function to do it simpler?? (I mean i would like to get rid of the anoying } )
Thankyou!!
Pd: I searched b4 asking both in forum and in help, as allwayz.[/img] |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Mar 24, 2009 11:43 am |
I'm not sure exactly what you're asking. There is a %db function, and it'll do what you're after, but without knowing your exact problem I can't show you how to apply it. The example variable you gave seems to have no relation to the code at the bottom, so I'm not sure what exactly you're doing.
|
|
|
|
Articval Novice
Joined: 01 Jun 2005 Posts: 47
|
Posted: Tue Mar 24, 2009 11:49 am |
Thanks for the answer, its hard to explain, i will try again:
(I changed the variable names to be more understandable, and used the variable I have on my Cmud)
Using the variable on the pick, the sintax would be:
@{equipoperfecto@{pjnombre}.blandido}
The part @{pjnombre} would return the nick of my pj, being Armagedoom
Then it turns:
@{equipoperfectoArmagedoom.blandido}
And then, it would mean we got this output:
234ab
How to do the same with the %db() function?? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Mar 24, 2009 12:20 pm |
Unfortunately that's pretty much the best way to go about it. Your alternative is %db(@{%concat("equipoperfecto",@pjnombre)},"blandido") or something like, which isn't much better. You could perhaps make what you were doing originally look a little better by doing @{%concat("equipoperfecto",@pjnombre,".blandido")} but that's about the best you can hope for.
|
|
|
|
Articval Novice
Joined: 01 Jun 2005 Posts: 47
|
Posted: Tue Mar 24, 2009 12:22 pm |
Ok, thankyou!! good to know
|
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Tue Mar 24, 2009 12:52 pm |
Try using the hashset function from the package library, then you could
@{bagvar.bag.item}
and
#call @hashset(bagvar,bag,item,value)
Will eliminate numerous varibles and being a hashtable, faster |
|
|
|
|
|