home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 126
/
af126a.adf
/
Football.lzx
/
football
/
user
/
Cup_ViewTeamProgress.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
13KB
|
363 lines
/* ***********************************************************************
VIEW TEAM PROGRESS PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 181297 First release.
140998 Added support for Two-Leg matches and Away Goals.
210499 Added check for no team specified.
**************************************************************************
Procedure
---------
1. Check files exist.
2. Read '.cf' file and get cup name and team list.
3. Search for selected team and give error if cannot find it, else set
marker.
4. Read '.scf' file and read in all round names and matches that the
selected team was in.
5. Display title.
6. Loop. Get roundname and change if replay. Get Home and Away type.
7. Read match and get opponent and score, adding it to goals conceeded
and goals scored.
8. Check next line for Extra Time, and append to score string. Change
goals_con/scored accordingly.
9. Check next line for Penalties, and append to score string.
10.Display round, home/away, opponent and score.
11.End loop.
12.Exit.
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.cf'
input2_file = '.scf'
separator = '*'
matches. = '???'
mcount = 0
not_played = '__ __'
teams. = '???'
counter = 0
title = '*CUP_TITLE='
awaygs = '*CUP_AWAYG='
parse var league_stuff league_file search_team
league_file = "Data/" || league_file
if exists(league_file || input_file) = 0 then exit
if exists(league_file || input2_file) = 0 then exit
if search_team = "" then do
say
say "ERROR : (ViewTeamProgress)"
say
say "Cannot view team's progress as none was selected."
say
say "This is a 'Set & Run' script. Program aborted."
say
exit
end
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then cupname= delstr(line,1,11)
if pos(awaygs,line) > 0 then awayg = delstr(line,1,11)
if pos(separator,line) = 0 then do
line = strip(line)
if counter = 0 then do
teams.1 = line
counter = 1
end
else do
counter = counter + 1
teams.counter = line
end
end
end
close(datafile)
end
else do
say
say "ERROR : (ViewTeamProgress)"
say
say "Cannot open '"league_file||input_file"' for reading."
exit
end
sel=-1
search_team = strip(search_team)
do i=1 to counter
if pos(search_team,teams.i) > 0 then
sel = i
end
if sel < 0 then do
say
say "ERROR : (ViewTeamProgress)"
say
say "Incorrect team. '"search_team"' cannot be found in this"
say "cup."
exit
end
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos("*Round",line) > 0 then do
mcount = mcount + 1
matches.mcount = line
end
if pos(separator,line) = 0 & pos("#",line) = 0 then do
line = strip(line)
if pos(teams.sel,line) > 0 then do
mcount = mcount + 1
matches.mcount = line
mkr = 1
end
else
mkr = 0
end
if pos("#",line) > 0 & mkr = 1 then do
mcount = mcount + 1
matches.mcount = line
end
end
close(datafile)
end
else do
say
say "ERROR : (ViewTeamProgress)"
say
say "Cannot open '"league_file||input2_file"' for reading."
exit
end
say
say center("'"cupname"'",78)
say "-------------------------------------------------------------------------------"
say
say "Team : "teams.sel
say
say
say "Round Where? Match (The selected team's score is always first)"
say "-------------------------------------------------------------------------------"
say
goals_con = 0
goals_scr = 0
donem = 0
do i=1 to mcount
if pos("*Round",matches.i) > 0 then do
if pos("Replay",matches.i) > 0 then
round = left("Replay",15,' ')
else do
parse var matches.i "*Round="name
round = substr(name,1,5)
if pos("1 Leg",name) > 0 then round = round||" (1st L)"
if pos("2 Legs",name) > 0 then round = round||" (2nd L)"
round = left(round,15,' ')
end
donem = 0
h = 0
j = i + 1
if pos(teams.sel,matches.j) = 1 then do
round = round||"Home "
h = 1
donem = 1
end
if pos(teams.sel,matches.j) > 1 then do
round = round||"Away "
h = 2
donem = 1
end
if donem = 1 then do
if pos(not_played,matches.j) > 0 then do
if h = 1 then opponent = strip(substr(matches.j,41,30))
if h = 2 then opponent = strip(substr(matches.j,1,30))
say round""left(opponent,32)" - To Be Played."
end
else do
sd = ''
if pos("2 Legs",name) > 0 then do
for = strip(substr(matches.j,32,2))
aga = strip(substr(matches.j,37,2))
if h = 1 then do
sd = right(for,2)"-"left(aga,2)
goals_scr = goals_scr + for
goals_con = goals_con + aga
opponent = strip(substr(matches.j,41,30))
end
else do
sd = right(aga,2)"-"left(for,2)
goals_scr = goals_scr + aga
goals_con = goals_con + for
opponent = strip(substr(matches.j,1,30))
end
k = j + 1
if pos("#1st Leg",matches.k) > 0 then do
parse var matches.k "#1st Leg" for1l aga1l .
for1l = strip(for1l)
aga1l = strip(aga1l)
if h = 1 then
sd = sd" Agg: "right(for1l+for,2)"-"left(aga1l+aga,2)
else
sd = sd" Agg: "right(aga1l+aga,2)"-"left(for1l+for,2)
if (for1l+for) = (aga + aga1l) then do
if pos("YES",awayg) > 0 then do
if for1l > aga then do
if h = 1 then
extra_line = " "strip(teams.sel)" win on Away goals."
else
extra_line = " "opponent" win on Away goals."
np = 1
end
if for1l < aga then do
if h = 1 then
extra_line = " "opponent" win on Away goals."
else
extra_line = " "strip(teams.sel)" win on Away goals."
np = 1
end
end
end
end
k = k + 1
if pos("#Score After Extra Time",matches.k) > 0 then do
for1 = strip(substr(matches.k,32,2))
aga1 = strip(substr(matches.k,37,2))
if h = 1 then do
sd = sd". AET: "right(for1,2)"-"left(aga1,2)" Agg: "right(for1l+for1,2)"-"left(aga1l+aga1,2)
goals_scr = goals_scr - for + for1
goals_con = goals_con - aga + aga1
end
else do
sd = sd". AET: "right(aga1,2)"-"left(for1,2)" Agg: "right(aga1l+aga1,2)"-"left(for1l+for1,2)
goals_scr = goals_scr - aga + aga1
goals_con = goals_con - for + for1
end
if (for1+for1l) = (aga1 + aga1l) then do
if pos("YES",awayg) > 0 then do
if for1 > aga then do
if h = 1 then
extra_line = " "strip(teams.sel)" win on Away goals,"
else
extra_line = " "opponent" win on Away goals,"
extra_line2= " "after Extra Time."
np = 2
end
if for1 < aga then do
if h = 1 then
extra_line = " "opponent" win on Away goals,"
else
extra_line = " "strip(teams.sel)" win on Away goals,"
extra_line2= " "after Extra Time."
np = 2
end
end
end
k = k + 1
if pos("#Penalties",matches.k) > 0 then do
for1 = strip(substr(matches.k,32,2))
aga1 = strip(substr(matches.k,37,2))
sd = sd||","
if h = 1 then
extra_line3 = " After Penalties: "right(for1,2)"-"left(aga1,2)
else
extra_line3 = " After Penalties: "right(aga1,2)"-"left(for1,2)
np = 3
end
end
else do
if pos("#Penalties",matches.k) > 0 then do
for1 = strip(substr(matches.k,32,2))
aga1 = strip(substr(matches.k,37,2))
if h = 1 then
sd = sd" After Penalties: "right(for1,2)"-"left(aga1,2)
else
sd = sd" After Penalties: "right(aga1,2)"-"left(for1,2)
end
end
end
if pos("2 Legs",name) = 0 then do
for = strip(substr(matches.j,32,2))
aga = strip(substr(matches.j,37,2))
if h = 1 then do
sd = right(for,2)"-"left(aga,2)
goals_scr = goals_scr + for
goals_con = goals_con + aga
opponent = strip(substr(matches.j,41,30))
end
else do
sd = right(aga,2)"-"left(for,2)
goals_scr = goals_scr + aga
goals_con = goals_con + for
opponent = strip(substr(matches.j,1,30))
end
g = j + 1
if pos("#Score After Extra Time",matches.g) > 0 then do
for1 = strip(substr(matches.g,32,2))
aga1 = strip(substr(matches.g,37,2))
if h = 1 then do
sd = sd" AET: "right(for1,2)"-"left(aga1,2)
goals_scr = goals_scr - for + for1
goals_con = goals_con - aga + aga1
end
else do
sd = sd" AET: "right(aga1,2)"-"left(for1,2)
goals_scr = goals_scr - aga + aga1
goals_con = goals_con - for + for1
end
g = g + 1
if pos("#Penalties",matches.g) > 0 then do
for1 = strip(substr(matches.g,32,2))
aga1 = strip(substr(matches.g,37,2))
if h = 1 then
sd = sd" After Penalties: "right(for1,2)"-"left(aga1,2)
else
sd = sd" After Penalties: "right(aga1,2)"-"left(for1,2)
end
end
else do
if pos("#Penalties",matches.g) > 0 then do
for1 = strip(substr(matches.g,32,2))
aga1 = strip(substr(matches.g,37,2))
if h = 1 then
sd = sd" After Penalties: "right(for1,2)"-"left(aga1,2)
else
sd = sd" After Penalties: "right(aga1,2)"-"left(for1,2)
end
end
end
say round""left(opponent,32)" "sd
if np > 0 then do
if np = 3 then say extra_line3
if np = 1 | np = 2 then say extra_line
if np = 2 then say extra_line2
np = 0
end
donem = 0
end
end
end
end
say
say
say
say "Goals Scored : "goals_scr
say "Goals Conceeded : "goals_con
say
say
say "-------------------------------------------------------------------------------"
exit
/*************************************************************************************/