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
Farek
Beginner


Joined: 13 Oct 2004
Posts: 29

PostPosted: Thu Dec 10, 2015 7:10 pm   

Summary of values in db
 
I have created a db that keeps track of how much exp i have gathered.
But i dont get how to make a summary of all the values.

Example:
Reply with quote
shalimar
GURU


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

PostPosted: Thu Dec 10, 2015 9:31 pm   
 
First you will need to be able to reference everything in your database:
%dbkeys

Then you need to loop through them all:
#FORALL

You will need a temporary place to store the information:
#LOCAL $variables

And then an easy repeatable way to repeat to process in other scenarios:
#FUNCTION

In the end you could get something like this:

Code:
<func name="listAdder" id="3841">
  <value>#FORALL %dbkeys( $dbList) {$total=($total+$dbList.%i)}
#RETURN $total</value>
  <arglist>$dbList, $total</arglist>
</func>

Paste that onto the XML tab.

Syntax for use would be @listAdder(@someListHere)
_________________
Discord: Shalimarwildcat
Reply with quote
Farek
Beginner


Joined: 13 Oct 2004
Posts: 29

PostPosted: Sat Jan 02, 2016 9:34 am   
 
thanks for the help
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