Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Articval
Novice


Joined: 01 Jun 2005
Posts: 47

PostPosted: 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} Arrow @{BagContainingPjNick.Food} Arrow 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]
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Articval
Novice


Joined: 01 Jun 2005
Posts: 47

PostPosted: 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??
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Articval
Novice


Joined: 01 Jun 2005
Posts: 47

PostPosted: Tue Mar 24, 2009 12:22 pm   
 
Ok, thankyou!! good to know Rolling Eyes
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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