|  | 
	
	
		| charneus Wizard
 
  
 Joined: 19 Jun 2005
 Posts: 1876
 Location: California
 
 | 
			
			  |  Posted: Mon Jan 07, 2008 7:12 am 
 [2.18] #FORALL bug?
 
 |  
				| I have the following in an alias: 
 
 
 
	  | Code: |  
	  | #FORALL @spu_db_exec.sk_tocast {%i;#ADDKEY spu_db_exec sk_tocast %delitem(%i, @spu_db_exec.sk_tocast)} |  
 Now on zMUD, it works fine. Does exactly what it's supposed to do. However, in CMUD, the #ADDKEY isn't treated as a CMUD command. Instead, it's sent to the MUD as if it was ~#ADDKEY instead. Same goes for any CMUD command. #FORALL doesn't appear to like CMUD commands within it's own commands...
 
 Charneus
 |  | 
	
	  |  | 
	
		|  | 
	
		| Larkin Wizard
 
  
 Joined: 25 Mar 2003
 Posts: 1113
 Location: USA
 
 | 
			
			  |  Posted: Mon Jan 07, 2008 3:40 pm 
 |  
				| The use of %i alone before the #ADDKEY is suspicious. You should be using #EXEC instead, methinks. Don't know if that has any effect on the behavior or not, however. 
 Is it really prudent to modify the value of the loop control variable as you're going through the loop? Personally, I'd put it into a local variable and loop on that instead (still modifying the non-local variable inside the loop).
 |  | 
	
	  |  | 
	
		|  | 
	
		| charneus Wizard
 
  
 Joined: 19 Jun 2005
 Posts: 1876
 Location: California
 
 | 
			
			  |  Posted: Mon Jan 07, 2008 5:09 pm 
 |  
				| Heh. This is a script that a friend wrote (for zMUD) and I've been doing him the courtesy of changing it all over to CMUD, so I didn't think about the purpose of removing the skill from the key. I'll have to ask him about that. 
 However, I changed it to #EXEC {%i} and it seemed to recognize that #ADDKEY is a CMUD command now. Either way, it's still a bug to consider #ADDKEY a MUD command instead of a CMUD command without the # escaped.
 
 Charneus
 |  | 
	
	  |  | 
	
		|  | 
	
		| Fang Xianfu GURU
 
  
 Joined: 26 Jan 2004
 Posts: 5155
 Location: United Kingdom
 
 | 
			
			  |  Posted: Mon Jan 07, 2008 6:59 pm 
 |  
				| Eh, I'm not sure since using %i on its own line is an error. If it's working when it's done properly, it doesn't seem vital unless it's affecting something else. 
 Probably easier than modifying the variable individually would just be to do:
 
 
 
 
	  | Code: |  
	  | #forall @spu_db_exec.sk_tocast {#exec %i} spu_db_exec.sk_tocast = ""
 |  since that's what'll happen anyway.
 |  | 
	
	  |  | 
	
		|  | 
	
		| charneus Wizard
 
  
 Joined: 19 Jun 2005
 Posts: 1876
 Location: California
 
 | 
			
			  |  Posted: Tue Jan 08, 2008 5:27 am 
 |  
				| Yeah, I know. Like I said, it's not my script, but I'm just converting it over. I'll probably rewrite it because it is pointless to remove it from the list... :\ 
 Only reason I figured it was a bug is because it's not just %i, but it's using a function in general. Don't know why one would do that (at least, not off the top of my head) but if you use a function, you can't use a command within it. *shrug*
 
 Charneus
 |  | 
	
	  |  | 
	
		|  | 
	
		| Fang Xianfu GURU
 
  
 Joined: 26 Jan 2004
 Posts: 5155
 Location: United Kingdom
 
 | 
			
			  |  Posted: Tue Jan 08, 2008 9:34 am 
 |  
				| In fact, if there's not already, I think there should be a Changes for zMUD Users article on using functions and variables on their own line. 
 EDIT: There.
 |  | 
	
	  |  | 
	
		|  | 
	
		| Zugg MASTER
 
  
 Joined: 25 Sep 2000
 Posts: 23379
 Location: Colorado, USA
 
 | 
			
			  |  Posted: Tue Jan 08, 2008 5:46 pm 
 |  
				| Thanks Fang! 
 |  | 
	
	  |  | 
	
		|  | 
	
		|  | 
	
		|  |