|  | 
	
	
		| IceSoft Newbie
 
 
 Joined: 30 Jan 2002
 Posts: 7
 
 
 | 
			
			  |  Posted: Wed Sep 18, 2002 5:58 pm 
 Counting problemo
 
 |  
				| I made bot for my mud. I want to beable to count each time I cast spell. That is how often I have cast each spell on each person. Any ideas to kick start me 
 |  | 
	
	  |  | 
	
		|  | 
	
		| Retrovirus Wanderer
 
 
 Joined: 13 Jul 2002
 Posts: 51
 Location: Malaysia
 
 | 
			
			  |  Posted: Wed Sep 18, 2002 7:45 pm 
 |  
				| What output do you get..? Basically if you want to do an addition
 #tr Retro tells you 'aegis'
 cast 'aegis' retro
 #add spells_casted 1
 
 something like that.
 
 Cameth
 Saweth
 Fledeth my asseth offeth
 |  | 
	
	  |  | 
	
		|  | 
	
		| Charbal GURU
 
 
 Joined: 15 Jun 2001
 Posts: 654
 Location: USA
 
 | 
			
			  |  Posted: Wed Sep 18, 2002 8:01 pm 
 |  
				| Since you are rather sparing with the information (like what spells you want to count, whether you want to count all attempts or just successes) making a script for you isn't the easiest thing to do. 
 I'll try to give you a general solution anyway.
 
 #CLASS SpellCount
 #ALIAS countcast {#ADD %replace("%-2", " ", %null).%1 1}
 #CLASS 0
 
 
 Then, whenever your bot does a spell (or when it is sucessful, whatever you want), include countcast <personname> spell name.
 
 This will create a database variable with the name of the spell without spaces and hold each person's individual counts in fields with his/her name.
 
 For example,
 countcast Charbal cure light wounds
 This creates a database variable named curelightwounds and creates the field Charbal and assigns 1 to it.
 
 countcast Charbal ward vs evil
 The same as above, this time with wardvsevil
 
 countcast Aennor cure light wounds
 Creates the field Aennor in @curelightwounds and sets it to 1.
 
 countcast Charbal cure light wounds
 Increments Charbal field in @curelightwounds to 2.
 
 #SHOWDB can be used to display the results of the command in a readable format (or you can manually look at the variable using the settings editor). So, #SHOWDB @curelightwounds gives us the following output:
 Charbal: 2
 Aennor: 1
 
 And #SHOWDB @wardvsevil:
 Charbal: 1
 
 
 In this way, you can keep track of multiple spells and multiple targets.
 
 - Charbal
 |  | 
	
	  |  | 
	
		|  | 
	
		| IceSoft Newbie
 
 
 Joined: 30 Jan 2002
 Posts: 7
 
 
 | 
			
			  |  Posted: Wed Sep 18, 2002 8:31 pm 
 |  
				| Sorry I did not give you more info. But Charbal solution was actsacly what I was thinking about and had been trying. This works just fine :-) 
 Thanx
 |  | 
	
	  |  | 
	
		|  | 
	
		|  | 
	
		|  |