Now while allows multiple parameters in the same way that if/elsif/else
r8859
New features: While with multiple parameters
Moderator: Moderators
Re: New features: While with multiple parameters
So... replace the whole block
with new code
Or should I replace all that - lines with + lines ?
Sorry, never update throught the web before, after all those times, I still need lot learning ...
On other unrelated note,
Did the macro already support "multiple class" that threated as OR ?
Code: Select all
##########################################
# while statement: while (foo <= bar) as label
} elsif ($line =~ /^while\s/) {
my ($first, $cond, $last, $label) = $line =~ /^while\s+\(\s*"?(.*?)"?\s+([<>=!]+?)\s+"?(.*?)"?\s*\)\s+as\s+(.*)/;
if (!defined $first || !defined $cond || !defined $last || !defined $label) {$self->{error} = "$errtpl: syntax error in while statement"}
else {
my $pfirst = parseCmd($first, $self); my $plast = parseCmd($last, $self);
if (defined $self->{error}) {$self->{error} = "$errtpl: $self->{error}"; return}
unless (defined $pfirst && defined $plast) {$self->{error} = "$errtpl: either '$first' or '$last' has failed"}
elsif (!cmpr($pfirst, $cond, $plast)) {$self->{line} = $self->{label}->{"end ".$label}}
$self->{line}++
}
$self->{timeout} = 0
##########################################
Code: Select all
##########################################
# while statement: while (foo <= bar) as label
} elsif ($line =~ /^while\s/) {
- my ($first, $cond, $last, $label) = $line =~ /^while\s+\(\s*"?(.*?)"?\s+([<>=!]+?)\s+"?(.*?)"?\s*\)\s+as\s+(.*)/;
- if (!defined $first || !defined $cond || !defined $last || !defined $label) {$self->{error} = "$errtpl: syntax error in while statement"}
- else {
- my $pfirst = parseCmd($first, $self); my $plast = parseCmd($last, $self);
- if (defined $self->{error}) {$self->{error} = "$errtpl: $self->{error}"; return}
- unless (defined $pfirst && defined $plast) {$self->{error} = "$errtpl: either '$first' or '$last' has failed"}
- elsif (!cmpr($pfirst, $cond, $plast)) {$self->{line} = $self->{label}->{"end ".$label}}
- $self->{line}++
- }
+ my ($text, $label) = $line =~ /^while\s+\(\s*(.*)\s*\)\s+as\s+(.*)/;
+ my $text = parseCmd($text, $self);
+ if (defined $self->{error}) {$self->{error} = "$errtpl: $self->{error}"; return}
+ my $savetxt = particle($text, $self, $errtpl);
+ if (!multi($savetxt, $self, $errtpl)) {
+ $self->{line} = $self->{label}->{"end ".$label};
+ }
+ $self->{line}++;
$self->{timeout} = 0
##########################################
# pop value from variable: $var = [$list]
Sorry, never update throught the web before, after all those times, I still need lot learning ...
On other unrelated note,
Did the macro already support "multiple class" that threated as OR ?
-
- The Way Of Human
- Posts: 150
- Joined: 24 Mar 2012, 04:13
- Noob?: Yes
Re: New features: While with multiple parameters
ente ngapain bro, tinggal download aja susah susah.
replace (-)line with (+)line
for every job except novice you can use this
for swordman = 1, Merchant = 5 ( look inside src\globals.pm ), you can use this way
i guess...
replace (-)line with (+)line
for every job except novice you can use this
Code: Select all
eval $::char->{jobID} > 0
Code: Select all
eval $::char->{jobID} =~ /^1|5$/
Re: New features: While with multiple parameters
Bukan tinggal donglot bang, tapi ane gagal paham ... belom nyampe otak ane.c4c1n6kr3m1 wrote:ente ngapain bro, tinggal download aja susah susah.
replace (-)line with (+)line
for every job except novice you can use thisfor swordman = 1, Merchant = 5 ( look inside src\globals.pm ), you can use this wayCode: Select all
eval $::char->{jobID} > 0
i guess...Code: Select all
eval $::char->{jobID} =~ /^1|5$/
When I tries download the whole Script.pm (only Script.pm), it gives me error, so I revert back to the old version
I guess that eval could work...
A lil question, what does "^" and "$" on that regex means, thanks