Top

GAME: Slides for mIRC


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  7.7 (of 7 scores)
Date Added  Feb 16, 2006
Last Updated  Apr 26, 2006
Tags  game  player  single  slides 

Introduction

<b>Slides for mIRC</b>
<i>To start, type: <b>/slides</b></i><b>Features:</b><li>Single player mIRC game<li>Use your own pictures to start this game.<li>Use any grid up to 50 (theoratically it supports any number, but it's capped there because of loading times).<li>The script virtually plays a game (without moving the pieces) to construct valid grids.<li>Dialogs and windows so it's easy on the eye.<li>Use the mouse cursor to move the slides<li>Another installment on my single player games.Snippet took long than expected (ran into some problems), but it's finally done. A small warning though, using very large grid number may take mIRC to load for a long time. Anyway <i>Enjoy!</i>

Grab the Code

alias slides {
  if ($hget(slides)) hfree slides
  $iif($window(@Slides),window -c @Slides)
  $iif($dialog(slides),dialog -v slides,dialog -dmrv slides slides)
}
alias -l slidestart {
  var %file = $+(",$iif($isfile($1-),$1-,$$sfile($mircdir $+ *.jpg)),"), %w = $int($calc($pic(%file).width / $n)), $&
    %h = $int($calc($pic(%file).height / $n)), %loop = 1, %x = $calc(%w * $n), %y = $calc(%h * $n)
  dec %w | dec %h
 
  ; Loading Start
  loading
 
  window -aCdfk0p @Slides -1 -1 $calc(%x + 1) $calc(%y + 1)
  window -fhnp @hslides 1 1 $calc(%x + 1) $calc(%y + 1)
 
  ; Save Config
  putcfg x 0 | putcfg y 0 | putcfg w %w | putcfg h %h
 
  ; Also temporarily creates a hidden window to store the original image
  drawpic -c @hslides 0 0 %file
  drawrect -f @hslides $c 0 $getmove
 
  ; Virtual play to construct a valid grid
  virtualplay
 
  var %x = 0, %y
  while (%x <= $calc($n - 1)) {
    %y = 0
    while (%y <= $calc($n - 1)) {
      tokenize 46 $getco(%x,%y)
      drawcopy @hslides $getmove($1,$2) @Slides $getmove(%x,%y)
      inc %y
    }
    inc %x
  }
  window -c @hslides
 
  ; Loading End
  loading
  window -o @Slides
}
alias -l makemove {
  ; Usage /makemove <n|e|s|w> [0|1]
  var %x = $calc($x + $co($$1).x), %y = $calc($y + $co($1).y)
  if (!$2) {
    if (($calc(%x + 1) !isnum $+(1,-,$n)) || ($calc(%y + 1) !isnum $+(1,-,$n))) return
    drawcopy @Slides $getmove(%x,%y) @Slides $getmove
    drawrect -f @Slides $c 0 $getmove(%x,%y)
    hinc -m slides total
  }
  putco $x $y $getco(%x,%y) | putco %x %y 0.0
  putcfg x $calc($x + $co($1).x) | putcfg y $calc($y + $co($1).y)
  if (!$2) $iif($endgame,$iif($input(Congratulations ( $+ $getcfg(total) turns)!,o,Puzzle Solved), $&
    $iif($input(Another Puzzle?,y,Again...),slides,window -c @slides),window -c @slides))
}
alias -l endgame {
  ; $endgame returns $true if user solved hte puzzle
  var %x = 0, %y
  while (%x <= $calc($n - 1)) {
    %y = 0
    while (%y <= $calc($n - 1)) {
      if ($getco(%x,%y) != $+(%x,.,%y)) return $false
      inc %y
    }
    inc %x
  }
  return $true
}
alias -l virtualplay {
  ; Virtually plays a game to construct a valid grid
  ; Initialize default grid
  var %x = 0, %y
  while (%x <= $calc($n - 1)) {
    %y = 0
    while (%y <= $calc($n - 1)) {
      putco %x %y $+(%x,.,%y)
      inc %y
    }
    inc %x
  }
  var %a = 1, %b, %m, %con = $calc($n ^ 3)
  while (%a <= %con) {
    %m = $suggestmove($reversemove(%m))
    makemove %m 1
    inc %a
  }
}
alias -l suggestmove {
  ; Suggest a move
  var %m = $iif($y != 0,n) $iif($x != $calc($n - 1),e) $iif($y != $calc($n - 1),s) $iif($x != 0,w), $&
    %m = $iif($1,$remtok(%m,$1,1,32),%m)
  return $gettok(%m,$r(1,$numtok(%m,32)),32)
}
 
; Some shortened for ease:
alias -l n return $getcfg(n)
alias -l x return $getcfg(x)
alias -l y return $getcfg(y)
alias -l c return $color(background)
 
; Hash aliases:
alias -l getcfg return $hget(slides,$$1)
alias -l putcfg hadd -m slides $1 $$2
alias -l getco return $hget(slides,$+(c,$1,.,$$2))
alias -l putco hadd -m slides $+(c,$1,.,$2) $$3
 
alias -l getmove {
  ; Get coördinate outputs, important alias, usage $getmove([x],[y])
  return $calc(1 + $iif($2 != $null,$1,$x) * ($getcfg(w) + 1)) $&
    $calc(1 + $iif($2 != $null,$2,$y) * ($getcfg(h) + 1)) $getcfg(w) $getcfg(h)
}
; $reversemove([n|e|s|w])
alias -l reversemove return $replacex($1,n,s,e,w,s,n,w,e)
 
; Replaces [n,e,s,w] with a numerical representation, usage $co(<n|e|s|w>).[x|y]
alias -l co return $calc($iif($prop = x,$replace($1,e,1,w,-1),$replace($1,n,-1,s,1)))
 
;-- Dialog and window stuff --
dialog -l slides {
  title "Slides"
  size -1 -1 160 50
  option dbu
 
  edit "", 1, 5 5 100 10, autohs
  button "Select Image...", 2, 110 5 45 11
  combo 3, 5 20 80 10, drop
  button "OK", 4, 5 35 40 11, ok
}
on *:dialog:slides:init,sclick:0,2,4: {
  if ($devent = init) {
    var %a = 2
    while (%a <= 50) {
      did -a $dname 3 %a x %a Puzzle
      inc %a
    }
    did -c $dname 3 3
  }
  else {
    if ($did = 2) did -o $dname 1 1 $shortfn($$sfile($mircdir $+ *.jpg))
    elseif ($did = 4) {
      putcfg n $gettok($did(3),1,32)
      slidestart $did(1)
    }
  }
}
alias -l loading {
  ; Loading screen, usage '/loading' to start, '/loading' to end
  if ($window(@loading)) {
    window -c @loading
    return
  }
  window -aBCdhk0op +b @loading -1 -1 100 50
  var %a = drawtext @loading 1 Arial
  %a 12 22 7 Loading
  %a 10 16 25 Scrambling...
}
menu @Slides {
  sclick:{
    tokenize 32 $getmove
    if ($mouse.x isnum $+($1,-,$calc($1 + $3))) makemove $iif($mouse.y < $2,n,$iif($mouse.y > $calc($2 + $4),s))
    elseif ($mouse.y isnum $+($2,-,$calc($2 + $4))) makemove $iif($mouse.x < $1,w,$iif($mouse.x > $calc($1 + $3),e))
  }
  New:slides
  Exit:window -c @Slides
}
; mknobbout [at] gmail [dot] com

Comments

  (12)  RSS
Kyuuryu_Kijoutsu
Comments: 6
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Feb 16, 2006 4:03 pm
I didn't find anything wrong with this, I sort of liked it. Cool quickstep.
Gex
Comments: 94
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Feb 16, 2006 5:39 pm
Great work Quickstep
*high quality code
*full functionality
*easy to use
*funny :D
RoninWarrior
Comments: 252
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Feb 17, 2006 7:20 am
This is pretty sweet i have been getting into the mIRC games and stuf here as of late and this is by far one of the nicest ones recently released.Awsome job QuickStep as useuall.
StanZ
Comments: 19
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Feb 17, 2006 6:52 pm
Nice work and effort on this snippet.
Gex
Comments: 94
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Feb 20, 2006 4:52 pm
StanZ just curious..???u write c++ ??
Gex
Comments: 94
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Feb 20, 2006 4:54 pm
well ok what i meant is: i c that ur a game designer(good one) what i always c that game designers works on either c++ or DarkBasic professional yet there are some ppl write their games in VB ... so what abt u
StanZ
Comments: 19
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Feb 20, 2006 9:18 pm
I tried Darkbasic a week Gex, and did a demo. I could make a 3D world with few instructions. About C++ for stuffs I like, I need inline assembler. (Loops > 4000). I started 4 monh ago assembler with an Atari St emulator (devpack+Monst owning to the nice tutos I found) I'm fan of prehistoric coding ;p (before 3D acceleration) like making your own routines such line or filler with dots.
Gex
Comments: 94
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Feb 21, 2006 8:45 pm
lol u remind me with a friend ( he hates using the built in functions
in anylanguage just want to make evrythg alone :D i told him to try to invent his own language to feel better ). anyway i c ur excellent in physics/geometery, in fact i believe thats the most necessary agent for someone to create game/animation/etc
ch1zra
Comments: 70
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Apr 18, 2006 5:14 am
* No such identifier: $calc (line 52, script1.mrc)

fix this :)
QuickStep
Comments: 123
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Apr 18, 2006 5:28 am
Well chizra since you are the only one here who has this problem, you better fix your mirc.
QuickStep
Comments: 123
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Apr 18, 2006 5:33 am
Also you need 6.16 or higher
ch1zra
Comments: 70
 
mIRC Snippet:  GAME: Slides for mIRC
Posted on Apr 18, 2006 10:20 am
i have 6.17

prob is :

putco $calc $x $y $getco(%x,%y) | putco %x %y 0.0

here is an extra "$calc"

:]

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom