Stratego — File Browser
Strategov1.1 / Strategov1.1 / Stratego.mrc
Stratego.mrc — 92.73 KB — Download this file
; _______________________________________________
;|
;| Stratego
;|_______________________________________________
;|
;| Version: 1.1
;| Author: RagingDemon
;| Addon type: game
;| E-mail: ragingdemon@gmail.com
;| URL: www.geocities.com/gren_gr/stratego.zip
;| Copyright: 2004 @ July, 1
;|_______________________________________________
;|
;| Please do not modify the source code below
;|_______________________________________________
alias stratego { str_init }
menu menubar,status,channel {
-
Stratego
.Play game: stratego
.-
.$iif($active ischan,Search for Stratego players in $active) : .enable #stratego | window -c @str_users | .ctcp $active stratego_search | str_e Searching for Stratego players in $active $+ ... | .timer.game.str_users -o 1 40 .disable #stratego
.$iif($active ischan,Give game URL in $active) : msg $active [Stratego v $+ $str_ver $+ ] - $str_url
.-
.View game history: str_history
.-
.New version
..Check for version updates now: if ($sock(stratego)) && (!$input(A game is still in progress. If you continue this game will be cancelled. Proceed?,yi,Confirmation)) { halt } | str_update
..-
..$iif($str_g(auto.update) == on,$style(1)) Automatically check for version updates on startup: str_a auto.update $iif($str_g(auto.update) == on,off,on) | str_e Auto-check for version updates on startup is $iif($str_g(auto.update) == on,enabled.,disabled.)
.-
.Help: str_help
.-
.Unload: if ($input(Are you sure you want to unload Stratego?,yw,Warning)) { str_unload }
-
}
on *:join:#stratego: {
if ($network == GRNet) && ($nick == $me) { .ctcp $chan stratego_inform $str_ver $str_rank $iif($ip != $null,$v1,n/a) $str_ratio $str_streak }
}
ctcp ^*:stratego_search:#: { .ctcpreply $nick stratego_search player_here $str_ver $str_rank $iif($ip != $null,$v1,n/a) $str_ratio $str_streak | haltdef }
ctcp ^*:stratego_inform:#stratego: { str_e New player joined $chan - User: $nick ( $+ $4 $+ ) Version: $2 Rank: $3 Win ratio: $5 Streak: $6- | haltdef }
alias -l str_url { return www.geocities.com/gren_gr/stratego.zip }
#stratego off
on *:ctcpreply:stratego_search*: {
if ($2 == player_here) {
var %w = @str_users
if (!$window(%w)) { window -dsChk0l +nxt %w -1 -1 570 250 Verdana 9 }
window -a %w
aline %w User: $nick ( $+ $5 $+ ) Version: $3 Rank: $4 Win ratio: $6 Streak: $7-
var %z = $line(%w,0)
titlebar %w - %z $iif(%z == 1,user,users) found
.timer.game.str_users -o 1 15 .disable #stratego
haltdef
}
}
#stratego end
menu @str_users {
dclick: { if ($sline($active,1)) { query $gettok($v1,2,32) } }
}
on *:load: { str_e Stratego v $+ $str_ver has been successfully loaded. Type /stratego to launch the game. | str_help }
on *:unload: { str_e Successfully unloaded Stratego v $+ $str_ver $+ . Thank you for using it... }
on *:exit: { str_end }
on *:start: {
if ($version < 6.16) { str_e You must use mIRC 6.16+ in order to play this game. You currently use mIRC $version $+ . Please update at www.mirc.com. Unloading game... | str_unload }
if (!$isfile($_noc(army.png))) { str_e Image file containing game' s army units was not found. Unloading game... | str_unload }
if (!$isfile($_noc(board.jpg))) { str_e Image file containing game' s board was not found. Unloading game... | str_unload }
if (!$isfile($_noc(stratego.hsh))) { write -c $_noc(stratego.hsh) }
if (!$hget(stratego)) { hmake stratego 1000 | hload stratego $_noc(stratego.hsh) }
if (!$str_g(sounds)) { str_a sounds on }
if (!$str_g(tip)) { str_a tip on }
if (!$str_g(formation.Cannon‡fodder)) { str_a formation.Cannon‡fodder 9-6-b-7-9-3-9-4-b-f-8-5-9-b-7-8-8-4-3-b-9-5-9-8-b-7-9-8-4-s-6-5-6-5-6-b-7-1-9-2 }
if (!$str_g(formation.Double‡fake)) { str_a formation.Double‡fake 7-b-8-b-f-7-b-8-b-7-b-9-8-1-9-8-9-9-8-b-4-3-s-7-2-4-5-9-3-4-6-5-5-6-9-9-6-5-9-6 }
if (!$str_g(formation.Lines‡of‡defence)) { str_a formation.Lines‡of‡defence f-4-5-9-9-9-6-9-8-8-6-7-5-s-5-8-9-5-9-9-b-b-1-3-b-b-3-2-b-b-7-8-6-4-7-9-6-4-7-8 }
if (!$str_g(formation.Shoreline‡bluff)) { str_a formation.Shoreline‡bluff 9-7-8-6-9-7-7-b-6-8-6-s-5-5-8-8-5-9-5-6-4-2-3-b-1-4-b-8-3-4-9-9-b-f-b-b-7-9-9-9 }
if (!$str_g(formation.Waffle‡defence)) { str_a formation.Waffle‡defence 8-9-3-8-9-8-7-b-f-b-8-9-3-4-9-s-b-7-b-7-5-9-6-2-9-8-5-b-7-b-6-9-4-4-9-6-5-1-6-5 }
.disable #stratego*
str_end
str_d my_ip
if ($str_g(auto.update) == on) { str_update }
}
alias -l str_g { return $hget(stratego,$1) }
alias -l str_a { hadd -m stratego $1 $2- }
alias -l str_d { hdel stratego $1 }
alias -l str_set {
str_a tmp.area $1
str_a tmp.turn 0
str_a tmp.game 1
str_a tmp.capture.s 0
str_a tmp.capture.9 0
str_a tmp.capture.8 0
str_a tmp.capture.7 0
str_a tmp.capture.6 0
str_a tmp.capture.5 0
str_a tmp.capture.4 0
str_a tmp.capture.3 0
str_a tmp.capture.2 0
str_a tmp.capture.1 0
str_a tmp.capture.b 0
str_opponent $2 $3 $4 $5-
}
alias -l str_cancel {
if ($sock(stratego)) {
if ($input(A game is in progress. Are you sure you want to cancel this game and surrender? $crlf $+ $crlf $+ Note: This will count as a defeat!,yws,@Stratego,Warning)) {
str_w quit
str_info Current game has been canceled.
str_gameover leave
}
else { halt }
}
}
alias -l str_rank {
var %z = $str_games, %p = $str_ratio
if (%z < 5) { var %r = Spy }
elseif (%z isnum 5-10) { if (%p >= 50) { var %r = Scout } | else { var %r = Spy } }
elseif (%z isnum 11-19) {
if (%p >= 50) { var %r = Miner }
elseif (%p isnum 20-49) { var %r = Scout }
else { var %r = Spy }
}
elseif (%z isnum 20-30) {
if (%p >= 55) { var %r = Sergeant }
elseif (%p isnum 30-54) { var %r = Miner }
elseif (%p isnum 14-29) { var %r = Scout }
else { var %r = Spy }
}
elseif (%z isnum 31-45) {
if (%p >= 55) { var %r = Lieutenant }
elseif (%p isnum 38-54) { var %r = Sergeant }
elseif (%p isnum 23-37) { var %r = Miner }
elseif (%p isnum 13-22) { var %r = Scout }
else { var %r = Spy }
}
elseif (%z isnum 46-62) {
if (%p >= 60) { var %r = Captain }
elseif (%p isnum 45-59) { var %r = Lieutenant }
elseif (%p isnum 32-44) { var %r = Sergeant }
elseif (%p isnum 21-31) { var %r = Miner }
elseif (%p isnum 11-20) { var %r = Scout }
else { var %r = Spy }
}
elseif (%z isnum 63-83) {
if (%p >= 60) { var %r = Major }
elseif (%p isnum 45-59) { var %r = Captain }
elseif (%p isnum 32-44) { var %r = Lieutenant }
elseif (%p isnum 21-31) { var %r = Sergeant }
elseif (%p isnum 13-20) { var %r = Miner }
elseif (%p isnum 7-12) { var %r = Scout }
else { var %r = Spy }
}
elseif (%z isnum 84-105) {
if (%p >= 65) { var %r = Colonel }
elseif (%p isnum 51-64) { var %r = Major }
elseif (%p isnum 40-50) { var %r = Captain }
elseif (%p isnum 31-39) { var %r = Lieutenant }
elseif (%p isnum 20-30) { var %r = Sergeant }
elseif (%p isnum 11-19) { var %r = Miner }
elseif (%p isnum 6-10) { var %r = Scout }
else { var %r = Spy }
}
elseif (%z isnum 84-105) {
if (%p >= 70) { var %r = General }
elseif (%p isnum 56-69) { var %r = Colonel }
elseif (%p isnum 46-55) { var %r = Major }
elseif (%p isnum 34-45) { var %r = Captain }
elseif (%p isnum 25-33) { var %r = Lieutenant }
elseif (%p isnum 16-24) { var %r = Sergeant }
elseif (%p isnum 10-15) { var %r = Miner }
elseif (%p isnum 5-9) { var %r = Scout }
else { var %r = Spy }
}
elseif (%z isnum 106-) {
if (%p >= 80) { var %r = Marshal }
elseif (%p isnum 66-79) { var %r = General }
elseif (%p isnum 57-65) { var %r = Colonel }
elseif (%p isnum 55-64) { var %r = Major }
elseif (%p isnum 44-54) { var %r = Captain }
elseif (%p isnum 31-43) { var %r = Lieutenant }
elseif (%p isnum 20-30) { var %r = Sergeant }
elseif (%p isnum 13-19) { var %r = Miner }
elseif (%p isnum 6-12) { var %r = Scout }
else { var %r = Spy }
}
return %r
}
alias -l str_streak {
var %q = $str_g(streak)
if (%q == $null) || ($str_games == 0) { return - }
var %l = $len(%q), %i = 1, %z = $left(%q,1)
while (%i <= %l) {
var %t1 = $mid(%q,%i,1), %t2 = $mid(%q,$calc(%i + 1),1)
if (%t1 != %t2) { if (%l == 1) { str_a streak %t1 } | break }
var %z = %z $+ %t1
inc %i
}
if (w isin %z) { var %z = $len(%z) $iif($len(%z) == 1,win,wins) }
elseif (l isin %z) { var %z = $len(%z) $iif($len(%z) == 1,loss,losses) }
else { var %z = $len(%z) $iif($len(%z) == 1,draw,draws) }
return %z
}
alias -l str_unload {
if ($hget(stratego)) { hfree $v1 }
if ($dialog(str_help)) { dialog -x $v1 }
sockclose stratego*
window -c @Stratego
window -c @str_host
window -c @str_help
window -c @str_gameover
.timer.str_* off
.unload -rs $+(",$script,")
halt
}
alias -l str_e { echo -a > $1- }
alias -l str_ver { return 1.1 }
alias -l str_draw {
var %w = @Stratego
if ($window(%w)) {
if ($1 == g) { var %y = 0 }
elseif ($1 == b) { var %y = 39 }
elseif ($1 == r) { var %y = 78 }
if ($2 == s) { var %x = 0 }
if ($2 == 9) { var %x = 29 }
if ($2 == 8) { var %x = 58 }
if ($2 == 7) { var %x = 87 }
if ($2 == 6) { var %x = 116 }
if ($2 == 5) { var %x = 145 }
if ($2 == 4) { var %x = 174 }
if ($2 == 3) { var %x = 203 }
if ($2 == 2) { var %x = 232 }
if ($2 == 1) { var %x = 261 }
if ($2 == b) { var %x = 290 }
if ($2 == f) { var %x = 319 }
if ($2 != T) { drawpic -n $iif($5 == f,@str_formation,%w) $3 $4 %x %y 29 39 $_noc(army.png) }
else { drawpic -n %w $3 $4 $3 $4 29 39 $_noc(board.jpg) }
}
}
alias -l str_enemy {
var %w = @Stratego
if ($window(%w)) {
if ($1 == b) { var %r = $rgb(0,0,130) }
elseif ($1 == r) { var %r = $rgb(130,0,0) }
drawrect -nrf %w %r 1 $2 $3 29 39
}
}
alias -l str_sel {
var %w = @Stratego
if ($window(%w)) { drawrect -nr %w $rgb(0,0,0) 2 $1 $2 29 39 }
}
alias -l _noc { return $+(",$scriptdir $+ $1-,") }
alias -l str_init {
var %w = @Stratego
if ($window(%w)) { window -c $v1 }
window -pek0 $+ $iif($str_g(desktop) == on,Cd) %w -1 -1 800 535
hdel -w stratego chat_*
hdel -w stratego bar_chat_*
drawfill -nr %w $rgb(0,0,0) $rgb(20,20,20) 1 1
drawrect -nrdf %w $rgb(255,255,255) 1 352 10 137 42 35 35
drawrect -nrdf %w $rgb(0,0,0) 1 354 12 133 38 30 30
drawrect -nrdf %w $rgb(255,255,255) 1 356 14 129 34 28 28
drawtext -nrpb %w $rgb(0,0,0) $rgb(255,255,255) Verdana 23 366 15 Stratego
drawrect -nr %w $rgb(170,170,170) 1 515 10 272 43
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 525 16 Original board versions by MB $+ $chr(153) and Jumbo $+ $chr(153)
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 525 31 Game version for mIRC by RagingDemon © 2004
drawrect -nr %w $rgb(170,170,170) 1 335 63 170 188 335 63 76 188
var %d = drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9, %d2 = drawtext -nrpb %w $rgb(170,170,170) $rgb(0,0,0) Verdana 9
%d2 345 56 Unit:
%d2 420 56 Own/Captured:
%d 345 75 Spy
%d 345 90 Scout
%d 345 105 Miner
%d 345 120 Sergeant
%d 345 135 Lieutenant
%d 345 150 Captain
%d 345 165 Major
%d 345 180 Colonel
%d 345 195 General
%d 345 210 Marshal
%d 345 225 Bomb
drawrect -nr %w $rgb(170,170,170) 1 515 63 272 188 515 63 272 71
%d2 525 56 Game status:
%d2 525 126 Personal stats and enemy' s info:
%d 525 75 Your color:
%d 525 90 Turn/Last move:
%d 525 105 Game duration:
%d 525 150 Total games/Win ratio:
%d 525 165 Wins/Losses/Draws:
%d 525 180 Streak/Rank:
%d 525 195 Enemy' s name:
%d 525 210 Enemy' s win ratio:
%d 525 225 Enemy' s streak/rank:
drawrect -nr %w $rgb(170,170,170) 1 335 261 452 163
%d2 345 254 Information and chat session:
str_draw g s 66 430
str_draw g 9 136 430
str_draw g 8 206 430
str_draw g 7 276 430
str_draw g 6 346 430
str_draw g 5 416 430
str_draw g 4 486 430
str_draw g 3 556 430
str_draw g 2 626 430
str_draw g 1 696 430
%d 71 470 Spy
%d 136 470 Scout
%d 206 470 Miner
%d 267 470 Sergeant
%d 334 470 Lieutenant
%d 411 470 Captain
%d 486 470 Major
%d 551 470 Colonel
%d 621 470 General
%d 690 470 Marshal
%d2 13 442 Weaker
%d2 738 442 Stronger
%d2 112 442 <
%d2 182 442 <
%d2 252 442 <
%d2 322 442 <
%d2 392 442 <
%d2 462 442 <
%d2 532 442 <
%d2 602 442 <
%d2 672 442 <
drawrect -nr %w $rgb(170,170,170) 1 771 261 16 163
drawrect -nrf %w $rgb(170,170,170) 1 771 261 16 17
drawrect -nrf %w $rgb(170,170,170) 1 771 407 16 17
drawtext -nrpb %w $rgb(0,0,0) $rgb(170,170,170) Webdings 9 775 261 5
drawtext -nrpb %w $rgb(0,0,0) $rgb(170,170,170) Webdings 9 775 407 6
drawrect -nrf %w $rgb(170,170,170) 1 772 278 14 129
drawrect -nr %w $rgb(0,0,0) 1 772 278 14 129
drawrect -nr %w $rgb(0,0,0) 1 772 262 14 15
drawrect -nr %w $rgb(0,0,0) 1 772 408 14 15
hdel -w stratego chat_*
hdel -w stratego bar_chat_*
str_info Welcome to Stratego. Double-click in this box to clear it. Right-click anywhere to get started...
str_stats 0
str_status
str_personal
str_opponent - - - -
str_clear
titlebar %w v $+ $str_ver
}
alias -l str_grid {
var %w = @Stratego
if ($window(%w)) {
var %z = 9, %x = 50, %y = 40, %r = $rgb(80,80,80)
while (%z > 0) {
drawline -nr %w %r 1 10 %x 312 %x
drawline -nr %w %r 1 %y 10 %y 410
inc %x 40
inc %y 30
dec %z
}
drawpic -n %w 71 171 71 171 59 79 $_noc(board.jpg)
drawpic -n %w 191 171 191 171 59 79 $_noc(board.jpg)
drawrect -nr %w $rgb(0,0,0) 2 9 9 303 403
var %i = 9, %y = 24
while (%i >= 0) {
drawtext -nr %w $rgb(255,255,255) Verdana 9 1 %y %i
inc %y 40
dec %i
}
var %d = drawtext -nr %w $rgb(255,255,255) Verdana 9
%d 22 411 A
%d 52 411 B
%d 82 411 C
%d 112 411 D
%d 142 411 E
%d 172 411 F
%d 202 411 G
%d 232 411 H
%d 262 411 I
%d 292 411 J
drawdot %w
}
}
alias -l str_clear {
var %w = @Stratego
if ($window(%w)) {
drawpic -n %w 0 0 $_noc(board.jpg)
str_grid
}
}
alias -l str_end {
if ($sock(stratego)) { str_info Disconnected... }
sockclose stratego*
str_clear
window -c @str_host
window -c @str_help
hdel -w stratego tmp.*
str_d my_field
unset %str
.timer.str_* off
str_status
str_opponent - - - -
str_stats 0
.timer.draw_str* off
hsave -o stratego $_noc(stratego.hsh)
}
alias -l str_status {
if ($window(@Stratego)) {
var %w = $v1
drawrect -nrf %w $rgb(0,0,0) 1 608 70 173 50
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(-)) 75 -
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(-)) 90 -
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(-)) 105 -
drawdot %w
}
}
alias -l str_new {
if ($sock(stratego).status == active) {
if ($str_g(tmp.game) == 2) { str_cancel }
else {
if ($input(A connection is already established. Are you sure you want to disconnect and start a new game?,wys,@Stratego,Warning)) { str_end | str_info Current game has been canceled. }
else { halt }
}
}
elseif ($sock(stratego_wait).status == listening) {
if ($input(You are already hosting a game. Are you sure you want to cancel it and start a new one?,wys,@Stratego,Warning)) { str_end | str_info Current game has been canceled. }
else { halt }
}
str_end
str_info Initializing new game...
if ($1 == h) {
; if (!$portfree(3339)) { str_clear | str_info Error: Game' s port -3339- is already in use. The game cannot begin until this port becomes available. Please wait a while and try again. | halt }
str_choose_col
}
elseif ($1 == j) {
var %z = $?="Enter opponent' s IP address to connect:"
if (%z == $null) { str_info New game canceled. | halt }
tokenize 32 %z
if (*.*.*.* iswm $1) && ($2 == $null) {
tokenize 46 %z
if ($1 isnum 0-255) && ($2 isnum 0-255) && ($3 isnum 0-255) && ($4 isnum 0-255) { str_client %z }
else { goto err }
}
else { goto err }
halt
:err
str_info Error: Incorrect syntax. Please use a valid IP address.
}
}
alias -l str_choose_col {
var %w = @str_host
if ($window(%w)) { window -c %w }
window -pdCohk0 +t %w -1 -1 250 150
drawfill -nr %w $rgb(0,0,0) $rgb(0,0,0) 1 1
drawrect -nr %w $rgb(170,170,170) 1 10 10 221 102
drawtext -nrpb %w $rgb(170,170,170) $rgb(0,0,0) Verdana 9 20 3 Select your army' s color:
drawrect -nrf %w $rgb(130,0,0) 1 60 25 29 39
drawrect -nrf %w $rgb(0,0,130) 1 150 25 29 39
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 64 68 Red
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 153 68 Blue
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 38 90 Note: Red army opens the game.
drawdot %w
if ($str_g(ask) == on) && ($input(Before hosting a new game you may want to configure the rules. Do it now? $crlf $+ $crlf $+ * Note: If you select not to configure the rules the game will start with the rules of your previous hosted game.,yqus,,@Stratego,Configure game rules?)) { str_rules }
}
on *:close:@str_host: { str_info New game canceled. | halt }
alias -l str_w { if ($sock(stratego)) { sockwrite -n stratego $me $1- } }
alias -l str_ping { str_w ping $ticks }
alias -l str_opponent {
if ($window(@Stratego)) {
str_opp_name $1
drawrect -nfr $v1 $rgb(0,0,0) 1 637 210 148 30
var %z = $4- $+ / $+ $2
drawtext -nrpb $v1 $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align($3)) 210 $3
drawtext -nrpb $v1 $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(%z)) 225 %z
drawdot $v1
}
}
alias -l str_opp_name {
var %z = @Stratego
if ($window(%z)) {
drawrect -nfr %z $rgb(0,0,0) 1 627 195 158 15
drawtext -nrpb %z $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align($1)) 195 $1
str_a tmp.nick $1
}
}
alias -l str_games {
var %z = $calc($str_g(wins) + $str_g(losses) + $str_g(draws))
if (%z == 0) { str_a wins 0 | str_a losses 0 | str_a draws 0 }
return %z
}
alias -l str_ratio {
var %z = $round($calc(($str_g(wins) / $str_games) * 100),1) $+ $chr(37)
return %z
}
alias -l str_personal {
if ($window(@Stratego)) {
var %w = $v1
drawrect -nfr %w $rgb(0,0,0) 1 637 150 148 45
var %z = $str_games $+ / $+ $str_ratio
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(%z)) 150 %z
var %z = $+($str_g(wins),/,$str_g(losses),/,$str_g(draws))
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(%z)) 165 %z
var %z = $+($str_streak,/,$str_rank)
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(%z)) 180 %z
drawdot %w
}
}
on *:sockread:stratego: {
var %win = @Stratego
if ($window(%win)) {
if ($sockerr) {
str_info Error: Connection failed. Game is canceled.
str_end
return
}
:read
sockread %str
if ($sockbr == 0) { return }
tokenize 32 %str
window -g %win
if ($str_g(tmp.game) == 1) || ($str_g(tmp.game) == 2) { str_opp_name $1 }
if ($2 == version) {
str_info Opponent' s name: $1
str_info Performing version compatibility check...
str_info Your version: $str_ver
str_info $1 $+ ' s version: $3
if ($3 == $str_ver) {
if ($sock(stratego_serv)) { sockclose stratego_serv }
str_info Version compatibility check passed! (Game version: $str_ver $+ )
str_a tmp.rule.scout $4
str_a tmp.rule.bomb $5
str_a tmp.rule.spy $6
str_a tmp.rule.battle $7
str_a tmp.rule.aggressor $8
str_info Rule variations:
str_info Scout only move rule: $4
str_info One time bombs rule: $5
str_info Assassin spy rule: $6
str_info Silent battle rule: $7
str_info Aggressor advantage rule: $8
str_info If you don' t agree with this set of rules type "!abort" any time before the game starts.
str_a tmp.abort 1
str_w versionreply $str_ver $str_rank $str_ratio $str_streak
}
else {
str_info Version compatibility check failed, game canceled!
str_w versionerr $str_ver
str_end
if ($3 > $str_ver) { str_info Attempting check for version updates... | str_update }
halt
}
}
if ($2 == versionreply) {
if ($sock(stratego_serv)) { sockclose stratego_serv }
str_info $1 $+ ' s version: $3
str_info Version compatibility check passed! (Game version: $str_ver $+ )
str_info Rule variations:
str_info Scout only move rule: $str_g(tmp.rule.scout)
str_info One time bombs rule: $str_g(tmp.rule.bomb)
str_info Assassin spy rule: $str_g(tmp.rule.spy)
str_info Silent battle rule: $str_g(tmp.rule.battle)
str_info Aggressor advantage rule: $str_g(tmp.rule.aggressor)
var %c = $iif($str_g(tmp.color) == blue,r,b)
str_set d $1 $4 $5 $6-
str_a tmp.field T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-L-L-T-T-L-L-T-T-T-T-L-L-T-T-L-L-T-T-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e
str_begin u %c
str_info Your side on board: Down
str_draw_area d
str_w begin $str_g(tmp.color) $str_rank $str_ratio $str_streak
if ($str_g(tip) == on) { str_tip }
.timer.str_ping_opponent -o 0 180 str_ping
}
if ($2 == versionerr) {
str_info $1 $+ ' s version: $3
str_info Version compatibility check failed, game canceled!
str_end
if ($3 > $str_ver) { str_info Attempting check for version updates... | str_update }
halt
}
if ($2 == begin) {
str_set u $1 $4 $5 $6-
if ($3 == blue) { str_a tmp.color Red | var %c = b }
elseif ($3 == red) { str_a tmp.color Blue | var %c = r }
str_a tmp.field e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-e-T-T-L-L-T-T-L-L-T-T-T-T-L-L-T-T-L-L-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T-T
str_begin d %c
str_info Your side on board: Up
str_draw_area u
if ($str_g(tip) == on) { str_tip }
.timer.str_ping_opponent -o 0 180 str_ping
}
if ($2 == ping) { str_w pingreply $3 }
if ($2 == pingreply) {
var %l = $round($calc(($ticks - $3) / 1000),3)
str_info $1 $+ ' s lag: %l $iif(%l isnum 0-1,sec,secs)
str_w lag %l
}
if ($2 == lag) { str_info Your lag: $3 $iif($3 isnum 0-1,sec,secs) }
if ($2 == chat) { str_info -c $1 $3- }
if ($2 == start) {
if ($str_g(tmp.done) == 1) {
window -c @str_formation
str_d tmp.done
str_d tmp.area
str_d tmp.abort
str_w ready
str_grid
str_a tmp.game 2
str_info Opponent is ready. The battle has began!
str_stats
str_color
str_a tmp.time $ctime
.timer.str_timer -o 0 1 str_time
str_sound start
if ($str_g(tmp.color) == red) { str_a tmp.isturn 1 | str_turn -i - | str_info You start the game. | if ($str_legal != 1) { str_w nolegal $str_g(tmp.field) } }
else { str_a tmp.isturn 0 | str_turn -i - | str_info Opponent starts the game. }
str_away
}
else { str_w notready | str_info Opponent has finished setting up his army and is now waiting for you... }
}
if ($2 == notready) { str_info Opponent is not ready yet. Waiting for oppontent... }
if ($2 == ready) {
window -c @str_formation
str_d tmp.done
str_d tmp.area
str_grid
str_a tmp.game 2
str_info Opponent is ready. The battle has began!
str_stats
str_color
str_a tmp.time $ctime
.timer.str_timer -o 0 1 str_time
str_sound start
if ($str_g(tmp.color) == red) { str_a tmp.isturn 1 | str_turn -i - | str_info You start the game. | if ($str_legal != 1) { str_w nolegal $str_g(tmp.field) } }
else { str_a tmp.isturn 0 | str_turn -i - | str_info Opponent starts the game. }
str_away
}
if ($2 == move) {
str_place $5 $6 T
str_place $3 $4 e
str_sound move
str_a tmp.isturn 1
str_turn $iif($str_g(tmp.color) == red,-i,-) $7 $8
if ($str_legal != 1) { str_w nolegal $str_g(tmp.field) }
}
if ($2 == attack) {
var %z = $str_attack($3,$4)
if ($str_g(tmp.rule.battle) != on) { str_attackresult $3 $gettok(%z,2,32) $9 $4 }
str_w attackresult %z $3 $5 $6 $7 $8 $9 $4
str_place $7 $8 T
if ($gettok(%z,1,32) == 1) { str_place $5 $6 e | str_sound die }
elseif ($gettok(%z,1,32) == 2) { hinc stratego tmp.capture. $+ $3 | if ($gettok(%z,2,32) == b) { str_sound bomb } | else { str_sound kill } }
elseif ($gettok(%z,1,32) == 3) { str_place $5 $6 T | hinc stratego tmp.capture. $+ $3 | if ($gettok(%z,2,32) == b) { str_sound bomb } | else { str_sound die } }
elseif ($gettok(%z,1,32) == gameover) { str_place $5 $6 e | var %z = $str_g(tmp.field) | str_a my_field %z $str_g(tmp.color) | str_w replace %z | str_gameover lost | halt }
str_stats
str_a tmp.isturn 1
str_turn $iif($str_g(tmp.color) == red,-i,-) $9 $4
if ($str_legal != 1) { str_w nolegal $str_g(tmp.field) }
}
if ($2 == nolegal) {
str_a my_field $str_g(tmp.field) $str_g(tmp.color)
str_replace $3
if ($str_legal != 1) { str_w draw $str_g(tmp.field) | str_gameover draw }
else { str_w legalost $str_g(tmp.field) | str_gameover legal }
}
if ($2 == legalost) { str_gameover nolegal }
if ($2 == draw) { str_gameover draw }
if ($2 == attackresult) {
if ($str_g(tmp.rule.battle) != on) { str_attackresult $4 $5 $10 $11 }
str_place $8 $9 T
if ($3 == 1) { str_place $6 $7 $5 | hinc stratego tmp.capture. $+ $4 | str_sound kill }
elseif ($3 == 2) { if ($4 == b) { str_sound bomb } | else { str_sound die } }
elseif ($3 == 3) { str_place $6 $7 T | hinc stratego tmp.capture. $+ $4 | if ($4 == b) { str_sound bomb } | else { str_sound die } }
elseif ($3 == gameover) { str_place $6 $7 $5 | if (%c == blue) { hdec stratego tmp.turn } | str_gameover won | halt }
str_stats
}
if ($2 == quit) { str_gameover left | halt }
if ($2 == replace) { str_replace $3 }
if ($2 == abort) { str_info Opponent has chosen to abort the game... | str_end | halt }
if ($2 == offerdraw) { .timer.str_draw 1 0 str_offerdraw }
if ($2 == offerdrawno) { if ($str_g(tmp.game) == 2) { str_info Your opponent has declined your request. Game continues... } }
if ($2 == offerdrawyes) { if ($str_g(tmp.game) == 2) { str_info Your opponent agreed to end this game a draw. | str_gameover draw } }
if ($2 == restart) { .timer.str_draw 1 0 str_restart }
if ($2 == restartyes) { str_info Your opponent has accepted your request. Starting new game... | str_choose_col }
if ($2 == restartno) { str_info Your opponent has declined your request. }
goto read
}
else { str_end }
}
alias -l str_reveal { var %z = $str_g(tmp.field), %c = $str_g(tmp.color) | str_a my_field %z %c | str_w replace %z }
alias -l str_offerdraw {
if ($str_g(tmp.game) == 2) {
if ($input(Your opponent requested that this game ends in a draw. Is this acceptable?,yis,@Stratego,Confirmation)) { str_info Your opponent' s request has been accepted. Game ends in a draw. | str_w offerdrawyes | str_reveal | str_gameover draw }
else { str_w offerdrawno | str_info You declined your opponent' s request. }
}
}
alias -l str_restart {
if ($sock(stratego)) {
if ($input(Your opponent requested to start a new game. Is this acceptable?,yis,@Stratego,Confirmation)) { str_info Your opponent' s request has been accepted. Starting new game. Waiting for opponent to choose color and rules... | str_clear | str_w restartyes }
else { str_w restartno | str_info You declined your opponent' s request. }
}
}
alias -l str_history {
var %f = $_noc(str_history.txt)
if (!$isfile(%f)) { write -c %f }
if ($1 == -w) {
write %f > $date $+ , $time - Against: $2 Result: $3 after $4 $iif($4 == 1,turn,turns) and $5-
}
else {
var %w = @str_history, %l = $lines(%f)
if ($window(%w)) { window -c %w }
window -Cdhk0 +nxt %w -1 -1 600 250 Verdana 9
echo %w Stratego game history:
loadbuf %w %f
titlebar %w - %l $iif(%l == 1,battle,battles)
}
}
alias -l str_gameover {
if ($str_g(tmp.game) == 2) {
var %w = @str_gameover
if ($window(%w)) { window -c $v1 }
window -pdCohk0 +t %w -1 -1 300 175
str_reveal
if ($1 == lost) { var %z = You lost the battle..., %z2 = Your opponent' s army outranked yours! | str_sound lose }
if ($1 == won) { var %z = You won the battle!, %z2 = Victory is yours! | str_sound win }
if ($1 == nolegal) { var %z = You lost the battle..., %z2 = You have no legal moves left. | str_sound lose }
if ($1 == legal) { var %z = You won the battle!, %z2 = Opponent has no legal moves left. | str_sound win }
if ($1 == leave) { var %z = You lost the battle..., %z2 = Your army surrendered to opponent... | str_sound lose }
if ($1 == left) { var %z = You won the battle!, %z2 = Opponent' s army surrendered! | str_sound win }
if ($1 == draw) { var %z = It' s a draw..., %z2 = None of the armies survived the heat of battle... | str_sound lose }
var %q = $str_g(streak), %time = $duration($calc($ctime - $str_g(tmp.time)))
if ($istok(won legal left,$1,32)) { hinc stratego wins | str_a streak w $+ %q | var %wr = $str_g(tmp.nick) won }
elseif ($istok(lost nolegal leave,$1,32)) { hinc stratego losses | str_a streak l $+ %q | var %wr = $str_g(tmp.nick) lost }
elseif ($1 == draw) { hinc stratego draws | str_a streak d $+ %q | var %wr = $str_g(tmp.nick) draw }
str_history -w %wr $str_g(tmp.turn) %time
drawfill -nr %w $rgb(0,0,0) $rgb(0,0,0) 1 1
drawrect -nr %w $rgb(170,170,170) 1 10 10 271 127
if (!$str_g(tmp.turn)) || ($str_g(tmp.turn) <= 0) { str_a tmp.turn 1 }
if (!$str_g(tmp.time)) || ($str_g(tmp.time) <= 0) { str_a tmp.time $ctime }
drawtext -nrpb %w $rgb(170,170,170) $rgb(0,0,0) Verdana 9 20 3 Battle results:
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 20 25 %z
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 20 40 %z2
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 20 65 Turns taken: $str_g(tmp.turn)
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 20 80 Game duration: %time
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 20 105 Your current rank: $str_rank
drawdot %w
str_status
str_personal
str_opponent - - - -
str_stats 0
hdel -w stratego tmp.*
.timer.str_* off
str_away -b
}
}
alias -l str_turn {
if ($window(@Stratego)) {
if ($1 == -i) { hinc stratego tmp.turn }
var %p = $str_g(tmp.turn) ( $+ $iif($str_g(tmp.isturn) == 1,Your turn,Opponent' s turn) $+ ) $+ / $+ $str_lastmove($2,$3)
drawrect -nfr @Stratego $rgb(0,0,0) 1 608 90 173 15
drawtext -nrpb @Stratego $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(%p)) 90 %p
}
}
alias -l str_lastmove {
if ($1 == -) { return - }
var %i = 1
while (%i <= 2) {
var %r = $ [ $+ [ %i ] ]
if (%r == 100) { var %m [ $+ [ %i ] ] J9 | goto next }
if (%r isnum 1-9) { var %sb [ $+ [ %i ] ] 0 }
elseif ($left(%r,1) == 1) { var %sb [ $+ [ %i ] ] 1 }
elseif ($left(%r,1) == 2) { var %sb [ $+ [ %i ] ] 2 }
elseif ($left(%r,1) == 3) { var %sb [ $+ [ %i ] ] 3 }
elseif ($left(%r,1) == 4) { var %sb [ $+ [ %i ] ] 4 }
elseif ($left(%r,1) == 5) { var %sb [ $+ [ %i ] ] 5 }
elseif ($left(%r,1) == 6) { var %sb [ $+ [ %i ] ] 6 }
elseif ($left(%r,1) == 7) { var %sb [ $+ [ %i ] ] 7 }
elseif ($left(%r,1) == 8) { var %sb [ $+ [ %i ] ] 8 }
elseif ($left(%r,1) == 9) { var %sb [ $+ [ %i ] ] 9 }
if ($right(%r,1) == 0) { var %sa [ $+ [ %i ] ] J | dec %sb [ $+ [ %i ] ] }
elseif ($right(%r,1) == 9) { var %sa [ $+ [ %i ] ] I }
elseif ($right(%r,1) == 8) { var %sa [ $+ [ %i ] ] H }
elseif ($right(%r,1) == 7) { var %sa [ $+ [ %i ] ] G }
elseif ($right(%r,1) == 6) { var %sa [ $+ [ %i ] ] F }
elseif ($right(%r,1) == 5) { var %sa [ $+ [ %i ] ] E }
elseif ($right(%r,1) == 4) { var %sa [ $+ [ %i ] ] D }
elseif ($right(%r,1) == 3) { var %sa [ $+ [ %i ] ] C }
elseif ($right(%r,1) == 2) { var %sa [ $+ [ %i ] ] B }
elseif ($right(%r,1) == 1) { var %sa [ $+ [ %i ] ] A }
var %m [ $+ [ %i ] ] %sa [ $+ [ %i ] ] $+ %sb [ $+ [ %i ] ]
:next
inc %i
}
return %m1 $+ -> $+ %m2
}
alias -l str_color {
if ($window(@Stratego)) {
var %p = $str_g(tmp.color)
drawrect -nfr $v1 $rgb(0,0,0) 1 602 75 178 15
drawtext -nrpb $v1 $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(%p)) 75 %p
}
}
menu @str_attack {
sclick: if ($str_g(sclick) == on) { window -c @str_attack }
}
alias -l str_attackresult {
var %w = @str_attack
if ($window(%w)) { window -c $v1 }
window -pdCohk0 +t %w -1 -1 200 178
clear %w
drawfill -nr %w $rgb(0,0,0) $rgb(0,0,0) 1 1
drawrect -nr %w $rgb(170,170,170) 1 10 10 171 130
drawline -nr %w $rgb(170,170,170) 1 10 110 181 110
drawtext -nrpb %w $rgb(170,170,170) $rgb(0,0,0) Verdana 9 20 3 Battle:
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 30 20 You
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 113 20 Opponent
drawtext -nrpb %w $rgb(170,170,170) $rgb(0,0,0) Verdana 25 76 43 VS
var %i = 2, %x1 = 30, %l = $str_lastmove($3,$4)
while (%i > 0) {
var %u = $ [ $+ [ %i ] ]
if (%u == s) { var %x = 0, %t = Spy }
if (%u == 9) { var %x = 29, %t = Scout }
if (%u == 8) { var %x = 58, %t = Miner }
if (%u == 7) { var %x = 87, %t = Sergeant }
if (%u == 6) { var %x = 116, %t = Lieutenant }
if (%u == 5) { var %x = 145, %t = Captain }
if (%u == 4) { var %x = 174, %t = Major }
if (%u == 3) { var %x = 203, %t = Colonel }
if (%u == 2) { var %x = 232, %t = General }
if (%u == 1) { var %x = 261, %t = Marshal }
if (%u == b) { var %x = 290, %t = Bomb }
if (%u == f) { var %x = 319, %t = Flag }
drawpic %w %x1 40 %x 0 29 39 $_noc(army.png)
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $iif(%x1 == 30,%x1,$calc(103 + $str_align2(%t))) 85 %t
inc %x1 103
dec %i
}
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 57 118 Move: %l
drawdot %w
if ($str_wintime != 0) { .timer.str_result -o 1 $v1 window -c %w }
}
alias -l str_align2 {
var %z = $width($1-,Verdana,9,0,0)
return $calc(60 - %z)
}
alias -l str_attack {
var %w = @Stratego
if ($window(%w)) {
var %u = $gettok($str_g(tmp.field),$2,45)
if (%u == b) && ($1 == 8) { return 1 %u }
elseif (%u == b) { return $iif($str_g(tmp.rule.bomb) == on,3,2) %u }
elseif ($1 == %u) { return $iif($str_g(tmp.rule.aggressor) == on,1,3) %u }
elseif (%u == f) { return gameover %u }
elseif ($1 == 1) && ($str_g(tmp.rule.spy) == on) && (%u == s) { return 2 %u }
elseif ($1 == s) && (%u == 1) { return 1 %u }
elseif ($1 == s) { return 2 %u }
elseif ($1 == 9) && (%u == s) { return 1 %u }
elseif ($1 == 9) { return 2 %u }
else { return $iif($1 > %u,2,1) %u }
}
}
alias -l str_draw_area {
var %w = @Stratego
if ($window(%w)) {
if ($1 == u) { drawrect -r %w $rgb(255,0,0) 1 10 10 301 161 }
if ($1 == d) { drawrect -r %w $rgb(255,0,0) 1 10 250 301 161 }
if ($1 == c) { str_grid }
}
}
on *:close:@Stratego: {
if ($str_g(tmp.game) == 2) && ($sock(stratego)) { str_gameover leave | str_w quit }
str_end
}
menu @str_host {
sclick: {
if ($inrect($mouse.x,$mouse.y,60,25,29,39)) {
str_a tmp.color Red
goto ok
}
elseif ($inrect($mouse.x,$mouse.y,150,25,29,39)) {
str_a tmp.color Blue
goto ok
}
halt
:ok
window -c @str_host
if ($sock(Stratego)) {
str_clear
str_a tmp.rule.scout $iif($str_g(rule.scout),$str_g(rule.scout),off)
str_a tmp.rule.bomb $iif($str_g(rule.bomb),$str_g(rule.bomb),off)
str_a tmp.rule.spy $iif($str_g(rule.spy),$str_g(rule.spy),off)
str_a tmp.rule.battle $iif($str_g(rule.battle),$str_g(rule.battle),off)
str_a tmp.rule.aggressor $iif($str_g(rule.aggressor),$str_g(rule.aggressor),off)
str_w version $str_ver $str_g(tmp.rule.scout) $str_g(tmp.rule.bomb) $str_g(tmp.rule.spy) $str_g(tmp.rule.battle) $str_g(tmp.rule.aggressor)
}
else {
str_info Hosting new game. Waiting $iif($str_hosttime != 0,$v1 $iif($v1 == 1,minute,minutes)) for opponent to join...
str_server
}
}
}
alias -l str_timeout { if ($sock(stratego_wait).status == listening) { str_end | str_info Error: Connection timed out. No opponent joined your game. } }
alias -l str_begin {
var %w = @Stratego
if ($window(%w)) {
if ($2 == b) { var %r = $rgb(0,0,130) }
elseif ($2 == r) { var %r = $rgb(130,0,0) }
if ($1 == u) { var %x = 11 }
elseif ($1 == d) { var %x = 251 }
var %z = 4
while (%z > 0) {
var %y = 11
while (%y <= 300) {
str_enemy $2 %y %x
inc %y 30
}
inc %x 40
dec %z
}
drawdot %w
}
}
alias -l str_server {
sockclose stratego*
socklisten stratego_wait 3339
str_servers nl
if ($str_hosttime != 0) { .timer.str_timeout -o 1 $calc($str_hosttime * 60) str_timeout }
}
alias -l str_client { sockopen stratego $$1 3339 | str_info Attempting connection to $$1 $+ ... }
on *:socklisten:stratego_wait: {
.timer.str_timeout off
sockaccept stratego
sockclose stratego_wait
str_info Connection with $sock(stratego).ip established!
str_info Performing version compatibility check...
str_info Your version: $str_ver
str_a tmp.rule.scout $iif($str_g(rule.scout),$str_g(rule.scout),off)
str_a tmp.rule.bomb $iif($str_g(rule.bomb),$str_g(rule.bomb),off)
str_a tmp.rule.spy $iif($str_g(rule.spy),$str_g(rule.spy),off)
str_a tmp.rule.battle $iif($str_g(rule.battle),$str_g(rule.battle),off)
str_a tmp.rule.aggressor $iif($str_g(rule.aggressor),$str_g(rule.aggressor),off)
str_w version $str_ver $str_g(tmp.rule.scout) $str_g(tmp.rule.bomb) $str_g(tmp.rule.spy) $str_g(tmp.rule.battle) $str_g(tmp.rule.aggressor)
}
on *:sockopen:stratego: {
if ($sockerr) { str_info Error: Connection failed. Game is canceled. | str_end | return }
str_info Connection with $sock(stratego).ip established!
}
on *:sockclose:stratego: { if ($str_g(tmp.game) == 2) { str_gameover draw } | str_end }
on *:input:@Stratego: {
if (/* !iswm $1-) {
if ($sock(stratego).status == active) {
if ($str_g(tmp.abort) == 1) && ($1 == !abort) { str_w abort | str_info Game has been aborted. | str_end }
else {
var %z = $left($1-,448)
str_info -c $me %z | str_w chat %z
}
}
else { str_info Cannot send message. No connection is established. }
}
}
alias -l str_cls {
var %w = @Stratego
if ($window(%w)) {
drawrect -nrf %w $rgb(0,0,0) 1 338 268 433 151
if ($1 == -f) {
.timer.draw_str* off
hdel -w stratego chat_*
hdel -w stratego bar_chat_*
str_bar
str_info Session cleared...
}
}
}
alias -l str_info {
var %w = @Stratego
if ($window(%w)) {
if ($$1 == -c) { var %t = ( $+ $time(HH:nn:ss) $+ ) $+(,$$2,:,) $strip($$3-) }
else { var %t = ( $+ $time(HH:nn:ss) $+ ) * $$1- }
var %p = $wrap(%t,Verdana,9,430,0), %i = 1, %y = 405
str_cls
while (%i <= %p) {
var %m = $wrap(%t,Verdana,9,430,%i)
var %z = $hfind(stratego,chat_*,0,w)
inc %z
str_a chat_ $+ %z %m
inc %i
}
var %z = $hfind(stratego,chat_*,0,w)
str_bar
}
}
alias -l str_chatbox {
var %w = @Stratego
if ($window(%w)) {
str_cls
var %z = $hfind(stratego,chat_*,0,w), %y = 405
var %p = $calc(($1 - $2) / (129 - $2)), %z1 = $round($calc(%z * %p),0), %z2 = $calc(%z1 - 9)
if (%z1 <= 0) { var %z1 = 1 }
if (%z2 <= 0) { var %z2 = 1 }
while (%z1 >= %z2) {
var %g = $str_g(chat_ $+ %z1)
if (%g != $null) { drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 340 %y %g }
dec %y 15
dec %z1
}
drawdot %w
}
}
alias -l str_bar {
var %w = @Stratego
if ($window(%w)) {
drawrect -nrf %w $rgb(0,0,0) 1 772 278 14 129
var %z = $hfind(stratego,chat_*,0,w)
var %t = $round($calc(129 * (10 / (%z + 10))),0)
if (%t < 10) { var %t = 10 }
var %s = $calc(407 - %t)
if (%t <= 0) { var %s = 393, %t = 14 }
if ($1 == -d) {
if ($inrect(773,$2,772,278,14,129)) && ($inrect(773,$calc($2 + %t),772,278,14,129)) { var %s = $2 }
if ($2 < 278) { var %s = 278 }
}
drawrect -nrf %w $rgb(170,170,170) 1 772 %s 14 %t
drawrect -nr %w $rgb(0,0,0) 1 772 %s 14 %t
var %b = $calc((%s + %t) - 278)
str_a bar_chat_z %s
str_chatbox %b %t
}
}
alias -l str_button {
var %z = $hfind(stratego,chat_*,0,w), %t = $round($calc(129 / (%z + 10)),0)
if (%t < 1) { var %t = 1 }
var %z = $calc($str_g(bar_chat_z) $iif($1 == u,-,+) %t)
str_bar -d %z
}
menu @Stratego {
dclick: {
if ($inrect($mouse.x,$mouse.y,336,262,436,161)) { str_cls -f | drawdot @Stratego }
}
sclick: {
if ($inrect($mouse.x,$mouse.y,772,278,14,129)) { .timer.draw_str_bar -om 0 1 str_bar -d $!mouse.y }
if ($inrect($mouse.x,$mouse.y,772,262,14,15)) { str_button u | .timer.draw_str_bar2 -om 0 1 str_button u }
if ($inrect($mouse.x,$mouse.y,772,408,14,15)) { str_button d | .timer.draw_str_bar2 -om 0 1 str_button d }
if ($sock(stratego)) && ($str_g(tmp.game) == 2) && ($str_g(tmp.isturn) == 1) && ($inrect($mouse.x,$mouse.y,11,11,299,399)) && (!$inrect($mouse.x,$mouse.y,71,171,59,79)) && (!$inrect($mouse.x,$mouse.y,191,171,59,79)) {
var %s = $str_place($mouse.x,$mouse.y), %c = $gettok($str_g(tmp.field),%s,45), %o = $gettok($str_g(tmp.select),1,32)
if ($istok(s 9 8 7 6 5 4 3 2 1,%c,32)) {
if (%s != %o) {
if (%o) { str_place $gettok($str_g(tmp.select),2,32) $gettok($str_g(tmp.select),3,32) $gettok($str_g(tmp.field),%o,45) }
str_place $mouse.x $mouse.y sel
}
str_a tmp.select %s $mouse.x $mouse.y
if (%c != 9) {
if ($right(%s,1) != 1) && ($istok(t e,$gettok($str_g(tmp.field),$calc(%s - 1),45),32)) { var %q = %q $calc(%s - 1) }
if ($right(%s,1) != 0) && ($istok(t e,$gettok($str_g(tmp.field),$calc(%s + 1),45),32)) { var %q = %q $calc(%s + 1) }
if (%s !isnum 1-10) && ($istok(t e,$gettok($str_g(tmp.field),$calc(%s - 10),45),32)) { var %q = %q $calc(%s - 10) }
if (%s !isnum 99-100) && ($istok(t e,$gettok($str_g(tmp.field),$calc(%s + 10),45),32)) { var %q = %q $calc(%s + 10) }
str_a tmp.legal %q
}
else {
var %b = %s
while ($right(%b,1) != 1) {
dec %b
var %m = $gettok($str_g(tmp.field),%b,45)
if (%m == t) || (%m == e) {
if ($str_g(tmp.rule.scout) == on) && (%m == e) && ($numtok(%z,32) > 1) { break }
var %z = %z %b
if (%m == e) { break }
}
else { break }
}
var %b = %s
while ($right(%b,1) != 0) {
inc %b
var %m = $gettok($str_g(tmp.field),%b,45)
if (%m == t) || (%m == e) {
if ($str_g(tmp.rule.scout) == on) && (%m == e) && ($numtok(%z,32) > 1) { break }
var %z = %z %b
if (%m == e) { break }
}
else { break }
}
var %b = %s
while (%b !isnum 1-10) {
dec %b 10
var %m = $gettok($str_g(tmp.field),%b,45)
if (%m == t) || (%m == e) {
if ($str_g(tmp.rule.scout) == on) && (%m == e) && ($numtok(%z,32) > 1) { break }
var %z = %z %b
if (%m == e) { break }
}
else { break }
}
var %b = %s
while (%b !isnum 91-100) {
inc %b 10
var %m = $gettok($str_g(tmp.field),%b,45)
if (%m == t) || (%m == e) {
if ($str_g(tmp.rule.scout) == on) && (%m == e) && ($numtok(%z,32) > 1) { break }
var %z = %z %b
if (%m == e) { break }
}
else { break }
}
str_a tmp.legal %z
}
}
elseif ((%c == T) || (%c == e)) && ($str_g(tmp.select)) {
var %p = $gettok($str_g(tmp.field),$gettok($str_g(tmp.select),1,32),45), %s2 = $str_place($gettok($str_g(tmp.select),2,32),$gettok($str_g(tmp.select),3,32)),%q = $+(%s2,-,%s)
if ($str_shift(%q,$+(%s,-,%s2)) == 1) {
if ($str_check(s).all2 == 1) && ($numtok($str_g(tmp.legal),32) == 1) { str_w nolegal | halt }
var %z = $input(A unit cannot shift more than 5 times between the same two squares. Please make another move.,ows,@Stratego,Warning)
halt
}
if ($istok($str_g(tmp.legal),$str_place($mouse.x,$mouse.y),32)) {
if (%c == T) {
str_place $gettok($str_g(tmp.select),2,32) $gettok($str_g(tmp.select),3,32) T
str_place $mouse.x $mouse.y %p
str_w move $mouse.x $mouse.y $gettok($str_g(tmp.select),2,32) $gettok($str_g(tmp.select),3,32) %s2 %s
str_sound move
}
else { str_w attack %p %s $mouse.x $mouse.y $gettok($str_g(tmp.select),2,32) $gettok($str_g(tmp.select),3,32) %s2 }
if ($numtok($str_g(tmp.shift),32) > 1) && (($+(%s,-,%s2) !isin $str_g(tmp.shift)) || (%q !isin $str_g(tmp.shift))) {
var %m = $gettok($str_g(tmp.shift),$numtok($str_g(tmp.shift),32),32)
str_a tmp.shift %m %q
}
else {
var %z = $iif($numtok($str_g(tmp.shift),32) > 3,$gettok($str_g(tmp.shift),-4-,32),$str_g(tmp.shift)) %q
str_a tmp.shift %z
}
str_d tmp.select
str_d tmp.legal
str_a tmp.isturn 0
str_turn $iif($str_g(tmp.color) == blue,-i,-) %s2 %s
}
}
}
}
uclick: {
.timer.draw_str* off
if ($inrect($mouse.x,$mouse.y,772,278,14,129)) { str_bar -d $mouse.y }
}
$str_xy($mouse.x,$mouse.y)
Game
.Host a new game: str_new h
.Join another game (Direct IP connect): str_new j
.-
.List game servers: str_servers
.$iif($sock(stratego),-)
.$iif($sock(stratego) && $str_g(tmp.game) == 2,Offer a draw) : if ($input(Are you sure you want to end this game a draw?,yis,@Stratego,Confirmation)) { str_info Waiting for opponent to respond to your request... | str_w offerdraw }
.$iif($sock(stratego) && $str_g(tmp.game) == 2,Surrender) : str_cancel
.-
.$iif($sock(stratego) && !$istok(1 2,$str_g(tmp.game),32),Restart game) : if ($input(Restart game?,yis,@Stratego,Confirmation)) { str_info Waiting for opponent to respond to your request... | str_w restart }
.-
.$iif($sock(stratego) && $str_g(tmp.game) != 2,Disconnect) : if ($input(Are you sure you want to disconnect?,yws,@Stratego,Warning)) { str_end }
-
$iif($sock(stratego) && $str_g(tmp.game) == 1,$iif($str_area($mouse.x,$mouse.y) != 1 || $str_check(s).all == 40,$style(2)) Place unit)
.$iif($str_check(s) != 1,$style(2)) Spy (Placed $str_check(s).total $+ /1) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) s | str_ready
.$iif($str_check(9) != 1,$style(2)) Scout (Placed $str_check(9).total $+ /8) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 9 | str_ready
.$iif($str_check(8) != 1,$style(2)) Miner (Placed $str_check(8).total $+ /5) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 8 | str_ready
.$iif($str_check(7) != 1,$style(2)) Sergeant (Placed $str_check(7).total $+ /4) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 7 | str_ready
.$iif($str_check(6) != 1,$style(2)) Lieutenant (Placed $str_check(6).total $+ /4) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 6 | str_ready
.$iif($str_check(5) != 1,$style(2)) Captain (Placed $str_check(5).total $+ /4) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 5 | str_ready
.$iif($str_check(4) != 1,$style(2)) Major (Placed $str_check(4).total $+ /3) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 4 | str_ready
.$iif($str_check(3) != 1,$style(2)) Colonel (Placed $str_check(3).total $+ /2) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 3 | str_ready
.$iif($str_check(2) != 1,$style(2)) General (Placed $str_check(2).total $+ /1) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 2 | str_ready
.$iif($str_check(1) != 1,$style(2)) Marshal (Placed $str_check(1).total $+ /1) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) 1 | str_ready
.-
.$iif($str_check(b) != 1,$style(2)) Bomb (Placed $str_check(b).total $+ /6) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) b | str_ready
.$iif($str_check(f) != 1,$style(2)) Flag (Placed $str_check(f).total $+ /1) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) f | str_ready
$iif($sock(stratego) && $str_g(tmp.game) == 1,$iif($str_area($str_g(tmp.mouse.x),$str_g(tmp.mouse.y)) != 1 || !$istok(s 9 8 7 6 5 4 3 2 1 b f,$gettok($str_g(tmp.field),$str_place($str_g(tmp.mouse.x),$str_g(tmp.mouse.y)),45),32),$style(2)) Remove unit) : str_place $str_g(tmp.mouse.x) $str_g(tmp.mouse.y) T
-
$iif($sock(stratego) && $str_g(tmp.game) == 1,$iif($str_check(s).all != 40,$style(2)) Save formation) : str_formation -s
$iif($sock(stratego) && $str_g(tmp.game) == 1,Load formation) : str_formation -l
-
$iif($sock(stratego) && $str_g(tmp.game) == 1,$iif($str_check(s).all != 40,$style(2)) Begin game) : str_ready
-
Options
.$iif($str_g(sounds) == on,$style(1)) Game sounds: str_a sounds $iif($str_g(sounds) == on,off,on) | str_info Sounds are now $iif($str_g(sounds) == on,enabled.,disabled.)
.$iif($str_g(away) == on,$style(1)) Auto-away when game starts: str_a away $iif($str_g(away) == on,off,on) | str_info Auto-away is now $iif($str_g(away) == on,enabled.,disabled.)
.$iif($str_g(tip) == on,$style(1)) Show instructions when connected: str_a tip $iif($str_g(tip) == on,off,on) | str_info Instruction info is now $iif($str_g(tip) == on,enabled.,disabled.)
.$iif($str_g(ask) == on,$style(1)) Ask for rule variation setup on game host: str_a ask $iif($str_g(ask) == on,off,on) | str_info Rule setup on game host is now $iif($str_g(ask) == on,enabled.,disabled.)
.$iif($str_g(desktop) == on,$style(1)) Open game window on desktop next time: str_a desktop $iif($str_g(desktop) == on,off,on) | str_info This window will open $iif($str_g(desktop) == on,on desktop,inside mIRC) next time you launch the game.
.$iif($str_g(sclick) == on,$style(1)) Single-click closes the attack window: str_a sclick $iif($str_g(sclick) == on,off,on) | str_info Single-click to close the attack window is now $iif($str_g(sclick) == on,enabled.,disabled.)
.Time to wait for opponent to join when hosting a game ( $+ $iif($str_hosttime == 0,Infinite,$v1 $iif($v1 == 1,minute,minutes)) $+ ) : str_a hosttime $$?="Enter number of minutes to wait before connection times out (enter 0 for infinite time):" | str_info Time to wait for opponent when hosting a game: $iif($str_hosttime == 0,Infinite,$v1 $iif($v1 == 1,minute,minutes))
.Time to wait before attack window closes automatically ( $+ $iif($str_wintime == 0,Manual close,$v1 $iif($v1 == 1,second,seconds)) $+ ) : str_a wintime $$?="Enter number of seconds to wait before attack window closes (enter 0 to close it manually):" | str_info Attack window will now close $iif($str_wintime == 0,manually.,after $v1 $iif($v1 == 1,second.,seconds.))
.-
.Rule variations: str_rules
-
View game history: str_history
-
$iif($sock(stratego) && $str_g(tmp.game) == 1,View setup instructions) : str_tip
Help: str_help
-
Exit Stratego: { if ($sock(stratego)) && ($str_g(tmp.game) == 2) { str_cancel | halt } | if ($input(Do you want to exit the game?,yws,@Stratego,Warning)) { str_end | window -c @Stratego } }
}
alias -l str_wintime {
if ($str_g(wintime) !isnum) || ($str_g(wintime) < 0) { str_a wintime 7 }
return $str_g(wintime)
}
alias -l str_hosttime {
if ($str_g(hosttime) !isnum) || ($str_g(hosttime) < 0) { str_a hosttime 2 }
return $str_g(hosttime)
}
alias -l str_ready {
if ($str_check(s).all == 40) {
if ($input(You have placed all your units into the battlefield. Do you want to start the game? $+ $crlf $+ $crlf $+ * Note: If you wish to save your current formation select "No" and choose "Save formation" after right-clicking anywhere inside the game' s window. Once you have selected to begin the game you cannot load or save any formations.,yis,@Stratego,Info)) {
str_a tmp.done 1
str_d tmp.formation
str_d tmp.game
str_info Sending game-start request to opponent...
str_w start
}
else { str_info You can start the battle anytime by right-clicking anywhere and selecting "Begin game". }
}
}
alias -l str_shift {
if ($str_g(tmp.shift)) {
var %z = $numtok($str_g(tmp.shift),32)
if (%z > 4) {
var %t1 = $gettok($gettok($str_g(tmp.shift),%z,32),1,45), %t2 = $gettok($gettok($str_g(tmp.shift),%z,32),2,45)
var %q = $remove($str_g(tmp.shift),$iif(%t2 > %t1,%t2,%t1))
var %q = $remove(%q,-,$iif(%t2 > %t1,%t1,%t2),$chr(32))
if ($1 !isin $str_g(tmp.shift)) || ($2 !isin $str_g(tmp.shift)) || (%q != $null) { return 0 }
else { return 1 }
}
}
}
alias -l str_stats {
var %w = @Stratego
if ($window(%w)) {
var %z = $str_g(tmp.field)
var %d = drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 428
%d 75 $iif($1 == 0,0/0,$+($findtok(%z,s,0,45),/,$str_g(tmp.capture.s))) out of 1
%d 90 $iif($1 == 0,0/0,$+($findtok(%z,9,0,45),/,$str_g(tmp.capture.9))) out of 8
%d 105 $iif($1 == 0,0/0,$+($findtok(%z,8,0,45),/,$str_g(tmp.capture.8))) out of 5
%d 120 $iif($1 == 0,0/0,$+($findtok(%z,7,0,45),/,$str_g(tmp.capture.7))) out of 4
%d 135 $iif($1 == 0,0/0,$+($findtok(%z,6,0,45),/,$str_g(tmp.capture.6))) out of 4
%d 150 $iif($1 == 0,0/0,$+($findtok(%z,5,0,45),/,$str_g(tmp.capture.5))) out of 4
%d 165 $iif($1 == 0,0/0,$+($findtok(%z,4,0,45),/,$str_g(tmp.capture.4))) out of 3
%d 180 $iif($1 == 0,0/0,$+($findtok(%z,3,0,45),/,$str_g(tmp.capture.3))) out of 2
%d 195 $iif($1 == 0,0/0,$+($findtok(%z,2,0,45),/,$str_g(tmp.capture.2))) out of 1
%d 210 $iif($1 == 0,0/0,$+($findtok(%z,1,0,45),/,$str_g(tmp.capture.1))) out of 1
%d 225 $iif($1 == 0,0/0,$+($findtok(%z,b,0,45),/,$str_g(tmp.capture.b))) out of 6
drawdot %w
}
}
alias -l str_check {
var %z = $str_g(tmp.field), %u = $findtok(%z,$1,0,45)
if ($prop == total) { return %u }
elseif ($prop == all) {
var %a = $calc($findtok(%z,s,0,45) + $findtok(%z,9,0,45) + $findtok(%z,8,0,45) + $findtok(%z,7,0,45) + $findtok(%z,6,0,45) + $findtok(%z,5,0,45) + $findtok(%z,4,0,45) + $findtok(%z,3,0,45) + $findtok(%z,2,0,45) + $findtok(%z,1,0,45) + $findtok(%z,b,0,45) + $findtok(%z,f,0,45))
return %a
}
elseif ($prop == all2) {
var %a = $calc($findtok(%z,s,0,45) + $findtok(%z,9,0,45) + $findtok(%z,8,0,45) + $findtok(%z,7,0,45) + $findtok(%z,6,0,45) + $findtok(%z,5,0,45) + $findtok(%z,4,0,45) + $findtok(%z,3,0,45) + $findtok(%z,2,0,45) + $findtok(%z,1,0,45))
return %a
}
if ($1 == s) && (%u >= 1) { return 0 }
elseif ($1 == 9) && (%u >= 8) { return 0 }
elseif ($1 == 8) && (%u >= 5) { return 0 }
elseif ($1 == 7) && (%u >= 4) { return 0 }
elseif ($1 == 6) && (%u >= 4) { return 0 }
elseif ($1 == 5) && (%u >= 4) { return 0 }
elseif ($1 == 4) && (%u >= 3) { return 0 }
elseif ($1 == 3) && (%u >= 2) { return 0 }
elseif ($1 == 2) && (%u >= 1) { return 0 }
elseif ($1 == 1) && (%u >= 1) { return 0 }
elseif ($1 == b) && (%u >= 6) { return 0 }
elseif ($1 == f) && (%u >= 1) { return 0 }
return 1
}
alias -l str_xy {
str_a tmp.mouse.x $1
str_a tmp.mouse.y $2
}
alias -l str_tip {
var %w = @Stratego
if ($window(%w)) {
var %w2 = @str_help
if ($window(%w2)) { window -c $v1 }
window -pdCohk0 +t %w2 -1 -1 320 371
drawfill -nr %w2 $rgb(0,0,0) $rgb(0,0,0) 1 1
drawrect -nr %w2 $rgb(170,170,170) 1 10 10 291 323
var %d = drawtext -nrpb %w2 $rgb(255,255,255) $rgb(0,0,0) Verdana 9 20
drawtext -nrpb %w2 $rgb(170,170,170) $rgb(0,0,0) Verdana 9 20 3 Quick instructions:
%d 25 To place a unit in the battlefield follow these steps:
%d 50 1. Right-click in a square into your army' s area. This
%d 65 is the area marked by the red box.
%d 85 2. Select "Place unit".
%d 105 3. Select the unit you wish to place in that square.
%d 120 Next to each unit' s name is a number. It indicates
%d 135 the units remaining to be placed.
%d 155 4. To remove a unit you' ve placed, right-click on its
%d 170 square and select "Remove unit".
%d 190 5. Continue this process until you fill all squares of
%d 205 your area.
%d 225 6. Instead of placing each unit manually you can
%d 240 select to load a previously saved formation. To do this
%d 255 right-click anywhere and select "Load formation".
%d 275 Note: If you don' t remember how strong a unit is, you
%d 290 can view the chart at the bottom of the game' s
%d 305 window. Spy is the weakest, Marshal the strongest.
drawdot %w2
}
}
alias -l str_area {
if ($str_g(tmp.area) == u) && ($inrect($1,$2,11,11,299,159)) { return 1 }
elseif ($str_g(tmp.area) == d) && ($inrect($1,$2,11,251,299,159)) { return 1 }
else { return 0 }
}
alias -l str_place {
var %i = $left($str_g(tmp.color),1)
var %y = 371, %s = 0
while (%y >= 11) {
var %x = 11
while (%x <= 300) {
inc %s
if ($inrect($1,$2,%x,%y,29,39)) && (!$inrect($1,$2,71,171,59,79)) && (!$inrect($1,$2,191,171,59,79)) {
if ($isid) { return %s }
if ($3 == sel) { str_sel %x %y }
elseif ($3 == e) {
str_enemy $iif($str_g(tmp.color) == blue,r,b) %x %y
var %z = $str_g(tmp.field)
str_a tmp.field $puttok(%z,$3,%s,45)
}
else {
str_draw %i $3 %x %y
var %z = $str_g(tmp.field)
str_a tmp.field $puttok(%z,$3,%s,45)
}
drawdot @Stratego
return
}
inc %x 30
}
dec %y 40
}
}
alias -l str_align {
var %z = $width($1-,Verdana,9,0,0)
return $calc(145 - %z)
}
alias -l str_time {
var %w = @Stratego
if ($window(%w)) && ($sock(stratego)) {
var %z = $duration($calc($ctime - $str_g(tmp.time)))
drawrect -nfr %w $rgb(0,0,0) 1 607 105 173 15
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 $calc(630 + $str_align(%z)) 105 %z
drawdot %w
}
else { str_end }
}
alias -l str_legal {
var %z = $str_g(tmp.field)
if ($gettok(%z,31,45) == b) && ($gettok(%z,32,45) == b) && ($gettok(%z,35,45) == b) && ($gettok(%z,36,45) == b) && ($gettok(%z,39,45) == b) && ($gettok(%z,40,45) == b) { return 0 }
if ($gettok(%z,61,45) == b) && ($gettok(%z,62,45) == b) && ($gettok(%z,65,45) == b) && ($gettok(%z,66,45) == b) && ($gettok(%z,69,45) == b) && ($gettok(%z,70,45) == b) { return 0 }
if ($str_check(s).all2 == 0) { return 0 }
var %i = 1
while (%i <= 100) {
var %u = $gettok(%z,%i,45)
if ($istok(s 9 8 7 6 5 4 3 2 1,%u,32)) {
if ($right(%i,1) != 1) && ($istok(t e,$gettok(%z,$calc(%i - 1),45),32)) { return 1 }
if ($right(%i,1) != 0) && ($istok(t e,$gettok(%z,$calc(%i + 1),45),32)) { return 1 }
if (%i !isnum 1-10) && ($istok(t e,$gettok(%z,$calc(%i - 10),45),32)) { return 1 }
if (%i !isnum 99-100) && ($istok(t e,$gettok(%z,$calc(%i + 10),45),32)) { return 1 }
}
inc %i
}
return 0
}
alias -l str_rules { var %z = str_rules | if ($dialog(%z)) { dialog -v %z } | else { dialog -mo %z %z } }
dialog -l str_rules {
title "Stratego - Rule variations"
size -1 -1 190 277
box "Game rules:", 1, 10 5 170 130
check "Scout only move", 2, 20 25 150 15
check "One time bombs", 3, 20 45 150 15
check "Assassin spy", 4, 20 65 150 15
check "Silent battle", 5, 20 85 150 15
check "Aggressor advantage", 6, 20 105 150 15
box "Rule effect:", 7, 10 140 170 90
text "", 8, 20 155 150 73, center
button "Cancel", 9, 120 241 60 25, cancel
button "Apply", 10, 10 241 60 25, ok
}
on *:dialog:str_rules:init:0: {
if ($str_g(rule.scout) == on) { did -c $dname 2 }
if ($str_g(rule.bomb) == on) { did -c $dname 3 }
if ($str_g(rule.spy) == on) { did -c $dname 4 }
if ($str_g(rule.battle) == on) { did -c $dname 5 }
if ($str_g(rule.aggressor) == on) { did -c $dname 6 }
did -a $dname 8 Move the cursor over a rule to view its effect on the game. To use the default rules uncheck all boxes and press "Apply".
did -f $dname 1
}
on *:dialog:str_rules:sclick:10: {
str_a rule.scout $iif($did(2).state == 1,on,off)
str_a rule.bomb $iif($did(3).state == 1,on,off)
str_a rule.spy $iif($did(4).state == 1,on,off)
str_a rule.battle $iif($did(5).state == 1,on,off)
str_a rule.aggressor $iif($did(6).state == 1,on,off)
}
on *:dialog:str_rules:mouse:*: {
if ($inrect($mouse.x,$mouse.y,20,25,150,15)) { .timer_str_dialog -o 1 0 str_dialog_put Scout only move rule:-If selected, the Scout cannot move more than one square and strike at the same time, he must stop before enemy unit. }
elseif ($inrect($mouse.x,$mouse.y,20,45,150,15)) { .timer_str_dialog -o 1 0 str_dialog_put One time bombs rule:-If selected, when a unit strikes a bomb, both will be removed (miners will survive), else, bombs stay until removed by miners. }
elseif ($inrect($mouse.x,$mouse.y,20,65,150,15)) { .timer_str_dialog -o 1 0 str_dialog_put Assassin spy rule:-If selected, Marshal will fall to the Spy no matter who attacks first, else, Spy wins only if he is the attacker. }
elseif ($inrect($mouse.x,$mouse.y,20,85,150,15)) { .timer_str_dialog -o 1 0 str_dialog_put Silent battle rule:-If selected, both players will not receive information of the units involved into an attack. }
elseif ($inrect($mouse.x,$mouse.y,20,105,150,15)) { .timer_str_dialog -o 1 0 str_dialog_put Aggressor advantage rule:-If selected, when two units of the same rank meet, the attacker will win, else, both units are removed. }
else { .timer_str_dialog -o 1 0 str_dialog_put Rule effect:-Move the cursor over a rule to view its effect on the game. To use the default rules uncheck all boxes and press "Apply". }
}
alias -l str_dialog_put {
if ($dialog(str_rules)) {
did -ra $v1 7 $gettok($1-,1,45)
did -ra $v1 8 $gettok($1-,2,45)
}
}
alias -l str_sound {
if (!$insong) && (!$inmidi) && (!$inwave) {
if ($str_g(sounds) == on) && ($isfile($_noc($1 $+ .wav))) { splay $_noc($1 $+ .wav) }
}
}
alias -l str_replace {
var %w = @Stratego
if ($window(%w)) {
var %z = $1, %z2 = $gettok($str_g(my_field),1,32), %y = 371, %s = 0, %c = $iif($gettok($str_g(my_field),2,32) == red,b,r)
while (%y >= 11) {
var %x = 11
while (%x <= 300) {
inc %s
var %u = $gettok(%z2,%s,45)
if (%u == e) { str_draw %c $gettok(%z,%s,45) %x %y }
inc %x 30
}
dec %y 40
}
drawdot %w
}
str_d my_field
}
alias -l str_formation {
if ($str_g(tmp.game) == 1) {
if ($1 == -s) {
var %z = $str_g(tmp.field)
if ($str_g(tmp.area) == d) { var %f = $gettok(%z,1-40,45) }
elseif ($str_g(tmp.area) == u) {
var %f = t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t, %i = 100, %p = 1
while (%p <= 40) {
var %u = $gettok(%z,%i,45), %f = $puttok(%f,%u,%p,45)
dec %i
inc %p
}
}
if ($str_g(tmp.area) != $null) {
var %z = $replace($$?="Enter a name for your formation:",$chr(32),$chr(135))
if (%z != $null) {
if ($str_g(formation. $+ %z)) { if (!$input(Formation already exists. Overwrite it?,wys,@str_formation,Warning)) { halt } }
str_a formation. $+ %z %f
str_info Formation successfully saved.
}
}
}
if ($1 == -l) {
var %w = @str_formation
if ($window(%w)) { window -c $v1 }
window -pSdoChk0l15 +t %w -1 -1 474 274 Verdana 9
drawfill -nr %w $rgb(0,0,0) $rgb(0,0,0) 1 1
drawrect -nr %w $rgb(170,170,170) 1 10 10 332 192
drawtext -nrpb %w $rgb(170,170,170) $rgb(0,0,0) Verdana 9 20 3 Formation preview:
drawrect -nfr %w $rgb(170,170,170) 1 10 213 60 23 282 213 60 23
drawrect -nr %w $rgb(0,0,0) 1 11 214 58 21 283 214 58 21
drawtext -nrpb %w $rgb(255,255,255) $rgb(170,170,170) Verdana 9 30 218 Flip
drawtext -nrpb %w $rgb(255,255,255) $rgb(170,170,170) Verdana 9 300 218 Load
drawtext -nrpb %w $rgb(255,255,255) $rgb(0,0,0) Verdana 9 81 218 Right-click on a formation for options.
drawdot %w
var %i = $hfind(stratego,formation.*,0,w)
titlebar %w - %i $iif(%i == 1,formation,formations) found
while (%i > 0) {
aline -l %w $replace($mid($hfind(stratego,formation.*,%i,w),11-),$chr(135),$chr(32))
dec %i
}
}
}
}
alias -l str_form {
if ($window(@str_formation)) {
str_a tmp.formation $1
var %d = drawtext -nrpb $v1 $rgb(255,255,255) $rgb(0,0,0) Verdana 9
%d 18 33 3
%d 18 73 2
%d 18 113 1
%d 18 153 0
%d 42 184 A
%d 72 184 B
%d 102 184 C
%d 132 184 D
%d 162 184 E
%d 192 184 F
%d 222 184 G
%d 252 184 H
%d 282 184 I
%d 312 184 J
var %y = 141, %s = 0
while (%y >= 11) {
var %x = 31
while (%x <= 310) {
inc %s
var %u = $gettok($1,%s,45)
str_draw g %u %x %y f
inc %x 30
}
dec %y 40
}
drawdot @str_formation
}
}
menu @str_formation {
sclick: {
if ($sline($active,1) != $null) && ($str_g(tmp.game) == 1) {
if ($inrect($mouse.x,$mouse.y,10,213,60,23)) {
drawrect -nfr $active $rgb(0,0,0) 1 10 213 60 23
drawrect -nfr $active $rgb(170,170,170) 1 11 214 58 21
drawrect -nr $active $rgb(0,0,0) 1 12 215 56 19
drawtext -nrpb $active $rgb(255,255,255) $rgb(170,170,170) Verdana 9 29 218 Flip
}
if ($inrect($mouse.x,$mouse.y,282,213,60,23)) {
drawrect -nfr $active $rgb(0,0,0) 1 282 213 60 23
drawrect -nfr $active $rgb(170,170,170) 1 283 214 58 21
drawrect -nr $active $rgb(0,0,0) 1 284 215 56 19
drawtext -nrpb $active $rgb(255,255,255) $rgb(170,170,170) Verdana 9 299 218 Load
}
drawdot $active
}
}
uclick: {
drawrect -nfr $active $rgb(170,170,170) 1 10 213 60 23 282 213 60 23
drawrect -nr $active $rgb(0,0,0) 1 11 214 58 21 283 214 58 21
drawtext -nrpb $active $rgb(255,255,255) $rgb(170,170,170) Verdana 9 30 218 Flip
drawtext -nrpb $active $rgb(255,255,255) $rgb(170,170,170) Verdana 9 300 218 Load
drawdot $active
if ($sline($active,1) != $null) && ($str_g(tmp.game) == 1) {
if ($inrect($mouse.x,$mouse.y,10,213,80,25)) {
drawrect -rf $active $rgb(0,0,0) 1 15 17 320 182
var %z1 = $str_g(tmp.formation), %m1 = 1, %m2 = 10, %t = 1
while (%t <= 4) {
var %i = 1, %z = $gettok(%z1,%m1 $+ - $+ %m2,45)
while (%i <= 5) {
var %u1 = $gettok(%z,%i,45), %u2 = $gettok(%z,$calc(11 - %i),45)
var %z = $puttok(%z,%u2,%i,45), %z = $puttok(%z,%u1,$calc(11 - %i),45)
inc %i
}
var %r = $+(%r,-,%z)
inc %m1 10
inc %m2 10
inc %t
}
str_form $mid(%r,2-)
}
if ($inrect($mouse.x,$mouse.y,282,213,80,25)) {
var %a = $str_g(tmp.area)
if (%a == d) { var %z = $+($str_g(tmp.formation),-,$gettok($str_g(tmp.field),41-100,45)) }
elseif (%a == u) {
var %z = t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t-t, %f = $str_g(tmp.formation), %i = 40, %p = 1
while (%i > 0) {
var %z = $puttok(%z,$gettok(%f,%p,45),%i,45)
inc %p
dec %i
}
var %z = $+($gettok($str_g(tmp.field),1-60,45),-,%z)
}
str_a tmp.field %z
str_load
}
}
}
lbclick: {
drawrect -rf $active $rgb(0,0,0) 1 15 17 320 182
var %z = $sline($active,1)
if (%z != $null) {
var %z = $str_g(formation. $+ $replace(%z,$chr(32),$chr(135)))
str_form %z
}
}
$iif($sline($active,1) == $null,$style(2)) Rename formation: {
var %z1 = formation. $+ $replace($sline($active,1),$chr(32),$chr(135)), %z2 = $str_g(%z1), %z = $replace($$?="Enter a new name for your formation:",$chr(32),$chr(135))
if (%z != $null) {
if ($str_g(formation. $+ %z)) { if (!$input(Formation already exists. Overwrite it?,wys,@str_formation,Warning)) { halt } }
str_d %z1
str_a formation. $+ %z %z2
var %i = $hfind(stratego,formation.*,0,w)
titlebar $active - %i $iif(%i == 1,formation,formations) found
dline -l $active 1-
while (%i > 0) {
aline -l %w $replace($mid($hfind(stratego,formation.*,%i,w),11-),$chr(135),$chr(32))
dec %i
}
drawrect -rf $active $rgb(0,0,0) 1 15 17 320 182
}
}
$iif($sline($active,1) == $null,$style(2)) Delete formation: {
var %z = formation. $+ $replace($sline($active,1),$chr(32),$chr(135)), %l = $sline($active,1).ln
if (!$input(Are you sure you want to delete this formation?,yws,@str_formation,Warning)) { halt }
str_d %z
str_d tmp.formation
dline -l $active %l
var %i = $hfind(stratego,formation.*,0,w)
titlebar $active - %i $iif(%i == 1,formation,formations) found
drawrect -rf $active $rgb(0,0,0) 1 15 17 320 182
}
-
$iif($hfind(stratego,formation.*,0,w) == 0,$style(2)) Delete all: {
if ($input(Are you sure you want to delete all your formations?,yws,@str_formation,Warning)) {
hdel -w stratego formation.*
str_d tmp.formation
titlebar $active - 0 formations found
drawrect -rf $active $rgb(0,0,0) 1 15 17 320 182
dline -l $active 1-
}
}
}
alias -l str_load {
var %w = @Stratego
if ($window(%w)) {
var %z = $str_g(tmp.field), %y = 371, %s = 0, %c = $left($str_g(tmp.color),1)
while (%y >= 11) {
var %x = 11
while (%x <= 300) {
inc %s
var %u = $gettok(%z,%s,45)
if (%u != T) && (%u != L) {
if (%u == e) { str_enemy $iif(%c == b,r,b) %x %y }
else { str_draw %c %u %x %y }
}
inc %x 30
}
dec %y 40
}
drawdot %w
str_info You can start the battle anytime by right-clicking anywhere and selecting "Begin game".
}
}
dialog -l str_help {
title "Stratego - Help"
size -1 -1 400 315
tab "How to play", 1, 10 10 380 261
tab "Menu - GUI", 23
tab "Tips", 4
tab "About...", 6
text "Written by:", 7, 60 85 180 15, tab 6
text "RagingDemon", 10, 190 85 140 15, right, tab 6
text "Alpha testing:", 11, 60 105 180 15, tab 6
text "Stepenwolf", 12, 190 105 140 15, right, tab 6
text "Beta testing:", 13, 60 125 180 15, tab 6
text "Bayern7", 14, 190 125 140 15, right, tab 6
text "Additional testing:", 15, 60 145 180 15, tab 6
text "psxlover, PaFmAn", 16, 190 145 140 15, right, tab 6
text "E-mail contact:", 17, 60 175 150 15, tab 6
link "ragingdemon@gmail.com", 18, 210 175 140 15, tab 6
text "Game version:", 19, 60 55 150 15, tab 6
text "", 20, 190 55 140 15, right, tab 6
text "© 2004", 21, 190 230 140 15, right, tab 6
edit "", 5, 20 40 360 217, read, autovs, multi, vsbar, tab 1
edit "", 8, 20 40 360 217, read, autovs, multi, vsbar, tab 4
edit "", 24, 20 40 360 217, read, autovs, multi, vsbar, tab 23
button "Close", 9, 330 279 60 25, cancel
box "", 22, 20 35 360 221, tab 6
}
on *:dialog:str_help:sclick:18: { run mailto:ragingdemon@gmail.com }
on *:dialog:str_help:init:0: {
var %d = did -a $dname
%d 20 $str_ver
%d 5 ABOUT THE GAME $crlf
%d 5 On a lonely battlefield you meet your opponent for a skirmish that will decide the fate of your armies. You must plan the battle, advance your men, attack and capture the enemy Flag. $crlf
%d 5 $crlf
%d 5 Your Marshal is your strongest man, but vulnerable if not protected from the Spy. Your Scouts are weak but mobile and effective in discovering your enemy' s manpower. You need the skills of Miners to disarm enemy Bombs, so don' t lose them all early in the battle. Plant your Bombs skillfully. They will protect the most precious piece on the gameboard, your Flag. $crlf
%d 5 $crlf
%d 5 Stratego is a game where skillful planning, clever deception and good memory work are used to defeat your opponent. Every time you play, the battle is different. $crlf
%d 5 $crlf
%d 5 The object of the game is to capture your opponent' s flag. $crlf
%d 5 $crlf
%d 5 Each army consists of: $crlf
%d 5 $crlf
%d 5 * 10 moveable pieces (from highest to lowest rank): $crlf
%d 5 $crlf
%d 5 - 1 Marshal $crlf
%d 5 - 1 General $crlf
%d 5 - 2 Colonels $crlf
%d 5 - 3 Majors $crlf
%d 5 - 4 Captains $crlf
%d 5 - 4 Lieutenants $crlf
%d 5 - 4 Sergeants $crlf
%d 5 - 5 Miners $crlf
%d 5 - 8 Scouts $crlf
%d 5 - 1 Spy $crlf
%d 5 $crlf
%d 5 * 2 non-movable pieces: $crlf
%d 5 $crlf
%d 5 - 6 Bombs $crlf
%d 5 - 1 Flag $crlf
%d 5 $crlf
%d 5 HOW TO SET UP YOUR ARMY $crlf
%d 5 1. Set up your units using any strategy hints you find useful trying to exploit the best attacking and defensive capabilities of your formation. For more tips check the 'Tips' session. $crlf
%d 5 2. Your opponent cannot see the rank of your pieces. $crlf
%d 5 3. Only one piece can occupy a square. Place them anywhere in the last four rows on your half of the battlefield. The two middle rows are left unoccupied at the start of the game. $crlf
%d 5 $crlf
%d 5 GAME PLAY $crlf
%d 5 You and your opponent alternate turns. The red player opens the game. On your turn you can do one of the following: $crlf
%d 5 $crlf
%d 5 * Move $crlf
%d 5 * Attack $crlf
%d 5 $crlf
%d 5 RULES FOR MOVEMENT $crlf
%d 5 1. Pieces move one square at a time, forward, backward or sideways. (Exception: see Special Scout Privilege, rule 7) $crlf
%d 5 2. To move a piece click on it and then click again on its destination square. $crlf
%d 5 3. Pieces cannot move diagonally. They cannot jump over another piece. They cannot move onto a square already occupied by another piece (unless attacking). $crlf
%d 5 4. Pieces cannot jump over or move onto the two areas in the center of the gameboard. Those areas are indicated by the 2 lakes. $crlf
%d 5 5. A piece cannot move back and forth between the same two squares more than 5 times in a row nomatter if they' re empty or occupied by enemy pieces. $crlf
%d 5 6. Only one piece can be moved on a turn. $crlf
%d 5 7. Special Scout Privilege: a Scout can move any number of open squares forward, backward, or sideways. But remember, this movement will let your opponent know the value of that piece. You may wish to move your Scouts one space at a time to confuse your opponent. Scouts are the only pieces allowed to move and attack on the same turn (except if you have changed "Scout only move" rule). $crlf
%d 5 $crlf
%d 5 Remember, Bombs and Flag cannot move and will remain on the squares where they were originally placed throughout the game. $crlf
%d 5 $crlf
%d 5 RULES FOR ATTACK $crlf
%d 5 1. Attack position: When a red and a blue piece occupy adjacent squares either back to back, side to side or face to face, they are in a position to attack. $crlf
%d 5 2. How to attack: to attack click on your piece and then click on your opponent' s piece. The battle starts. $crlf
%d 5 3. The piece with the lower rank is captured and removed from the battlefield. If the attacking piece is the remaining and winning piece, it moves into the space formerly occupied by the defending piece. If the remaining and winning piece is the defending piece, it stays on the square it was in when it was attacked. $crlf
%d 5 4. When pieces of the same rank battle, both pieces are removed from the game (except if you have changed "Aggressor advantage" rule). $crlf
%d 5 5. Attacking is always optional. $crlf
%d 5 $crlf
%d 5 RULES OF RANK $crlf
%d 5 1. A Marshal outranks a General and any other lower-ranking piece. $crlf
%d 5 A General outranks a Colonel and any lower-ranking piece. $crlf
%d 5 A Colonel outranks a Major and so on down to the Spy which is the lowest-ranking piece. $crlf
%d 5 2. Special Miner Privilege: When any piece other than a Miner strikes a Bomb, that piece is lost and removed from the board (except if you have changed "One time bombs" rule). When a Miner strikes a Bomb, the Bomb is defused and removed from the battlefield. The Miner then moves into the Bomb' s square. Bombs remain on the same square throughout the game unless they are defused. Bombs cannot attack or move. $crlf
%d 5 3. Special Spy Privilege: If any piece attacks the spy, it captures it. But the Spy has a unique attacking privilege. It is the only piece that can outrank a Marshal providing that the Spy attacks the Marshal first. If the Marshal is the attacker then the Spy is removed (except if you have changed the "Assassin Spy" rule). $crlf
%d 5 $crlf
%d 5 WINNING THE GAME $crlf
%d 5 The first player to attack an opponent' s Flag captures it and wins the game. $crlf
%d 5 If all of your moveable pieces have been removed or you do not have a valid move to make in your turn, then, if your opponent has at least one move left he is the winner, else the game ends in a draw. $crlf
%d 5 $crlf
%d 5 RULE VARIATIONS $crlf
%d 5 You can make your game more challenging by changing some of the rules. To do this, right-click anywhere inside the game' s window and select "Rule variations" from the "Options" menu. Remember that any rule changes you make during a game will not take place until your next game. Also have in mind that when playing a game the rule variations applied are the ones that the host player selected. If the player joining the game has selected a different set of rules, only the rules of the player hosting the game will apply.
%d 8 USEFUL TIPS $crlf
%d 8 1. It' s a good strategy to place some Bombs around your Flag to protect it. But place a Bomb or two elsewhere to confuse your opponent. $crlf
%d 8 2. Put a few high-ranking pieces in the front line to try breaking your opponent' s resistance but be careful not to lose them early in the game else you' ll be in a weak position. $crlf
%d 8 3. Scouts should generally be in the front lines to help you discover the strength of opposing pieces, but if you lose all of them quickly you will be forced to play at random. A good idea to avoid this is to hold some Scouts in the back rows. $crlf
%d 8 4. Place some Miners in the rear for the end of the game, where they will be needed to defuse Bombs. $crlf
%d 8 5. Take good care of your Spy. You only have one Spy and he is the only one to outrank your opponent' s Marshal. If you lose him you might be in a difficult position. $crlf
%d 8 6. It is not a good idea to go with a high-ranked piece and try to infiltrate your opponent' s army, especially if this piece is your Marshal. You never know when you' ll hit a Bomb or whether the opponent' s Spy hangs around. $crlf
%d 8 7. Watch your opponent' s pieces carefully. Pieces that do not move for a long period of time are probably Bombs. $crlf
%d 8 8. Generally it' s not a good idea to imprison your pieces between Bombs. You never know when you' ll need them. $crlf
%d 8 $crlf
%d 8 You are not obliged to apply those tips on your strategies. You must create your own strategies in order to become a better player. The above tips are only a sample of how you can place your army, what things are generally good to do and what things you must, most of the times, avoid. Of course there are more of them but the rest is up to you to find. $crlf
%d 8 $crlf
%d 8 Enjoy the game! $crlf
%d 24 GAME MENU $crlf
%d 24 To enter the game' s main menu right-click anywhere inside the game' s main window. The menu will popup. It contains the following options: $crlf
%d 24 $crlf
%d 24 * Game: let' s you decide whether to host a game, join a game already hosted by another user or view a list of users already hosting a game in order to connect to any one of them. Also, when a connection is already established more options will appear in this menu and will allow you to disconnect from your opponent, offer a draw, surrender or restart the game. $crlf
%d 24 $crlf
%d 24 * Options: this menu has the following options: $crlf
%d 24 - Game sounds: lets you enable/disable game sounds. $crlf
%d 24 $crlf
%d 24 - Auto-away when game starts: if enabled, you' ll automatically go away when a game starts. $crlf
%d 24 $crlf
%d 24 - Show instruction when connected: if enabled, when a connection is established a small window will popup containing some useful information on how to set your pieces. $crlf
%d 24 $crlf
%d 24 - Ask for rule variation setup on game host: if enabled, when you select to host a game you' ll be asked if you want to change some of the game' s rules. $crlf
%d 24 $crlf
%d 24 - Open game window on desktop next time: if selected, the next time you' ll launch the game, it will open as a desktop window and not inside your mIRC. (This is useful in case you cannot see the entire game area) $crlf
%d 24 $crlf
%d 24 - Single-click closes the attack window: allows the attack window to close by clicking anywhere inside it. $crlf
%d 24 $crlf
%d 24 - Time to wait before attack window closes automatically: let' s you set the time after which the attack window will close automatically. $crlf
%d 24 $crlf
%d 24 - Time to wait for opponent to join when hosting a game: this is the time to wait for an opponent to join a game you' ve hosted, before the connection times out. $crlf
%d 24 $crlf
%d 24 - Rule variations: allows you to change some of the game' s rules. When playing a game the rule set that will be applied is that of the user that is hosting the game. $crlf
%d 24 $crlf
%d 24 - View game history: shows you all your game results so far. $crlf
%d 24 $crlf
%d 24 - Help: opens the help dialog. $crlf
%d 24 $crlf
%d 24 - Exit Stratego: exits the game. $crlf
%d 24 $crlf
%d 24 $crlf
%d 24 When a connection is established some more options will become available on the game' s main menu. Those are: $crlf
%d 24 $crlf
%d 24 * Place unit: will place the specified unit into a square. $crlf
%d 24 $crlf
%d 24 * Remove unit: will remove the unit from a square. $crlf
%d 24 $crlf
%d 24 * Save formation: after you' ve placed all your units a dialog will popup asking you to start the game. If you intend on saving your formation before starting select "No" and then from this menu you can save you current formation. $crlf
%d 24 $crlf
%d 24 * Load formation: this will open the formation manager allowing you to load any previously saved formation. You can also right-click on a formation' s name to get some more options. After a formation is loaded you can change it as you would do if you placed the units manually. (Select "Remove" from the main menu to remove a unit and "Place unit" to place units) $crlf
%d 24 $crlf
%d 24 * Begin game: will inform your opponent that you are ready to start the game. $crlf
%d 24 $crlf
%d 24 GUI $crlf
%d 24 In the game' s main window you can see many information concerning the game' s progress and status. In the "Own/Captured" box you can check the units you currently have in the game and those you have captured from your opponent. So if you see something like "Captain - 2/3 out of 4" it means that you have 2 Captains in your army at the time being, you have killed 3 of your opponent' s Captains and the starting number of Captains for each army was 4. $crlf
%d 24 That in other words means that you have lost 2 of your Captains and your opponent is playing with 1 Captain because you have killed 3 of his Captains. $crlf
%d 24 At the right of this box you can see the game' s status box, containg information regarding your army' s color, the number of the turn and whose turn is it, the last move made and the game' s duration. Below this box you can see some statistics concerning you and your opponent. $crlf
%d 24 Finally, there is a last box which shows the chat with your opponent and any miscellaneous information available. To chat with your opponent type in the editbox at the bottom of the game' s window.
did -f $dname 22
}
alias -l str_help {
if ($dialog(str_help)) { dialog -v $v1 }
else { dialog -m str_help str_help }
}
alias -l str_away {
if ($str_g(away) != on) { return }
var %t = $scon(0), %r = Playing Stratego
while (%t > 0) {
scon %t
if ($1 != -b) && (!$away) && ($server) { var %a = 1 | if ($chan(0) > 0) { ame is away (Reason: %r $+ ) } | !away %r }
if ($1 == -b) && ($away) && ($awaymsg == %r) { var %b = 1 | if ($chan(0) > 0) { ame is back (Reason: $awaymsg $+ )(Duration: $duration($awaytime) $+ ) } | !away }
dec %t
}
scon -r
if (%a == 1) { str_info You have been marked as being away in all active connections, where possible. | return }
if (%b == 1) { str_info You are no longer marked as being away in all active connections, where possible. | return }
}
alias -l str_update { if ($dialog(str_verdl)) { dialog -x $v1 } | .timer -o 1 0 dialog -mo str_verdl str_verdl }
dialog -l str_verdl {
title "Stratego - Version check"
size -1 -1 250 115
box "Status:", 1, 10 5 230 65
text "Attempting connection...", 2, 15 25 220 35, center
button "Cancel", 3, 180 80 60 25, cancel
button "Update", 4, 10 80 60 25, disable
}
on *:dialog:str_verdl:init:0: {
did -f $dname 1
sockclose str_check
sockopen str_check geocities.com 80
}
on *:dialog:str_verdl:sclick:4: {
did -ra $dname 2 Please wait...
sockclose str_check
sockclose str_newdl
sockopen str_newdl geocities.com 80
}
on *:sockopen:str_check: {
if ($sockerr > 0) { if ($dialog(str_verdl)) { did -ra $v1 2 Error: Cannot establish connection. } }
else {
var %n = sockwrite -n $sockname
%n GET /gren_gr/index.html HTTP/1.1
%n Host: geocities.com
%n Connection: keep-alive
%n $crlf
}
}
on *:sockread:str_check: {
if ($sockerr > 0) { if ($dialog(str_verdl)) { did -ra $v1 2 Error: Cannot retrieve data. } | return }
:nextread
sockread %str_read
if ($sockbr == 0) { return }
if (%str_read != $null) {
if ($dialog(str_verdl)) {
var %t = $remove(%str_read,<,>,/,font,size,color,=,",C,td,olspan2,rowspan2,$chr(35),width251,$chr(9),fae,TimesRomanspan,style-:14,span)
tokenize 32 %t
if ($1 == str_ver) {
if ($2 > $str_ver) {
did -ra str_verdl 2 New version found! (v $+ $2 $+ ) $crlf $+ Click on "Update" to get it.
sockclose str_check
did -e str_verdl 4
unset %str_read
halt
}
else {
dialog -x str_verdl
sockclose str_check
unset %str_read
str_e [Stratego] No updates found.
halt
}
}
}
else { unset %str_read | sockclose str_check | halt }
}
goto nextread
}
on *:sockopen:str_newdl: {
unset %tmp.str.file.*
if ($sockerr) {
if ($dialog(str_verdl)) { did -ra $v1 2 Error: Cannot establish connection. }
return
}
write -c $_noc(stratego.zip)
var %n = sockwrite -n $sockname
%n GET /gren_gr/stratego.zip HTTP/1.1
%n Host: geocities.com
%n Accept: */*
%n Connection: keep-alive
%n $crlf
}
on *:sockread:str_newdl: {
if ($dialog(str_verdl)) {
if (%tmp.str.file.check != 1) {
sockread %tmp.str.file.dat
if (*HTTP/*404 Not Found* iswm %tmp.str.file.dat) { sockclose str_newdl | did -ra str_verdl 2 Error: File was not found... | halt }
if (content-length isin %tmp.str.file.dat) { set %tmp.str.file.size $remove($gettok(%tmp.str.file.dat,2,58),$chr(32)) }
if ($len(%tmp.str.file.dat) < 4) { set %tmp.str.file.check 1 }
}
elseif (%tmp.str.file.check == 1) {
sockread &tmp
inc %tmp.str.file.read $sockbr
did -ra str_verdl 2 Downloading new version... $int($calc(%tmp.str.file.read / %tmp.str.file.size * 100)) $+ $chr(37) $crlf $+ $round($calc(%tmp.str.file.read / 1024),0) of $round($calc(%tmp.str.file.size / 1024),0) $+ K
bwrite $_noc(stratego.zip) -1 &tmp
if (%tmp.str.file.read == %tmp.str.file.size) { sockclose str_newdl | did -b str_verdl 4 | did -ra str_verdl 2 Download finished. $crlf $+ Loading new version... | .timer -o 1 0 str_unzip | halt }
}
}
else { sockclose str_newdl | unset %tmp.str.file.* | if ($isfile($_noc(stratego.zip))) { .remove $_noc(stratego.zip) } | halt }
}
alias -l str_unzip {
unset %tmp.str.file.*
if (!$dialog(str_verdl)) { halt }
did -ra str_verdl 2 Loading new version...
if ($dll($scriptdirszip.dll)) { dll -u $_noc(szip.dll) }
if ($isfile($_noc(szip.dll))) { var %z = $dll($_noc(szip.dll),SUnZipFile,$scriptdirstratego.zip > $scriptdir) }
else { did -ra str_verdl 2 Error: Cannot unzip file $crlf $+ Please proceed manually... | halt }
if (%z == Z_OK) { .timer -o 1 0 str_loader }
}
alias -l str_loader {
if (!$dialog(str_verdl)) { halt }
if ($isfile($_noc(stratego.mrc))) {
dialog -x str_verdl
window -c @Stratego
str_end
if ($isfile($_noc(stratego.zip))) { .timer -o 1 0 .remove $_noc(stratego.zip) }
str_e [Stratego] New version successfully loaded!
.reload -rs $_noc(stratego.mrc)
}
else { did -ra str_verdl 2 Error: Cannot find file "stratego.mrc" }
}
alias -l str_ip {
if ($sock(str_ip)) { sockclose str_ip }
sockopen str_ip checkip.dyndns.org 80
}
on *:sockopen:str_ip:{
var %d = sockwrite -n $sockname
%d GET /index.php HTTP/1.0
%d Host: checkip.dyndns.org
%d user-agent: Mozilla/??
%d Connection: Keep-Alive
%d $crlf
}
on *:sockread:str_ip:{
if ($sockerr > 0) { str_serv_msg Error: Cannot retrieve servers. | return }
:nextread
sockread %str_read2
if ($sockbr == 0) { return }
if (<html> isin %str_read2) {
var %z = $remove(%str_read2,<html><head><title>Current IP Check</title></head><body>Current IP Address:,</body></html>)
scon -a localinfo $chr(10) %z
unset %str_read2
sockclose str_ip
if ($sock(stratego_serv)) {
if ($ip == $null) { sockclose stratego_serv }
else { sockwrite -n stratego_serv JOIN #stratego_players }
}
halt
}
goto nextread
}
alias -l str_servers {
if ($1 != nl) {
var %w = @str_servers
if ($window(%w)) { window -c %w }
window -dhsChk0l +nxt %w -1 -1 550 250 Verdana 9
titlebar %w - Attempting to retrieve servers...
}
if ($sock(stratego_serv)) { sockclose stratego_serv }
sockopen stratego_serv acn.irc.gr 6667
}
menu @str_servers {
dclick: { if ($sline($active,1)) { str_client $remove($gettok($sline($active,1),3,32),$chr(40),$chr(41)) | window -c $active } }
$iif($sline($active,1),Join this game) : str_client $remove($gettok($sline($active,1),3,32),$chr(40),$chr(41)) | window -c $active
-
Refresh server list: str_servers
}
alias -l str_serv_msg { if ($window(@str_servers)) { titlebar $v1 - $1- (Right-click in window for options) } }
on *:close:@str_servers: { if ($sock(stratego_wait).status != listening) { sockclose stratego_serv } }
on *:sockclose:stratego_serv:{ str_serv_msg Error: Cannot retrieve servers. }
on *:sockopen:stratego_serv: {
if ($sockerr) {
str_serv_msg Error: Cannot retrieve game servers.
sockclose stratego_serv
halt
}
str_a tmp.connect.nick $me
sockwrite -n stratego_serv NICK $me
sockwrite -n stratego_serv USER stratego * * : $+ stratego
}
alias -l str_nick_ch {
var %z = $left($me,20) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9) $+ $rand(0,9)
str_a tmp.connect.nick %z
sockwrite -n stratego_serv NICK %z
}
on *:sockread:stratego_serv: {
if ($sockerr) { str_serv_msg Error: Cannot retrieve servers. | sockclose stratego_serv | halt }
var %t = $null
while ($sock(stratego_serv).rq) {
sockread %t
tokenize 32 %t
if ($sockbr == 0) { return }
if ($2 == 433) { .timer -o 1 0 str_nick_ch }
if ($2 == 376) { str_ip }
if (*!*@* iswm $1) { var %nick = $remove($gettok($1,1,33),:) }
if ($1 == PING) { sockwrite -n stratego_serv PONG $2- }
if ($2 == JOIN) {
if (%nick != $str_g(tmp.connect.nick)) {
if ($ip == $null) { sockclose stratego_serv | halt }
if ($sock(stratego_wait).status == listening) { sockwrite -n stratego_serv PRIVMSG %nick : $+ $str_g(tmp.connect.nick) $ip $str_rank $str_ratio $str_streak }
}
else { str_serv_msg 0 servers found. }
}
if ($2 == PRIVMSG) {
if ($3 == $str_g(tmp.connect.nick)) {
if ($window(@str_servers)) {
aline $v1 User: $remove($4,:) ( $+ $5 $+ ) Rank: $6 Win ratio: $7 Streak: $8-
var %z = $line($v1,0)
str_serv_msg %z $iif(%z == 1,server,servers) found.
}
}
}
}
}