Advertisement
Guest User

Untitled

a guest
Jul 8th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 9.86 KB | None | 0 0
  1. alias luxwar {
  2.   if ($window(@luxwar)) { window -a @luxwar }
  3.   else {
  4.     window -BCdp +t @luxwar 0 0 640 480
  5.     ;dll $+(",$scriptdir,fullscreen.dll,") Fullscreen640x480 $window(@luxwar).hwnd
  6.     %ticks = $ticks
  7.     %luxwar.x = 150
  8.     %luxwar.y = 150
  9.     %luxwar.dir = 0
  10.     .timerluxwar -h 1 0 drawluxwar
  11.   }
  12. }
  13. alias -l drawluxwar {
  14.   var %win @luxwar
  15.   if ($window(%win)) {
  16.  
  17.     ;begin frame
  18.     inc %fps
  19.     if ($calc($ticks - %ticks) >= 1000) { %_fps = %fps | %fps = 0 | %ticks = $ticks }
  20.  
  21.     clear -n %win
  22.     drawtext -nr %win 0 tahoma 11 10 10 FPS: %_fps
  23.  
  24.     drawtext -nr %win 0 tahoma 11 10 30 use as teclas W A S D para movimentar - Alt+Z para fechar
  25.  
  26.     drawdot -nr %win 1 3 %luxwar.x %luxwar.y
  27.  
  28.     var %dir $point_direction($mouse.x,$mouse.y,%luxwar.x,%luxwar.y)
  29.     ;var %dir $point_direction(%luxwar.x,%luxwar.y,$mouse.x,$mouse.y)
  30.     drawline -nr %win $rgb(222,2,2) 1 %luxwar.x %luxwar.y $calc(%luxwar.x + $lengthdir_x(10,%dir)) $calc(%luxwar.y + $lengthdir_y(10,%dir))
  31.  
  32.     drawtext_ext -nr %win 0 tahoma 11 10 60 200 20 angle: %dir - mouse: $mouse.x x $mouse.y - %luxwar.x x %luxwar.y
  33.  
  34.     drawtext_ext -nr %win 0 tahoma 11 10 130 200 20 distance: $point_distance($mouse.x,$mouse.y,%luxwar.x,%luxwar.y)
  35.  
  36.     drawrect -nrf %win 0 0 200 200 332 32, 400 200 32 332, 400 400 32 332, 0 330 700 32
  37.  
  38.     %luxwar.tirolen = 1
  39.     var %stop 0
  40.     while (%stop = 0) {
  41.       ;.dll $+(",$scriptdir,WhileFix.dll") WhileFix .
  42.  
  43.       var %wf $calc(%luxwar.x + $lengthdir_x(%luxwar.tirolen,%dir))
  44.       var %hf $calc(%luxwar.y + $lengthdir_y(%luxwar.tirolen,%dir))
  45.       var %getdot $getdot(%win,%wf,%hf)
  46.       ;echo -a > %getdot
  47.       inc %luxwar.tirolen 31
  48.       if (%getdot = $rgb(0,0,0)) || (%wf < 0) || (%wf > 640) || (%hf < 0) || (%hf > 480) {
  49.         %luxwar.tirolen = 1
  50.         %stop = 1
  51.         ;drawline -nr %win $rgb(2,222,2) 2 %luxwar.x %luxwar.y %wf %hf
  52.       }
  53.     }
  54.  
  55.     drawline -nr %win $rgb(2,222,2) 2 $calc(%luxwar.x + $lengthdir_x(6,%dir)) $calc(%luxwar.y + $lengthdir_y(6,%dir)) %wf %hf
  56.  
  57.  
  58.     /*
  59.     %luxwar.tirolen = 4
  60.     var %wf $calc(%luxwar.x + $lengthdir_x(%luxwar.tirolen,%dir))
  61.     var %hf $calc(%luxwar.y + $lengthdir_y(%luxwar.tirolen,%dir))
  62.     var %getdot $getdot(%win,%wf,%hf)
  63.     var %collision $false
  64.     ;while (%getdot != $rgb(0,0,0)) || (%wf > 0) || (%wf < 640) || (%hf > 0) || (%hf < 480) {
  65.     while (%collision = $false) {
  66.       .dll $+(",$scriptdir,WhileFix.dll") WhileFix .
  67.       inc %luxwar.tirolen 1
  68.       var %wf $calc(%luxwar.x + $lengthdir_x(%luxwar.tirolen,%dir))
  69.       var %hf $calc(%luxwar.y + $lengthdir_y(%luxwar.tirolen,%dir))
  70.       var %getdot $getdot(%win,%wf,%hf)
  71.       ;echo -a > %getdot
  72.       if (%getdot = $rgb(0,0,0)) { %collision = $true }
  73.       if (%wf < 0) || (%wf > 640) || (%hf < 0) || (%hf > 480) { %collision = $true }
  74.       drawline -nr %win $rgb(2,222,2) 2 %luxwar.x %luxwar.y %wf %hf
  75.     }
  76.     */
  77.  
  78.  
  79.     ;drawline -nr %win 0 1 %luxwar.x %luxwar.y $calc(%luxwar.x + $lengthdir_x(10,%luxwar.dir)) $calc(%luxwar.y + $lengthdir_y(10,%luxwar.dir))
  80.     ;drawline -nr %win 0 1 %luxwar.x %luxwar.y $calc(%luxwar.x + $lengthdir_x(5,$calc(%luxwar.dir +90))) $calc(%luxwar.y + $lengthdir_y(5,$calc(%luxwar.dir +90)))
  81.     ;drawline -nr %win 0 1 %luxwar.x %luxwar.y $calc(%luxwar.x + $lengthdir_x(5,$calc(%luxwar.dir -90))) $calc(%luxwar.y + $lengthdir_y(5,$calc(%luxwar.dir -90)))
  82.  
  83.     ;if (%luxwar.speed > 0) { dec %luxwar.speed 0.01 }
  84.     ;if (%luxwar.speed < 0) { %luxwar.speed = 0 }
  85.  
  86.     ;%luxwar.x = $calc(%luxwar.x + $lengthdir_x(%luxwar.speed,%luxwar.dir))
  87.     ;%luxwar.y = $calc(%luxwar.y + $lengthdir_y(%luxwar.speed,%luxwar.dir))
  88.  
  89.     drawdot %win
  90.     .timerluxwar -h 1 0 drawluxwar
  91.   }
  92. }
  93.  
  94. ;/drawtext_ext -c[hnrpbo] @ <color> [color] <fontname fontsize> <x y w h> <text>
  95. ;Desenha texto com multiplas linhas
  96. alias drawtext_ext {
  97.   var %toks 10
  98.   var %flags $1
  99.   var %win $2
  100.   var %cor $3
  101.   if (c !isin $1) { %flags = -c $+ $remove(%flags,-) }
  102.   if (b isin $1) {
  103.     var %cor2 $4
  104.     var %font $5
  105.     var %fsize $6
  106.     var %x $7
  107.     var %y $8
  108.     var %w $9
  109.     var %h $10
  110.     inc %toks
  111.   }
  112.   else {
  113.     var %font $4
  114.     var %fsize $5
  115.     var %x $6
  116.     var %y $7
  117.     var %w $8
  118.     var %h $9
  119.   }
  120.   var %text $gettok($1-, [ [ %toks ] $+ ] -,32)
  121.   var %lines $wrap(%text,%font,%fsize,%w,0)
  122.   var %now 1
  123.   while (%now <= %lines) {
  124.     drawtext %flags %win %cor %cor2 %font %fsize %x %y %w %h $wrap(%text,%font,%fsize,%w,%now)
  125.     inc %y $calc($height(%text,%font,%fsize) +3)
  126.     inc %now
  127.   }
  128. }
  129.  
  130. ;$point_distance(x1,y1,x2,y2)
  131. alias point_distance { return $calc((($4 - $2) ^ 2 + ($3 - $1) ^ 2) ^ (1/2)) }
  132.  
  133. ;$point_direction(x1,y1,x2,y2)
  134. alias point_direction {
  135.   if ($1 == $3) { return $iif($4 > $2,270,90) }
  136.   return $calc($iif($atan($calc(($4 - $2)/($3 - $1))).deg < 0,$calc($v1 +180),$v1) + $iif($4 > $2 || ($4 == $2 && $3 > $1),180,0))
  137. }
  138.  
  139. alias radtodeg { return $calc($1 * 180/ $pi ) }
  140. alias degtorad { return $calc($1 * $pi /180) }
  141.  
  142. ;$lengthdir_x(len,dir)
  143. alias -l lengthdir_x { return $calc( $cos($2).deg * $1) }
  144. ;$lengthdir_y(len,dir)
  145. alias -l lengthdir_y { return $calc( $sin($2).deg * $1) }
  146.  
  147. alias -l keypress {
  148.   /*
  149.   if ($1 == 37) {
  150.     dec %luxwar.dir 3
  151.     if (%luxwar.dir <= 0) { %luxwar.dir = $calc(360- %luxwar.dir) }
  152.   }
  153.   if ($1 == 38) {
  154.     if (%luxwar.speed < 2) { inc %luxwar.speed 0.3 }
  155.   }
  156.   if ($1 == 39) {
  157.     inc %luxwar.dir 3
  158.     if (%luxwar.dir >= 360) { %luxwar.dir = $calc(%luxwar.dir -360) }
  159.   }
  160.   */
  161.   ;%luxwar.lastx = %luxwar.x
  162.   ;%luxwar.lasty = %luxwar.y
  163.  
  164.   var %gd.d $getdot(@luxwar,$calc(%luxwar.x +3),%luxwar.y)
  165.   var %gd.e $getdot(@luxwar,$calc(%luxwar.x -3),%luxwar.y)
  166.   var %gd.c $getdot(@luxwar,%luxwar.x,$calc(%luxwar.y -3))
  167.   var %gd.b $getdot(@luxwar,%luxwar.x,$calc(%luxwar.y +3))
  168.  
  169.   if ($chr($1) = a) && (%gd.e != $rgb(0,0,0)) { dec %luxwar.x }
  170.   if ($chr($1) = s) && (%gd.b != $rgb(0,0,0)) { inc %luxwar.y }
  171.   if ($chr($1) = d) && (%gd.d != $rgb(0,0,0)) { inc %luxwar.x }
  172.   if ($chr($1) = w) && (%gd.c != $rgb(0,0,0)) { dec %luxwar.y }
  173.  
  174.   ;if (%getdot = $rgb(0,0,0)) { %luxwar.x = %luxwar.lastx | %luxwar.y = %luxwar.lasty }
  175. }
  176.  
  177. on *:keydown:@luxwar:*:{
  178.   ;echo -a > $keyval
  179.   .timerluxwarkeypress [ $+ [ $keyval ] ] 0 0 keypress $keyval
  180. }
  181. on *:keyup:@luxwar:*:{
  182.   ;echo -a > $keyval
  183.   .timerluxwarkeypress [ $+ [ $keyval ] ] off
  184. }
  185. on *:close:@luxwar:{
  186.   ;dll $+(",$scriptdir,fullscreen.dll,") Reset
  187. }
  188. /*
  189. on *:ACTIVE:*:{
  190.   ;echo Activated: $active De-Activated: $lactive
  191.   if ($active = @luxwar) { dll $+(",$scriptdir,fullscreen.dll,") Fullscreen640x480 $window(@luxwar).hwnd }
  192.   elseif ($lactive = @luxwar) { dll $+(",$scriptdir,fullscreen.dll,") Reset }
  193. }
  194. */
  195.  
  196.  
  197.  
  198.  
  199.  
  200. ;-----------------------------------------------------------------------------------------
  201.  
  202.  
  203. alias rexgame {
  204.   if ($window(@rex) || $hget(rex)) { return }
  205.   window -pdkw0BC @REX -1 -1 640 480 | .titlebar @rex Game
  206.   hmake rex 64
  207.   hadd rex x 320
  208.   hadd rex y 240
  209.   hadd rex key 0
  210.   hadd rex shoot 0
  211.   hmake rexs 256
  212.   drawrect -rnef @rex $rgb(64,128,64) 11 $calc($hget(rex,x) -5) $calc($hget(rex,y) -5) 11 11
  213. }
  214. on *:keydown:@rex:*:{
  215.   if (!$keyrpt) {
  216.     if ($keychar isin wasd) { hadd rex key $remove($hget(rex,key),$keychar) $+ $keychar }
  217.     rex.atu.game 1
  218.     .timerREX -mh 0 10 rex.atu.game
  219.   }
  220. }
  221. on *:keyup:@rex:*:{ hadd rex key $remove($hget(rex,key),$keychar) }
  222. on *:close:@rex:{ hfree rex | hfree rexs | .timerREX off }
  223. menu @rex {
  224.   mouse:{ rex.atu.game -1 }
  225.   sclick:{ rex.add.shoot $mouse.x $mouse.y }
  226.   dclick:{ rex.add.shoot $mouse.x $mouse.y }
  227. }
  228. alias -l rex.add.shoot {
  229.   var %% = $point_direction($hget(rex,x),$hget(rex,y),$1,$2)
  230.   hinc rex shoot
  231.   hadd rexs $+(t,$hget(rex,shoot)) $hget(rex,x) $hget(rex,y) $calc(-5* $cos(%%).deg) $calc(-5* $sin(%%).deg)
  232.   .timerREX -mh 0 10 rex.atu.game
  233. }
  234. alias -l rex.atu.game {
  235.   if ($window(@rex) && $hget(rex)) {
  236.     if ($1 < 0) { goto >> }
  237.     if ($hget(rex,key) == 0 && $hget(rex,0).item == 3) { .timerREX off | return }
  238.     var %key = $hget(rex,key)
  239.     if (w isin %key) { hdec rex y }
  240.     elseif (s isin %key) { hinc rex y }
  241.     if (a isin %key) { hdec rex x }
  242.     elseif (d isin %key) { hinc rex x }
  243.     :>>
  244.  
  245.     drawrect -rfn @rex $rgb(255,255,255) 1 0 0 $window(@rex).w $window(@rex).h
  246.  
  247.     ;atualizar tiros
  248.     var %x = 1,%< = $iif($1 < 0,1,0)
  249.     while ($hget(rexs,%x).item) {
  250.       tokenize 32 $v1 $hget(rexs,$v1)
  251.       if ($2 < 0 || $3 < 0 || $2 > $window(@rex).w || $3 > $window(@rex).h) { hdel rexs $1 | goto < }
  252.       if (%<) { goto > }
  253.       tokenize 32 $1 $calc($2 + $4) $calc($3 + $5) $4 $5
  254.       hadd rexs $1 $2-
  255.       :>
  256.       drawdot -nr @rex $rgb(64,64,128) 3 $2 $3
  257.       :<
  258.       inc %x
  259.     }
  260.  
  261.     ;angulo do vetor
  262.     var %ang = $round($point_direction($hget(rex,x),$hget(rex,y),$mouse.x,$mouse.y),4)
  263.  
  264.     ;nave
  265.     drawrect -rnef @rex $rgb(64,128,64) 1 $calc($hget(rex,x) -5) $calc($hget(rex,y) -5) 11 11
  266.     drawrect -rnef @rex $rgb(64,128,64) 1 $calc($hget(rex,x) -3 + $cos(%ang).deg * -5) $calc($hget(rex,y) -3 + $sin(%ang).deg * -5) 7 7
  267.  
  268.     ;mouse
  269.     drawrect -rne @rex $rgb(128,64,64) 1 $calc($mouse.x -5) $calc($mouse.y -5) 11 11
  270.     drawrect -rne @rex $rgb(128,64,64) 1 $calc($mouse.x -9) $calc($mouse.y -9) 19 19
  271.  
  272.     ;linha do mouse
  273.     ;drawline -rn @rex $rgb(255,0,0) 1 $hget(rex,x) $hget(rex,y) $mouse.x $mouse.y
  274.  
  275.     ;osd
  276.     drawtext -rn @rex 0 tahoma 11 5 5 X: $hget(rex,x)
  277.     drawtext -rn @rex 0 tahoma 11 5 20 Y: $hget(rex,y)
  278.     drawtext -rn @rex 0 tahoma 11 5 35 Âng: %ang $+ °
  279.     drawtext -rn @rex 0 tahoma 11 5 50 Tiros: $hget(rex,shoot)
  280.     drawtext -nr @rex 0 tahoma 11 5 65 Vivos: $hget(rexs,0).item
  281.  
  282.     drawdot @rex
  283.   }
  284. }
  285. /*
  286. alias point_distance { return $calc((($4 - $2) ^ 2 + ($3 - $1) ^ 2) ^ (1/2)) }
  287. alias point_direction {
  288.   if ($1 == $3) { return $iif($4 > $2,270,90) }
  289.   return $calc($iif($atan($calc(($4 - $2)/($3 - $1))).deg < 0,$calc($v1 +180),$v1) + $iif($4 > $2 || ($4 == $2 && $3 > $1),180,0))
  290. }
  291. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement