KInquire XP

KInquire XP
v1.2.0

by Kyonides Arkanthes
​


Introduction

Detective:
"What have you been doing as of late?
I've been investigating some weird events that have been taking place in a small place called Kustom Town as of late.
Have you got any piece of valuable information, sir?
A contact, the name of any serial killer :killer: , a suspicious location, a piece of evidence. Anything, pretty much anything, might prove to be quite helpful at the end of the day."

"It seems that some suspicious character might have an accomplice out there..."

😅 All of the pictures required by my script should be placed in the Graphics/Pictures directory.

Screenshots

Spoiler: Two Snapshots
kinquire03.jpg

kinquire04.jpg

Basic Script Calls​

Open the Case Menu scene
$scene = KInquire::Scene.new

New Case
new_case(101, "Trickster Affair", "Kustom Town")

Case with specific Priority
new_case(101, "Trickster Affair", "Kustom Town", 😛 => 1)

Case with specific Status
new_case(101, "Trickster Affair", "Kustom Town", :s => :cold)


The Script

It is NOT the latest version avaiable...

Code:
# * KInquire XP
#   Scripter : Kyonides Arkanthes
#   2021-08-16 - v1.1.1

# The diary or encyclopedia or a detective's or inspector's notebook script!
# It exclusively relies on script calls to add new information to the book.

# The script also lets you set up a fake date system but it depends on script
# calls to make any progress. Hours, minutes and seconds are unavailable.

# Place all images in the Graphics/Pictures directory.

# * Script Calls * #

# - Open the Inquiry Scene
# $scene = KInquireScene.new

# Warning! case is one of Ruby's reserved words so I use kase instead.

# - Add a New Case
#   - CaseID: 1+
#   - Priority: 1 as Top Priority, 2+ not that important
#   - Statuses: nil, :cold, :closed, :sealed, :top_secret
#   - You can add one or both options.
# new_case(CaseID, "Case Name", "City Name")
#   - Case with specific Priority
# new_case(CaseID, "Case Name", "City Name", :p => Priority)
#   - Case with specific Status
# new_case(CaseID, "Case Name", "City Name", :s => Status)

# - Find a Case
# case_by_id(CaseID)
# case_by_name("Case Name")

# - Does a Case exist?
# case_id?(CaseID)
# case_name?("Case Name")

# - Get Last Created Case
# If any of these script calls fails, it means you never created it.
#   - Script Calls Only
# @case.some_script_call
#   - Script Calls & Script Modifications
# KInquire.last_case
# KInquire.this_case

# - Set or Reset a Target - Use it at least once!
# @case.target = "Trickster"

# - Set a Case's date
# @case.date = [Year, Month, Day]
# @case.year = Year
# @case.month = Month
# @case.day = Day
# @case.month_day(Month, Day)

# - Add new Page to a given Case
#   - First Find a Case using one of the available script calls
#     You can set an empty picture like this: ""
#     Threat Level: "Highest" as Top Priority
#     Relevance: "Low" or "Medium" or "High"
# @case.person("Name", Age, "Picture", ThreatLevel, Relevance)
# @case.place("Location", "Owner", "Picture", ThreatLevel, Relevance)
# @case.evidence("Something", "Owner", "Contact", "Pic.", TL, Relev.)
#   - After any of these 3 script calls use:
# @page.some_script_call

# - Set Lines of Data to a given Page - Use it at least once!
# @page.lines = [Line1, etc.]

# - Reset the Threat Level of a given Page
# @page.threat_level = "High"

# - Reset the Relevance of a given Page
# @page.relevance = "High"

# - Set Page Location
# @page.location = "Madison Avenue"

# - Set Page MapID
# @page.map_id = MapID

# - Check a given Case's status
# @case.open?
# @case.cold?
# @case.closed?
# @case.sealed?
# @case.top_secret?

# - Change a given Case's status
#   Statuses: nil, :cold, :closed, :sealed, :top_secret, :declass
# @page.status = some_status ## For Single Page
# @case.status = some_status ## For Entire Case
# @case.open!
# @case.cold!
# @case.close!
# @case.declassify!

# - Check if the current Case has got more than N pages
# @case.more_pages?(N)

# - Set Fake System Date
# $game_system.date = [Year, Month, Day]
# $game_system.year = Year
# $game_system.month = Month
# $game_system.day = Day
# $game_system.month_day(Month, Day)
# $game_system.next_day
# $game_system.next_week
# $game_system.next_month

# - Get Fake System Date Data
# $game_system.days
# $game_system.months
# $game_system.years

module KInquire
  DEFAULT_DATE = [257, 1, 2] # Format: Y, M, D
  START_DATE = [257, 1, 5] # Format: Y, M, D
  UNKNOWN = "Unknown"
  STATUSES = ["Open", "Cold", "Closed", "Sealed", "Top Secret"]
  DECLASSIFIED = "Declassified"
  module DateSetup
    MAX_DAYS = 30
    MAX_MONTHS = 12
  end

  module Heading
    BACKDROP = "heading"
    FONT_NAME = "Times New Roman"
    FONT_SIZE = 24
    FONT_BOLD = true
    FONT_SHADOW = true
    TITLE = "Cases"
    SELECT_LABEL = "Please select a category"
  end

  module FileManager
    CHARS_TO_REMOVE = 7
    FONT_NAME = "Times New Roman"
    FONT_SIZE = 21
    FONT_BOLD = false
    FONT_SHADOW = true
    SELECT_LABEL = "Please select a case"
  end

  module Files
    # Available Formats: "Y/M/D", "M/D/Y", "D/M/Y"
    DATE_FORMAT = "Y/M/D"
    TITLE_FONT_NAME = ""
    TITLE_FONT_SIZE = 22
    TITLE_FONT_BOLD = true
    TITLE_FONT_SHADOW = true
    TEXT_FONT_NAME = "Times New Roman"
    TEXT_FONT_SIZE = 21
    TEXT_FONT_BOLD = true
    TEXT_FONT_SHADOW = true
    PAGE_FONT_SIZE = 21
    PAGE_FONT_SHADOW = true
    HIDDEN_FONT_NAME = "Verdana"
    HIDDEN_FONT_SIZE = 24
    HIDDEN_FONT_BOLD = true
    HIDDEN_FONT_SHADOW = true
    NO_RECORD = "No record was found"
    CASE_NUMBER = "Case No."
    DATE = "Date"
    NAME = "Name"
    AGE = "Age"
    OWNER = "Owner"
    LOCATION = "Location"
    THREAT_LEVEL = "Threat Level"
    RELEVANCE = "Relevance"
    CITY = "City"
    CONTACT = "Contact"
    TARGET = "Target"
    STATUS = "Status"
    DESCRIPTION = "Description"
  end

  module DateMethods
    def month_day(nm, nd)
      @date.month = nm
      @date.day = nd
    end
    def year=(ny) @date.year = ny end
    def month=(nm) @date.month = nm end
    def day=(nd) @date.day = nd end
    def date=(ary) @date = KInquire::Date.new(ary) end
    def date() @date end
  end

  class Date
    include DateSetup
    def initialize(*data)
      data = data.flatten
      total = data.size
      if total < 3
        str = "Wrong number of arguments (found #{total}, expected 3)"
        raise ArgumentError, str
      end
      @year = data.shift
      @month = data.shift
      @day = data.shift
      @days = 0
    end

    def next_month(days=1)
      if days > 1
        left = MAX_DAYS - @day
        days -= left
      end
      if @month < MAX_MONTHS
        @month += 1
        @day = days
      else
        @year += 1
        @month = 1
        @day = days
      end
    end

    def next_day
      @days += 1
      @day < MAX_DAYS ? @day += 1 : next_month
    end

    def next_days(days)
      @days += days
      @day < MAX_DAYS ? @day += days : next_month(days)
    end

    def next_week
      @days += 7
      @day < MAX_DAYS ? @day += 7 : next_month(7)
    end
    def months() (@days / MAX_DAYS).round end
    def years() (@days / MAX_DAYS / MAX_MONTHS).round end
    attr_accessor :year, :month, :day, :days
  end

  class CasePage
    def initialize
      @name = UNKNOWN
      @age = 0
      @threat_level = nil
      @relevance = nil
      @location = UNKNOWN
      @map_id = 0
      @owner = UNKNOWN
      @contact = UNKNOWN
      @picture = ""
      @type = nil
      @status = nil
      @lines = []
    end
    def classified?() @status == :sealed or @status == :top_secret end
    def info?() @type == :info end
    def person?() @type == :person end
    def place?() @type == :location end
    def evidence?() @type == :evidence end
    attr_accessor :name, :age, :owner, :picture, :threat_level, :type, :lines
    attr_accessor :location, :map_id, :relevance, :contact, :status
  end

  class Case
    include DateMethods
    def initialize(cid, case_name=UNKNOWN, city_name=UNKNOWN)
      @id = cid
      @name = case_name
      @city = city_name
      @location = UNKNOWN
      @contact = UNKNOWN
      @target = UNKNOWN
      @priority = nil
      @pages = [CasePage.new]
      @pages[0].type = :info
      @status = nil
      @date = Date.new(DEFAULT_DATE)
    end

    def add_page(type, pic)
      @pages << page = CasePage.new
      page.picture = pic
      page.type = type
      page.status = @status
      page
    end

    def person(name, age, pic, threat_level, relevance)
      page = add_page(:person, pic)
      page.name = name
      page.age = age
      page.threat_level = threat_level
      page.relevance = relevance
      $game_system.map_interpreter.page = page
    end

    def place(location, owner, pic, threat_level, relevance)
      page = add_page(:location, pic)
      page.name = location
      page.owner = owner
      page.threat_level = threat_level
      page.relevance = relevance
      $game_system.map_interpreter.page = page
    end

    def evidence(thing, owner, contact, pic, threat_level, relevance)
      page = add_page(:evidence, pic)
      page.name = thing
      page.owner = owner
      page.contact = contact
      page.threat_level = threat_level
      page.relevance = relevance
      $game_system.map_interpreter.page = page
    end
    def more_pages?(n) @pages.size > n end
    def open?() @status == nil or @status == :declass end
    def cold?() @status == :cold end
    def closed?() @status == :closed end
    def sealed?() @status == :sealed end
    def top_secret?() @status == :top_secret end
    def declassified?() @status == :declass end
    def open!() @status = nil end
    def cold!() @status = :cold end
    def close!() @status = :closed end
    def declassify!() @status = :declass end
    attr_accessor :id, :name, :city, :location, :priority, :pages, :status
    attr_accessor :target, :contact
  end

  class Finding
    def initialize() @cases = [] end
    def <<(kase) @cases << kase end
    def case_id?(cid) @cases.select{|c| c.id == cid }.any? end
    def case_name?(name) @cases.select{|c| c.name == name }.any? end
    def case_by_id(cid) @cases.select{|c| c.id == cid }[0] end
    def case_by_name(name) @cases.select{|c| c.name == name }[0] end
    def case_names() @cases.map{|c| c.name } end
    def last_case() @last_case end
    attr_accessor :cases
  end
  extend self
  attr_accessor :last_case, :this_case
end

class Game_System
  include KInquire::DateMethods
  alias :kyon_inquiry_gm_sys_init :initialize
  def initialize
    kyon_inquiry_gm_sys_init
    @date = KInquire::Date.new(KInquire::START_DATE)
    @start_date = @date.dup
  end
  def next_day() @date.next_day end
  def next_days(n) @date.next_days(n) end
  def next_week() @date.next_week end
  def days() @date.days end
  def months() @date.months end
  def years() @date.years end
  attr_reader :start_date, :date
end

class Game_Party
  alias :kyon_inquiry_gm_pty_init :initialize
  def initialize
    kyon_inquiry_gm_pty_init
    @inquiry = KInquire::Finding.new
  end

  def case_id?(cid) @inquiry.case_id?(cid) end
  def case_name?(name) @inquiry.case_name?(name) end
  def case(name) KInquire.this_case = @inquiry.case_by_name(name) end
  def case_by_id(cid) KInquire.this_case = @inquiry.case_by_id(cid) end

  def new_case(cid, case_name, city_name, options={})
    cs = case_by_id(cid)
    return cs if cs
    cs = KInquire::Case.new(cid, case_name, city_name)
    @inquiry << cs
    cs.priority = options.delete(:p) || 10
    cs.status = options.delete(:s)
    KInquire.last_case = cs
  end
  attr_reader :inquiry
end

class Interpreter
  def new_case(cid, kase, city, options={})
    @case = $game_party.new_case(cid, kase, city, options)
  end
  def case_by_id(cid) @case = $game_party.case_by_id(cid) end
  def case_by_name(name) @case = $game_party.case(name) end
  def case_id?(cid) $game_party.case_id?(cid) end
  def case_name?(cid) $game_party.case_name?(cid) end
  attr_writer :page
end

class KInfoHeading
  include KInquire::Heading
  def initialize(hx, hy)
    @sprites = [Sprite.new, Sprite.new]
    @sprites.each do |s|
      s.x = hx
      s.y = hy
    end
    @sprites[0].bitmap = b = RPG::Cache.picture(BACKDROP).dup
    @cw = b.width
    @sprites[1].bitmap = Bitmap.new(@cw, b.height)
  end

  def set_text(text, align=0)
    b = @sprites[1].bitmap
    b.clear
    f = b.font
    f.name = FONT_NAME
    f.size = FONT_SIZE
    f.bold = FONT_BOLD
    if FONT_SHADOW
      f.color.set(0, 0, 0)
      b.draw_text(1, 4, @cw, FONT_SIZE, text, align)
      b.draw_text(1, 5, @cw, FONT_SIZE, text, align)
      f.color.set(255, 255, 255)
    end
    b.draw_text(0, 4, @cw, FONT_SIZE, text, align)
  end

  def dispose
    @sprites.each do |s|
      s.bitmap.dispose
      s.dispose
    end
    @sprites.clear
  end
end

class KCaseManWindow < Window_Selectable
  include KInquire::FileManager
  def initialize(wx, wy)
    super(wx, wy, 212, 480 - wy)
    @cw = width - 32
    @data = []
  end

  def open_list(type)
    cases = $game_party.inquiry.cases
    @cases = case type
    when 0 then cases.select{|c| c.open? }
    when 1 then cases.select{|c| c.cold? }
    when 2 then cases.select{|c| c.closed? }
    when 3 then cases.select{|c| c.sealed? }
    when 4 then cases.select{|c| c.top_secret? }
    end
    @item_max = @cases.size
    return if @cases.empty?
    @data = @cases.map{|c| c.name }
    activate
    refresh
  end

  def refresh
    return if @data.empty?
    self.contents.dispose if self.contents
    self.contents = Bitmap.new(@cw, row_max * 28)
    f = self.contents.font
    f.name = FONT_NAME
    f.size = FONT_SIZE
    f.bold = FONT_BOLD
    @item_max.times{|n| draw_item(n) }
  end

  def draw_item(pos)
    data = @data[pos]
    ts = data.size
    tw = contents.text_size(data).width
    data = data.slice(0..ts-CHARS_TO_REMOVE) + "..." if tw > @cw
    contents.draw_text(4, pos * 28 + 2, @cw, 24, data)
  end

  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 28, @cw, 28)
    end
  end

  def activate
    self.active = bool = !empty_list?
    self.index = 0 if bool
  end

  def deactivate
    self.index = -1
    self.active = false
  end
  def empty_list?() @item_max == 0 end
  def empty_pages?() @cases.empty? end
  def case() @cases[@index] end
end

class KInfoFileWindow < Window_Base
  include KInquire
  def initialize
    super(224, 0, 416, 480)
    @cw = width - 32
    @ch = height - 32
    @text_size = Files::TEXT_FONT_SIZE + 2
    self.contents = Bitmap.new(@cw, @ch)
    refresh_no_file(nil)
  end

  def draw_text_shadow(sx, sy, sw, size, text, align)
    c = contents
    c.font.color.set(0, 0, 0)
    c.draw_text(sx+1, sy, sw, size, text, align)
    c.draw_text(sx+1, sy+1, sw, size, text, align)
    c.font.color.set(255, 255, 255)
  end

  def refresh_no_file(kind)
    c = contents
    c.clear
    text = case kind
    when nil then Heading::SELECT_LABEL
    when :case then FileManager::SELECT_LABEL
    when :page then Files::NO_RECORD
    end
    tfs = Files::TITLE_FONT_SIZE
    if Files::TITLE_FONT_SHADOW
      draw_text_shadow(0, 0, @cw, tfs, text, 1)
    end
    c.draw_text(0, 0, @cw, tfs, text, 1)
  end

  def refresh
    c = contents
    c.clear
    tfs = Files::TITLE_FONT_SIZE
    if Files::TITLE_FONT_SHADOW
      draw_text_shadow(0, 0, @cw, tfs, @name, 1)
    end
    c.draw_text(0, 0, @cw, tfs, @name, 1)
    pages = @case.pages
    @page = pages[@index]
    @lines = @page.lines
    pos = (@index + 1).to_s + "/" + @total.to_s
    txfs = Files::TEXT_FONT_SIZE
    if @total == 0
      nothing = Files::NO_RECORD
      if Files::TEXT_FONT_SHADOW
        draw_text_shadow(0, 60, @cw, txfs, nothing, 1)
      end
      c.draw_text(0, 60, @cw, txfs, nothing, 1)
    end
    if @page.info?
      draw_info
    elsif @page.classified?
      draw_hidden
    elsif @page.person?
      draw_person
    elsif @page.place?
      draw_place
    elsif @page.evidence?
      draw_evidence
    end
    pfs = Files::PAGE_FONT_SIZE
    py = @ch - pfs
    if Files::PAGE_FONT_SHADOW
      draw_text_shadow(0, py, @cw, pfs, pos, 2)
    end
    c.draw_text(0, py, @cw, pfs, pos, 2)
  end

  def find_status
    labels = KInquire::STATUSES
    case @case.status
    when nil      then labels[0]
    when :declass then DECLASSIFIED
    when :cold    then labels[1]
    when :closed  then labels[2]
    when :sealed  then labels[3]
    when :top_secret then labels[4]
    end
  end

  def draw_date
    dt = @case.date
    case format = Files::DATE_FORMAT
    when /y\/m\/d/i
      date = sprintf("%02d/%02d/%02d", dt.year, dt.month, dt.day)
    when /m\/d\/y/i
      date = sprintf("%02d/%02d/%02d", dt.month, dt.day, dt.year)
    when /d\/m\/y/i
      date = sprintf("%02d/%02d/%02d", dt.day, dt.month, dt.year)
    end
    dx = 108 + contents.text_size(date).width
    contents.draw_text(100, 66, @cw, @text_size, date)
    contents.draw_text(dx, 66, @cw, @text_size, "(" + format.upcase + ")")
  end

  def draw_info
    c = self.contents
    draw_text_shadow(0, 40, @cw, @text_size, Files::CASE_NUMBER, 0)
    draw_text_shadow(0, 66, @cw, @text_size, Files::DATE, 0)
    draw_text_shadow(0, 92, @cw, @text_size, Files::STATUS, 0)
    draw_text_shadow(0, 120, @cw, @text_size, Files::TARGET, 0)
    draw_text_shadow(0, 148, @cw, @text_size, Files::CITY, 0)
    draw_text_shadow(0, 176, @cw, @text_size, Files::CONTACT, 0)
    c.font.color.set(220, 220, 20)
    c.draw_text(0, 40, @cw, @text_size, Files::CASE_NUMBER)
    c.draw_text(0, 66, @cw, @text_size, Files::DATE)
    c.draw_text(0, 92, @cw, @text_size, Files::STATUS)
    c.draw_text(0, 120, @cw, @text_size, Files::TARGET)
    c.draw_text(0, 148, @cw, @text_size, Files::CITY)
    c.draw_text(0, 176, @cw, @text_size, Files::CONTACT)
    c.font.color.set(255, 255, 255)
    c.draw_text(100, 40, @cw, @text_size, sprintf("%08d", @case.id))
    draw_date
    c.draw_text(100, 92, @cw, @text_size, find_status)
    c.draw_text(100, 120, @cw, @text_size, @case.target)
    c.draw_text(100, 148, @cw, @text_size, @case.city)
    c.draw_text(100, 176, @cw, @text_size, @case.contact)
  end

  def draw_hidden
    c = self.contents
    hfs = Files::HIDDEN_FONT_SIZE + 2
    draw_text_shadow(0, 140, @cw, hfs, Files::DATE, 1)
    c.draw_text(0, 140, @cw, hfs, Files::DATE)
  end

  def draw_picture
    src = RPG::Cache.picture(@page.picture)
    contents.blt(4, 32, src, src.rect)
    src.dispose
  end

  def draw_person
    c = self.contents
    if @page.picture.empty?
      pex = 0
    else
      pex = 116
      draw_picture
    end
    draw_text_shadow(pex, 32, @cw, @text_size, Files::NAME, 0)
    draw_text_shadow(pex, 88, @cw, @text_size, Files::AGE, 0)
    draw_text_shadow(pex + 72, 88, @cw, @text_size, Files::THREAT_LEVEL, 0)
    draw_text_shadow(4, 144, @cw, @text_size, Files::RELEVANCE, 0)
    draw_text_shadow(4, 172, @cw, @text_size, Files::DESCRIPTION, 0)
    c.font.color.set(220, 220, 20)
    c.draw_text(pex, 32, @cw, @text_size, Files::NAME)
    c.draw_text(pex, 88, @cw, @text_size, Files::AGE)
    c.draw_text(pex + 72, 88, @cw, @text_size, Files::THREAT_LEVEL)
    c.draw_text(4, 144, @cw, @text_size, Files::RELEVANCE)
    c.draw_text(4, 172, @cw, @text_size, Files::DESCRIPTION)
    c.font.color.set(255, 255, 255)
    c.draw_text(pex, 60, @cw, @text_size, @page.name)
    c.draw_text(pex + 8, 116, @cw, @text_size, @page.age.to_s)
    c.draw_text(pex + 80, 116, @cw, @text_size, @page.threat_level)
    c.draw_text(120, 144, @cw, @text_size, @page.threat_level)
    draw_lines(200, @text_size)
  end

  def draw_place
    c = self.contents
    if @page.picture.empty?
      pex = 0
    else
      pex = 156
      draw_picture
    end
    draw_text_shadow(pex, 54, @cw, @text_size, Files::LOCATION, 0)
    draw_text_shadow(pex, 82, @cw, @text_size, Files::OWNER, 0)
    draw_text_shadow(pex, 110, @cw, @text_size, Files::THREAT_LEVEL, 0)
    draw_text_shadow(pex, 138, @cw, @text_size, Files::RELEVANCE, 0)
    draw_text_shadow(4, 172, @cw, @text_size, Files::DESCRIPTION, 0)
    c.font.color.set(220, 220, 20)
    c.draw_text(pex, 54, @cw, @text_size, Files::LOCATION)
    c.draw_text(pex, 82, @cw, @text_size, Files::OWNER)
    c.draw_text(pex, 110, @cw, @text_size, Files::THREAT_LEVEL)
    c.draw_text(pex, 138, @cw, @text_size, Files::RELEVANCE)
    c.draw_text(4, 172, @cw, @text_size, Files::DESCRIPTION)
    c.font.color.set(255, 255, 255)
    c.draw_text(pex, 32, @cw, @text_size, @page.name)
    pex += 116
    c.draw_text(pex, 54, @cw, @text_size, @page.location)
    c.draw_text(pex, 82, @cw, @text_size, @page.owner)
    c.draw_text(pex, 110, @cw, @text_size, @page.threat_level)
    c.draw_text(pex, 138, @cw, @text_size, @page.relevance)
    draw_lines(198, @text_size)
  end

  def draw_evidence
    c = self.contents
    if @page.picture.empty?
      pex = 0
    else
      pex = 116
      draw_picture
    end
    draw_text_shadow(pex, 58, @cw, @text_size, Files::OWNER, 0)
    draw_text_shadow(pex, 86, @cw, @text_size, Files::CONTACT, 0)
    draw_text_shadow(pex, 114, @cw, @text_size, Files::RELEVANCE, 0)
    draw_text_shadow(4, 172, @cw, @text_size, Files::DESCRIPTION, 0)
    c.font.color.set(220, 220, 20)
    c.draw_text(pex, 58, @cw, @text_size, Files::OWNER)
    c.draw_text(pex, 86, @cw, @text_size, Files::CONTACT)
    c.draw_text(pex, 114, @cw, @text_size, Files::RELEVANCE)
    c.draw_text(4, 172, @cw, @text_size, Files::DESCRIPTION)
    c.font.color.set(255, 255, 255)
    c.draw_text(pex, 32, @cw, @text_size, @page.name)
    c.draw_text(pex + 104, 58, @cw, @text_size, @page.owner)
    c.draw_text(pex + 104, 86, @cw, @text_size, @page.contact)
    c.draw_text(pex + 104, 114, @cw, @text_size, @page.relevance)
    draw_lines(156 + @text_size * 2, @text_size)
  end
 
  def draw_lines(base_y, size)
    c = self.contents
    w = @cw - 24
    @lines.size.times do |n|
      c.draw_text(12, base_y + n * size - 2, w, size, @lines[n])
    end
  end

  def case=(kase)
    @case = kase
    @name = kase.name
    @total = @case.pages.size
    @index = 0
    refresh
  end

  def update
    if Input.trigger?(Input::LEFT)
      return $game_system.se_play($data_system.buzzer_se) if @total == 0
      $game_system.se_play($data_system.cursor_se)
      @index = (@index - 1) % @total
      refresh
      return
    elsif Input.trigger?(Input::RIGHT)
      return $game_system.se_play($data_system.buzzer_se) if @total == 0
      $game_system.se_play($data_system.cursor_se)
      @index = (@index + 1) % @total
      refresh
    end
  end
end

class KInquireScene
  include KInquire
  def main
    @stage = :main
    @command_window = Window_Command.new(212, STATUSES)
    @command_window.active = true
    @heading = KInfoHeading.new(0, 32 * 6)
    @heading.set_text(Heading::TITLE, 1)
    @case_window = KCaseManWindow.new(0, 32 * 7)
    @file_window = KInfoFileWindow.new
    Graphics.transition
    while @stage
      Graphics.update
      Input.update
      update
    end
    Graphics.freeze
    @file_window.dispose
    @case_window.dispose
    @heading.dispose
    @command_window.dispose
  end

  def update
    case @stage
    when :main
      update_main
    when :cases
      update_cases
    when :file
      update_file
    end
  end

  def update_main
    @command_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return @stage = nil
    elsif Input.trigger?(Input::C)
      @case_window.open_list(@command_window.index)
      if @case_window.empty_list?
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      @file_window.refresh_no_file(:case)
      @stage = :cases
    end
  end

  def update_cases
    @case_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return @stage = nil
    elsif Input.trigger?(Input::C)
      if @case_window.empty_list?
        return $game_system.se_play($data_system.buzzer_se)
      end
      $game_system.se_play($data_system.decision_se)
      @case_window.active = false
      @stage = :file
      if @case_window.empty_pages?
        @file_window.refresh_no_file(:page)
        return
      end
      @file_window.case = @case_window.case
    end
  end

  def update_file
    @file_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @file_window.refresh_no_file(:case)
      @case_window.active = true
      return @stage = :cases
    end
  end
end



Terms & Conditions

Free for use in non commercial games. Contact me if you need it for a commercial game instead.
Include me in your game credits!
Do not report my script anywhere else!
Version 1.1.0 is Available Now!​

It now features a fake system date. I have also shortened a few script calls for convenience.
Right, the GUI has been modified, like a lot I would have to admit. 😅

Spoiler: Snapshots
kinquire06.jpg
kinquire07.jpg
kinquire08.jpg
kinquire11.jpg
This looks really cool. The GUI looks a lot better now. 🙂
Version 1.1.1 Has Been Released!​

This version does not implement many new features but it fixes a couple of visual glitches found on any evidence page in the game. It also adds new convenient script calls.

Now every single case gotta have its own case number. This way you can search for it or check if it exists already. Since you rely on the script call box to define cases, I made the script automatically create @instance_variables like @ case (no space included or here it will think I'm mentioning some user called Case...) and @page that will let you continue setting them up on the following script call boxes.

Why doesn't my script allow you to create predefined cases?

Well, the reason is simple. The script is supposed to be quite dynamic from the very beginning. Thus I can let you change and save cases with ease and without altering the default save and load saved game methods. I guess it might also let you change the order of appearance of the cases depending on your eventing skills.

Good luck, game devs!
Detective Alex Can Now Set Wulfo as a Secondary Suspect!​

Spoiler: 5 Snapshots
kinquire15.jpg

kinquire16.jpg

kinquire17.jpg

kinquire18.jpg

kinquire19.jpg

I mean it, guys! 😀
Since version 1.2.0 detective Alex can now add more suspects to a given case.
In my demo I set Trickster the Purple Hood as the main suspect but now you can add Wulfo and his acquaintance as well. 😕
So its tricky story has been expanded as well! 😀

As an extra I have included my KMessage Kiwi script in my demo to make message windows look much better and quite complete.

Remember that the script call to open the Case Menu scene is the following:

Code:
$scene = KInquire::Scene.new

Original thread: https://forums.rpgmakerweb.com/threads/kinquire-xp.139573/