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
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Thu Mar 05, 2015 2:10 am   

Calling a whole CLASS.
 
Is there a way to get data from a whole class.

Here is my example:

I want to use #PI to bring up a list of all the variables in one of my classes so I can manipulate only certain ones.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Thu Mar 05, 2015 2:16 am   
 
You could enable (#T+) and disable (#T-) a class, thereby making all of its variables inaccessible for a time.

You can define the class in variable definition.
#VAR name {value} {defaultValue} {class}

But I don't know of anyway to pull up just the variables that are in a given class.

Perhaps if you could explain what you are trying to do i could figure out a workaround?
_________________
Discord: Shalimarwildcat
Reply with quote
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Thu Mar 05, 2015 2:42 am   
 
Ok, thanks.

So, inside the class "@T2TMUD/Equipment" I have a ton of variable (string lists), they contain information like the items weight, value and it's short name for use when wearing/mending/selling gear. I select the items I am using manually and add them to my @Gear variable so I can manipulate it on the MUD.

What I want to do is bring up a PICK menu of all the variables inside the Equipment class, so I can select which ones I'm using, or see data about different equipment combinations. I'll write a script to manipulate that the data from the PICK menu.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Thu Mar 05, 2015 3:48 am   
 
Do the items you use change so often that you need to be able to wrangle it on the fly?

I think i need an example to understand better.

Say you have a sword a dagger and a club.... then what?
_________________
Discord: Shalimarwildcat
Reply with quote
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Thu Mar 05, 2015 4:30 am   
 
So lets just say I have three variables:

#CLASS Equipment
#VAR {A chainmail shirt} {100|200}
#VAR {Some pants} {50|70}
#VAR {A shield} {154|20}
#CLASS 0

The first value represents the items weight, the second it's protective value.

I want to be able to pull up a #PI so I can select certain pieces of equipment.

#PI {A chainmail shirt|Some pants|A shield} "What items do you want to use?"

and then I'll write some script that will total them all up.

#FORALL @items
{
#MATH weight @weight+@{%i}.1
#MATH pro @pro+@{%i}.2
}
#SHOW {Your equipment weighs @weight and provides @pro points of protection.}

I hope this clarifies it a bit? Just imagine that instead of three items, I'll have my whole CLASS full, about 100 items. One work around is that I make a string list variable that contains all the items names, and each time I add a new item, I also add its name to that list. It is just a lot of work, if there was a way to get select all variables in a class it would be easier.

:)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Thu Mar 05, 2015 5:24 am   
 
What i would do is make a proper dbVar to house all of the info instead of each item getting its own variable.
Perhaps have a separate variable for each possible equipment slot.

And yes, it is more work to set it up, but it will make it easier to do what you want in the end.
_________________
Discord: Shalimarwildcat
Reply with quote
Scarn
Apprentice


Joined: 24 Jul 2005
Posts: 137

PostPosted: Thu Mar 05, 2015 6:16 am   
 
So..

#ADDKEY Equipment {A helmet} {100|200}

?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4691
Location: Pensacola, FL, USA

PostPosted: Thu Mar 05, 2015 7:26 am   
 
$thisHelmet=a helmet
#ADDKEY Equipment.Helmets.${thisHelmet} Weight 100
#ADDKEY Equipment.Helmets.${thisHelmet} Protection 200
_________________
Discord: Shalimarwildcat
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