Good evening everyone.
I am programming a module for an old version of PES for self-study purposes.
Placed below the complete content of the module currently being planned for your analysis:
===========================================================
local function stadium_id(ctx)
stadium = ctx.stadium
if string.len(stadium) == 1 then --st001
stid = "st00" .. stadium
elseif string.len(stadium) == 2 then
stid = "st0" .. stadium
elseif string.len(stadium) == 3 then
stid = "st" .. stadium
end
ad_cl = string.format("ad_%s_cl.fpk", stid) --ad_st001_cl.fpk
ad_uel = string.format("ad_%s_el.fpk", stid) --ad_st001_el.fpk
ad_sc = string.format("ad_%s_sc.fpk", stid) --ad_st001_sc.fpk
end
function rewrite(ctx, filename)
if ad_cl and ad_uel and ad_sc then
if ctx.home_team == 119 then -- Filename INTER
return string.gsub(filename, "ad_st%d%d%d_normal.fpk", ad_uel) --ad_st001_normal.fpk, ad_st001_el.fpk
elseif ctx.home_team == 121 then -- Filename MILAN
return string.gsub(filename, "ad_st%d%d%d_normal.fpk", ad_cl) --ad_st030_normal.fpk, ad_st030_cl.fpk
elseif ctx.home_team == 125 then -- Filename ROMA
return string.gsub(filename, "ad_st%d%d%d_normal.fpk", ad_cl) --ad_st006_normal.fpk, ad_st006_cl.fpk
else
return nil
end
end
end
local function get_filepath(ctx, filename, key)
if key then
if ctx.home_team == 119 then -- Home INTER
filepath = ctx.sider_dir .. ".\\modules\\EvoSwitcher\\EvoBanner\\Inter\\" .. filename
elseif ctx.home_team == 121 then -- Home MILAN
filepath = ctx.sider_dir .. ".\\modules\\EvoSwitcher\\EvoBanner\\Milan\\" .. filename
elseif ctx.home_team == 125 then -- Home ROMA
filepath = ctx.sider_dir .. ".\\modules\\EvoSwitcher\\EvoBanner\\Roma\\" .. filename
else
end
return filepath
end
end
function init(ctx)
ctx.register("livecpk_rewrite", rewrite)
ctx.register("after_set_conditions", stadium_id) -- Applica allo stadio
ctx.register("livecpk_get_filepath", get_filepath) -- Vai al percorso del files
end
return { init = init }
==========================================================
What I would like to do is assign a different file name to each stadium, while currently Roma and Milan both run with ad_sc.
With this programming it often happens to find a team with the modules of the other team and vice versa.
Where am I doing wrong?
Thank you in advance for your response..
FILIPPO
I am programming a module for an old version of PES for self-study purposes.
Placed below the complete content of the module currently being planned for your analysis:
===========================================================
local function stadium_id(ctx)
stadium = ctx.stadium
if string.len(stadium) == 1 then --st001
stid = "st00" .. stadium
elseif string.len(stadium) == 2 then
stid = "st0" .. stadium
elseif string.len(stadium) == 3 then
stid = "st" .. stadium
end
ad_cl = string.format("ad_%s_cl.fpk", stid) --ad_st001_cl.fpk
ad_uel = string.format("ad_%s_el.fpk", stid) --ad_st001_el.fpk
ad_sc = string.format("ad_%s_sc.fpk", stid) --ad_st001_sc.fpk
end
function rewrite(ctx, filename)
if ad_cl and ad_uel and ad_sc then
if ctx.home_team == 119 then -- Filename INTER
return string.gsub(filename, "ad_st%d%d%d_normal.fpk", ad_uel) --ad_st001_normal.fpk, ad_st001_el.fpk
elseif ctx.home_team == 121 then -- Filename MILAN
return string.gsub(filename, "ad_st%d%d%d_normal.fpk", ad_cl) --ad_st030_normal.fpk, ad_st030_cl.fpk
elseif ctx.home_team == 125 then -- Filename ROMA
return string.gsub(filename, "ad_st%d%d%d_normal.fpk", ad_cl) --ad_st006_normal.fpk, ad_st006_cl.fpk
else
return nil
end
end
end
local function get_filepath(ctx, filename, key)
if key then
if ctx.home_team == 119 then -- Home INTER
filepath = ctx.sider_dir .. ".\\modules\\EvoSwitcher\\EvoBanner\\Inter\\" .. filename
elseif ctx.home_team == 121 then -- Home MILAN
filepath = ctx.sider_dir .. ".\\modules\\EvoSwitcher\\EvoBanner\\Milan\\" .. filename
elseif ctx.home_team == 125 then -- Home ROMA
filepath = ctx.sider_dir .. ".\\modules\\EvoSwitcher\\EvoBanner\\Roma\\" .. filename
else
end
return filepath
end
end
function init(ctx)
ctx.register("livecpk_rewrite", rewrite)
ctx.register("after_set_conditions", stadium_id) -- Applica allo stadio
ctx.register("livecpk_get_filepath", get_filepath) -- Vai al percorso del files
end
return { init = init }
==========================================================
What I would like to do is assign a different file name to each stadium, while currently Roma and Milan both run with ad_sc.
With this programming it often happens to find a team with the modules of the other team and vice versa.
Where am I doing wrong?
Thank you in advance for your response..
FILIPPO