/drawcir and /drawsect

By Firstmate on Nov 30, 2008

I'm not that great with PicWins, but I realized that there isn't a command in mIRC for drawing circles. I searched a little bit and found not many exist. So I decided to make one.

Idk what you might use it for, but here's a screenie too.

/drawcir

Syntax: /drawcir <@Window>

The x and y represent the center of the desired circle.

Image

/drawrect
For this command, the degrees are a little different. If you were to look at a compass, 0 degrees is east, and as the degree increases, it goes clockwise.

Syntax /drawsect <@Window>

Note**: I'll add the switches for any of the possible draw commands later. For now, please rate.

alias drawcir {
  var %i = 0, %w = $1, %c = $2, %s = $3, %x = $4, %y = $5, %r = $6, %x1, %y1, %x2, %y2
  while (%i <= 360) {
    if (%i == 0) { 
      %x1 = $calc(%x + %r)
      %y1 = %y
      drawdot %w %c %s %x1 %y1
    }
    else {
      %x2 = %x1
      %y2 = %y1
      %x1 = $calc(%x + (%r * $cos(%i).deg)$cos(%i))
      %y1 = $calc(%y + (%r * $sin(%i).deg)$sin(%i))
      drawline %w %c %s %x1 %y1 %x2 %y2
    }
    inc %i
  }
}
alias circletest {
  window -pd @Test 1 1 200 200
  drawcir @Test 1 1 100 100 60
}

alias drawsect {
 var %i = $7, %b = $8, %w = $1, %c = $2, %s = $3, %x = $4, %y = $5, %r = $6, %x1, %y1, %x2, %y2
 while (%i <= %b) {
  if (%i = $7) {
   %x1 = $calc(%x + (%r * $cos(%i).deg)$cos(%i))
   %y1 = $calc(%y + (%r * $sin(%i).deg)$sin(%i))
   drawdot %w %c %s %x1 %y1
  }
  else {
   %x2 = %x1
   %y2 = %y1
   %x1 = $calc(%x + (%r * $cos(%i).deg)$cos(%i))
   %y1 = $calc(%y + (%r * $sin(%i).deg)$sin(%i))
   drawline %w %c %s %x1 %y1 %x2 %y2
  }
  inc %i
 }
} 

Comments

Sign in to comment.
Firstmate   -  Dec 01, 2008

I was unaware of that :D

Well at least my second code is still is semi-useful. I used the center because it's kinda the basis of how it works, I guess you can say. But it's also because it's easier to use it that way.

I guess I'll remove /drawcirc lol
I'll update /drawsect so it accepts a few switches and even a parameter to "fill" it, so to speak as if it could be used a progress bar.

 Respond  
Mpdreamz   -  Dec 01, 2008

Code could have been a bit more cleaner if you had incorperated a $circle alias to return x y position to draw. Zonirc has some very good suggestions and is right about the -e switch it does allow you to create circles.

 Respond  
zonirc   -  Dec 01, 2008

this is a nice idea... however I think mIRC already have a /drawrect -e which can draw a circle eventhought in help file its pointed as a eclipse.
One thing I notice that you had use x and y as a center point(for me its confused myself and this totaly because im not good in math... i think this is the correct way to draw a circle isnt it?)
I also love to see if you can support the /draw* switches such as -r so that your script can be more versatile.

 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.