mIRC picture windows (help)

Dircen

Veteran XX
I'm fooling around with mirc scriping a bit and decided to make some sort of irc pong. However, I can't find a good/fast way to draw the ball without having to redraw the backgorund every time. Is there any way to get some type of layers going or something so I dont have to keep reloading the background everytime I move the ball? Here's what I mean: (this is not working pong. It's just an example)


Code:
alias dpong {
  window -c@ @dPong
  window -fCadp @dPong -1 -1 640 480
  drawpic -cs @dPong 0 0 dpong\Template.bmp
  set %dPong_Mouse 50
  set %dPong_Ball.x1 150
  set %dPong_Ball.y1 140
  set %dPong_Dir.x 1
  set %dPong_Dir.y 1
  timerdPong -m 0 10 { dPong_Update }
}

alias dPong_Update {
  dPong_moveBall
[COLOR=Red]  drawpic -c @dPong 0 0 dpong\Template.bmp     ;I don't want to do this every time :`([/COLOR]
  drawpic -c @dPong 100 %dPong_Mouse 640 50 10 50 dpong\Template.bmp
  drawpic -c @dPong %dPong_Ball.x1 %dPong_Ball.y1 640 0 10 10 dpong\Template.bmp
}

alias dPong_moveBall {
  if (%dPong_Ball.y1 <= 50) %dPong_Dir.y = 1
  else if (%dPong_Ball.y1 >= 370) %dPong_Dir.y = -1
  %dPong_Ball.y1 = $calc( %dPong_Ball.y1 + %dPong_Dir.y )

  if (%dPong_Ball.x1 <= 110) %dPong_Dir.x = 1
  else if (%dPong_Ball.x1 >= 530) %dPong_Dir.x = -1
  %dPong_Ball.x1 = $calc( %dPong_Ball.x1 + %dPong_Dir.x )
}

menu @dPong {
  mouse: {
    if ($mouse.y < 50) %dPong_Mouse = 50
    else if ($mouse.y > 330) %dPong_Mouse = 330
    else %dPong_Mouse = $mouse.y
  }
}

on 1:CLOSE:@dPong:{ timerdPong off }
With the red line in place it looks like this:
example1.jpg

Except the bar/ball flicker alot. It's redrawing the background and then the ball ontop.

With the red line commented out it looks like this;
example2.jpg

The bar/ball do not get erased. It doesn't redraw the background.

Is there anyway to move the bar/ball ontop of the background?


Here's Template.bmp if you want to try it.
http://www.dircen.com/Template.bmp
 
you need to make the bg a solid rectange that is black and redraw it with the white lines before you draw the ball. just imagine making a whole new frame.
 
Yaason said:
you need to make the bg a solid rectange that is black and redraw it with the white lines before you draw the ball. just imagine making a whole new frame.
Thats what i've been doing. With the red line uncommented it re-draws the whole picture with the ball in its new location. I was just wondering if there was a way to move the ball ontop of the background, but i guess not.
 
i havent worked with picture windows in a couple years and im going mostly off of memory but yeah, you need to redraw the whole thing
 
Anyway, i probably wont finish it if I can't stop it from flashing in between movements, here's what I have so far if anyone wants it. I was planning to make it multiplayer but right now its just against a wall.

http://www.dircen.com/dPong.rar

Just unrar to mirc/ and load it (read the readme)
 
I would also recommend putting a . before your timer statments so the things related to the timers don't show up in the active window
 
Smay said:
I would also recommend putting a . before your timer statments so the things related to the timers don't show up in the active window
Thanks, I was looking for a way to do that :)
 
Here's a slightly updated version with 600% less flashing (thanks Smay :))

http://www.dircen.com/dPongtwo.rar

if you loaded the other one just /unload -rs dpong/dpong.mrc before loading this one

stealth edit: this isn't finished, it's still just against a wall, but im going to bed now.
 
Back
Top