Savage_CL commented on a Page, Math Identifiers  -  Jul 14, 2011

@Purplebeard, You could do something like this:

on *:TEXT:!avarage*:#:{
if ($2 == $null) { notice $nick You must enter a string of numbers to return an avarage! | HALT }
if ($3 == $null) && ($2 isnum) { notice $nick The avarage of a single number is itself! | HALT }
if ($0 > 100) { notice $nick Please limit your list to 100 values! | HALT }
var %total $0
var %temp 2
while (%temp <= %total)  {
if ($eval($ $+ %temp,2) isnum) { var %string %string $v1 }
else { notice $nick All values must be numbers | HALT }
inc %temp }
notice $nick The avarage of these numbers is: $avrg(%string)
}
}

Notice, I wrote this in the comment box, it is untested. You may need to make some modifications. For example, the if statement in the while loop.... you may need to change the second value in the $eval identifier (It is currently two, which I believe should work, but I haven't worked with it much.)

Best of luck!

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.