Module:GGST-FrameChart: Difference between revisions

From Dustloop Wiki
mNo edit summary
mNo edit summary
Line 3: Line 3:
local framechart = require( "Module:FrameChart" )
local framechart = require( "Module:FrameChart" )


function p.Main( frame )
function p.drawFrameData( frame )
   local chara = frame.args['chara']
   local chara = frame.args['chara']
   local input = frame.args['input']
   local input = frame.args['input']

Revision as of 21:42, 4 September 2022

Module:FrameChart-GGST is used to generate frame charts for characters in Guilty Gear: Strive semi-automatically.

It leverages Module:FrameChart under the hood, please see its documentation for further details.

Usage

Any page which uses the FrameChart module should include the template Template:FrameChartKey which explains each of the colored squares generated by the graph.

Creating the frame chart can be done by specifying the character and the input to use. For example:

{{#invoke:GGST-FrameChart|drawFrameData
|chara=May
|input=5P
}}

Results in a neat:

Total: 14

However, sometimes the frame data is not represented by simple numbers, and in those cases one needs to override them explicitly - see Module:FrameChart documentation on specifics.

For example, Sol's Volcanic Viper

chara input name startup active recovery
Sol Badguy 623S S Volcanic Viper 9 14 18+10 Landing

Naive version:

{{#invoke:GGST-FrameChart|drawFrameData
|chara=Sol Badguy
|input=623S
}}

The amount of recovery frames is not a simple string in cargo. Please specify explicitly when drawing the chart.

Fixed version:

{{#invoke:GGST-FrameChart|drawFrameData
|chara=Sol Badguy
|input=623S
|recovery=18
|specialRecovery=10
}}
Total: 50

local p = {}
local cargo = mw.ext.cargo
local framechart = require( "Module:FrameChart" )

function p.drawFrameData( frame )
  local chara = frame.args['chara']
  local input = frame.args['input']
  if chara == nil then
    chara = string.match(mw.title.getCurrentTitle().text, "/([^/]+)")
  end
  if chara == nil then 
    return '<span class="error">failed to determine chara. Please specify explicitly</span>'
  end
  if input == nil then
    return '<span class="error">input is not specified</span>'
  end
  -- query cargo for frame data first


  local cargo_tables = 'MoveData_GGST'
  local fields = 'startup,active,recovery'
  local cargo_args = {
    where = 'chara="' .. chara .. '" AND input="' .. input .. '"'
  }
  local framedata = cargo.query( cargo_tables , fields, cargo_args );
  if framedata[2] ~= nil then
    return '<span class="error">cargo returned more than one move for that query somehow... This is a bug..</span>'
  end
  local fd = framedata[1]
  if fd == nil then
    return '<span class="error">No results</span>'
  end
  mw.log(mw.dumpObject(fd))
  
  for _, frameKind in ipairs({"startup", "active", "recovery"}) do
    if frame.args[frameKind] == nil then
      frame.args[frameKind] = fd[frameKind]
      if tonumber(frame.args[frameKind]) == nil then
        return '<span class="error">The amount of ' .. frameKind .. " frames is not a simple string in cargo. Please specify explicitly when drawing the chart.</span>"
      end
    end
  end

  return framechart.drawFrameData(frame)
end

return p