Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help !! Missing right bracket - error !! 1

Status
Not open for further replies.

drathbone

Technical User
Jun 11, 2001
39
GB
The following is part of a script I'm writing. With this code in I get the above error (read thread title). I've read through this many times and can't find the problem - it's definately in this piece of the code, as if I remove this piece it works fine - any suggestions ??

Code
----
if ($f1{style} =~ m/inside/gi) {
$fighter1{str}++;
if ($fighter1{str} > $fighter2{str}) {
$diff = (($fighter1{str} - $fighter2{str}) * 1.5);
$fighter1{str} = ($fighter1{str} + $diff);
}
$fighter1{agl} = (($fighter1{agl} / 10) * 9);

} elsif ($f1{style} =~ m/clinch/gi) {
$fighter1{agl}++;
if ($fighter1{str} > $fighter2{str}) {
$diff = (($fighter1{str} - $fighter2{str}) * 1.5);
$fighter1{agl} = ($fighter1{agl} + $diff);
}
$diff = ($f2{agr} / 5);
$f1{agr} = ($f1{agr} - $diff);
$f1{rst} = ($f1{rst} + $diff);

} elsif ($f1{style} =~ m/feint/gi) {
$fighter1{spd}++;
if ($fighter1{spd} > $fighter2{spd}) {
$diff = (($fighter1{spd} - $fighter2{spd}) * 1.5);
$fighter1{spd} = ($fighter1{spd} + $diff);
}
$f1{end}--;

} elsif ($f1{style} =~ m/counter/gi) {
$fighter1{str}++;
if (($fighter1{spd} + $fighter1{hgt}) > ($fighter2{spd} + $fighter2{hgt})) {
$diff = (($fighter1{spd} + $fighter1{hgt}) - ($fighter2{spd} + $fighter2{hgt}));
$fighter1{agl} = ($fighter1{agl} + (0.25 * $diff));
$test = $fighter2{agl};
if (($fighter2{agl} - (0.25 * $diff)) < ($test * 0.5)) {
$fighter2{agl} = ($fighter2{agl} * 0.5);
} else {
$fighter2{agl} = ($fighter2{agl} - (0.25 * $diff));
}
$f1{agr} = ($f1{agr} * 0.8);

} elsif ($f1{style} =~ m/ring/gi) {
$fighter1{agl}++;
if ($fighter1{agl} > $fighter2{agl}) {
$diff = ($fighter1{agl} - $fighter2{agl});
$fighter1{agl} = ($fighter1{agl} + ($diff * 1.5));
}
$f1{end}--;

} elsif ($f1{style} =~ m/ropes/gi) {
if ($fighter1{agl} > $fighter2{agl}) {
$diff = ($fighter1{agl} - $fighter2{agl});
if (($fighter2{agl} - ($diff * 0.5)) < 8) {
$fighter2{agl} = 8;
} else {
$fighter2{agl} = ($fighter2{agl} - ($diff * 0.5));
}
$fighter1{agl}--;

} elsif ($f1{style} =~ m/outside/gi) {

} elsif ($f1{style} =~ m/allout/gi) {

}

Thanks in advance !!
Darren Rathbone
 
Using the parentheses matching of vi, I think I have found the missing bracket:
[tt]
} elsif ($f1{style} =~ m/counter/gi) {
$fighter1{str}++;
if (($fighter1{spd} + $fighter1{hgt}) > ($fighter2{spd} + $fighter2{hgt})) {
$diff = (($fighter1{spd} + $fighter1{hgt}) - ($fighter2{spd} + $fighter2{hgt}));
$fighter1{agl} = ($fighter1{agl} + (0.25 * $diff));
$test = $fighter2{agl};
if (($fighter2{agl} - (0.25 * $diff)) < ($test * 0.5)) {
$fighter2{agl} = ($fighter2{agl} * 0.5);
} else {
$fighter2{agl} = ($fighter2{agl} - (0.25 * $diff));
}
$f1{agr} = ($f1{agr} * 0.8);

} elsif ($f1{style} =~ m/ring/gi) {
$fighter1{agl}++;
if ($fighter1{agl} > $fighter2{agl}) {
$diff = ($fighter1{agl} - $fighter2{agl});
$fighter1{agl} = ($fighter1{agl} + ($diff * 1.5));
}
$f1{end}--;
[/tt]
Hope this helps, Cheers Neil
 
hmmm... thanks for running that through (how do you do the parenthesis matching in vi ??)....

I can't find a problem with that line, though.
3 open brackets and 3 close brackets !!
 
in command mode (hit ESC twice) put the cursor on a bracket and tap the % key Mike
______________________________________________________________________
&quot;Experience is the comb that Nature gives us after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
Cheers...

Problem has now been solved. Two missing curly brackets !!
 
ps: if you do use vi, then you can configure it to automatically show the matching parentheses whilst in insert mode using:
Code:
:set showmatch
Cheers, Neil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top