mIRC Home    About    Download    Register    News    Help

Print Thread
#131548 01/10/05 11:15 AM
Joined: Mar 2005
Posts: 74
K
KidSol Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Mar 2005
Posts: 74
Code:
  

on *:text:!hit*:*:{
  if !$2 || !$3 || !$4 || !$5 || !$6 || !$7 || !$8 || !$9 { halt }
  else {
    [b].msg $chan You have4 $calc((($2 * 1) + ($3 * 2) + ($4 * 4)) * $5) [/b]
    [b].msg $chan Your enemy have $calc((($6 * 1) + ($7 * 2) + ($8 * 4)) * $9)[/b]
  }
}


I just made this script just now. I need a litle more help on hit

How i make the line 1 minus 2 ?
So it will shows the results ini :-
.msg $chan You have lose if results shows -(amount)
.msg $chan You have win if results shows +(amount)

Thx

#131549 01/10/05 01:18 PM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
Code:
on *:text:!hit*:*:{
  if (!$9) { return }
  var %_you = $calc((($2 * 1) + ($3 * 2) + ($4 * 4)) * $5), %_enemy = $calc((($6 * 1) + ($7 * 2) + ($8 * 4)) * $9)
  .msg $chan You have4 %_you
  .msg $chan Your enemy have %_enemy
  .msg $chan You have $iif($left($calc(%_you - %_enemy),1) == $chr(45), Lost, Won)
}


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
#131550 01/10/05 02:08 PM
Joined: Mar 2005
Posts: 74
K
KidSol Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Mar 2005
Posts: 74
Thx

#131551 01/10/05 08:14 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
Code:
on *:text:!hit*:*:{
  var %_you = $calc((($2 * 1) + ($3 * 2) + ($4 * 4)) * $5), %_enemy = $calc((($6 * 1) + ($7 * 2) + ($8 * 4)) * $$9)
  .msg $chan You have4 %_you
  .msg $chan Your enemy have %_enemy
  .msg $chan You have $iif(%_you < %_enemy, Lost, Won)
}


Used $$9 to make sure it exists, and just a simple greater than in the $iif...

#131552 01/10/05 08:30 PM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
The 'if (!$9) { return }' is needed, the script needs to halt straight away if all 9 parimatres are not there, if there are only 8 it will calculate incorrectly. It will also continue to split out messages if the variables fail to set because of missing parimatres.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
#131553 01/10/05 08:36 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
No it isn't.
Try /test 1 and /test 1 2
Notice there are 2 dollar signs before the 2. (or the 9 in above script)
Code:
alias test {
  var %blub = $t2(1) $$2 $t2(2)
  echo -a You only see this if you give at least 2 parameters...
}
alias t2 { echo -a Executed: $1 }

#131554 01/10/05 08:38 PM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
doesn't the $$9 (double $) force the parameter to exist and if not the script wont run?

#131555 01/10/05 09:07 PM
Joined: Jul 2003
Posts: 655
Fjord artisan
Offline
Fjord artisan
Joined: Jul 2003
Posts: 655
Your right, the help file explains this badly, and i do not use $$ often myself. Help file says $$N halts the command (in this case /var), rather than halting the script.


"Allen is having a small problem and needs help adjusting his attitude" - Flutterby
#131556 02/10/05 12:15 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
var %_enemy = $calc($$9 * (($6 * 1) + ($7 * 2) + ($8 * 4))), %_you = $calc((($2 * 1) + ($3 * 2) + ($4 * 4)) * $5)

might have been a bit better tho, stops as soon as it incounters the $$9 so doesnt have to do as much processing.

Mahahhahaa i have saved .000001 seconds, now to take over the world!


Link Copied to Clipboard