Read more about advertising your project here
[XP] Blacksmith-/Alchemy-Script

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 81
Hi!

After a long period of having nothing to do with RmXP because of new work and girlfriend I again began scripting :[hearty laughter]:
and started again working on my game  ;D

here I now present my Blacksmith-/Alchemy-Script! (It may be used either way you want it  ;) I enabled both in my game)

The scripts are now attached to this post. (Smithery and Alchemy are mostly the same but are written to use both in one game) an example of the tidloc.ini is also attached. This file has to be within the DAta-folder of your game.

Be sure to use my actual header: Header

Screens:
Spoiler for Screens:
When you craft with a recipe it will look like this:


When you craft without a recipe it will look like this:


When crafting without recipe this is the is the menu to choose ingredients:


Pre of my scripts (as i think)
  • to enter recipes just alter the tidloc.ini file in the data-folder
  • you don't have to switch between Database and script-Editor or Event to enter a new recipe. Instead you edit the ini-file with any external editor(i.e. notepad)!
  • absolutly no scripting knowledge needed to use this script, just add above main and it works
  • it is time needed to complete the crafting(depends on what you enter in the .ini)
  • crafting with or without recipe possible (how to make that is described in the top rows of the script)
  • when smithing/mixing without a recipe the script will choose which recipe is matching the best and starts the process, but you will not be able to know the outcome before it is finished. When no outcome fits it starts the 0 ID, described in the ini-file example
  • to enter the smithig/mixing-scene just use a script command with "$scene=Scene_Plan_Alch.new (*possible commands*)"
  • Recipes may only be available at specific smiths
  • Recipes may only work, if a specific switch is turned on and/or a specific variable has a specific minimum value
  • the structure of this script protects against cracked exe-files (with $DEBUG enabled) since the game gets errors for not having the ini in the data folder or trying to save to encrypted ^_^

Known Bugs:
  • you have to use a "wait: 1 frame"-command after the script-command, or the next command (if show text or simmilar) won't be shown. (I didn't find out how to surpass that...)

Sorry for the screens being in german, but since my game will be in german...

  Hope it helps ^^

Tidloc

Edit 101210: Newest Version online, some bugs solved and german/english standart vocabulary enabled.
« Last Edit: December 10, 2010, 06:48:30 PM by tidloc »
[...]And they feared him.
He understands that cruelty arises from opportunity![...]

**
Rep:
Level 81
Spoiler for obsolete 2nd script part...:
Code: [Select]
  def add(id, typ, wert)
    for i in 0...self.count
      if self._id[i]==id
        if    typ=="_Name"
          self._name[i]=wert
        elsif typ=="_Result"
          self._result[i]=wert
        elsif typ=="_Prop"
          self._probability[i]=wert
        elsif typ=="_Cost"
          self._cost[i]=wert
        elsif typ=="_Res1"
          self._res1[i]=wert
        elsif typ=="_Res2"
          self._res2[i]=wert
        elsif typ=="_Res3"
          self._res3[i]=wert
        elsif typ=="_Res4"
          self._res4[i]=wert
        elsif typ=="a1"
          self._amo1[i]=wert
        elsif typ=="a2"
          self._amo2[i]=wert
        elsif typ=="a3"
          self._amo3[i]=wert
        elsif typ=="a4"
          self._amo4[i]=wert
        elsif typ=="c1"
          self._cla1[i]=wert
        elsif typ=="c2"
          self._cla2[i]=wert
        elsif typ=="c3"
          self._cla3[i]=wert
        elsif typ=="c4"
          self._cla4[i]=wert
        elsif typ=="_Var"
          self._var[i]=wert
        elsif typ=="v2"
          self._var2[i]=wert
        elsif typ=="_Switch"
          self._switch[i]=wert
        elsif typ=="_Time"
          self._time[i]=wert
        elsif typ=="_Outcome"
          self._outcome[i]=wert
        elsif typ=="_ID"
          self._alch_id[i]=wert
        elsif typ=="_Text"
          self._text[i]=wert
        elsif typ=="_Text2"
          self._text2[i]=wert
        end
        return true
      end
    end
    return false
  end
  def ausgabe(id, typ)
    for i in 0...self.count
      if self._id[i]==id
        if    typ=="Name"
          return _name[i]
        elsif typ=="Result"
          return _result[i]
        elsif typ=="Prop"
          return _probability[i]
        elsif typ=="Cost"
          return _cost[i]
        elsif typ=="Res1"
          return _res1[i]
        elsif typ=="Res2"
          return _res2[i]
        elsif typ=="Res3"
          return _res3[i]
        elsif typ=="Res4"
          return _res4[i]
        elsif typ=="a1"
          return _amo1[i]
        elsif typ=="a2"
          return _amo2[i]
        elsif typ=="a3"
          return _amo3[i]
        elsif typ=="a4"
          return _amo4[i]
        elsif typ=="c1"
          return _cla1[i]
        elsif typ=="c2"
          return _cla2[i]
        elsif typ=="c3"
          return _cla3[i]
        elsif typ=="c4"
          return _cla4[i]
        elsif typ=="Var"
          return _var[i]
        elsif typ=="v2"
          return _var2[i]
        elsif typ=="Switch"
          return _switch[i]
        elsif typ=="Time"
          return _time[i]
        elsif typ=="Outcome"
          return _outcome[i]
        elsif typ=="ID"
          return _alch_id[i]
        elsif typ=="Text"
          return _text[i]
        elsif typ=="Text2"
          return _text2[i]
        elsif typ=="window"
          return [_name[i],_cost[i],_time[i],_res1[i],_amo1[i],_res2[i],_amo2[i],_res3[i],_amo3[i],_res4[i],_amo4[i],_cla1[i],_cla2[i],_cla3[i],_cla4[i],_text[i],_text2[i]]
        end
      end
    end
    return " "
  end
  def enough(id,cost,r1=0,a1=0,c1=0,r2=0,a2=0,c2=0,r3=0,a3=0,c3=0,r4=0,a4=0,c4=0,instanz=0)
    temp2=[]
    for i in 0...self.count
      if self._id[i]==id
        if(r2==0 || a2==0) && (_res2[i]==0 || _amo2[i]==0)
          if (r1==_res1[i] && a1>=_amo1[i] && c1>=_cla1[i]) && (cost<=0 || cost<$game_party.gold)
            return true
          else
            return false
          end
        elsif(r3==0 || a3==0) && (_res3[i]==0 || _amo3[i]==0)
          for a in 0..1
            if (r1==_res1[i] && a1>=_amo1[i] && c1>=_cla1[i]) && (r2==_res2[i] && a2>=_amo2[i] && c2>=_cla2[i]) && (cost<=0 || cost<$game_party.gold)
              return true
            else
              temp2=[r2,a2,c2,r1,a1,c1]
              r1=temp2[0]
              a1=temp2[1]
              c1=temp2[2]
              r2=temp2[3]
              a2=temp2[4]
              c2=temp2[5]
            end
          end
          return false
        elsif(r4==0 || a4==0) && (_res4[i]==0 || _amo4[i]==0)
          for a in 0..6
            if (r1==_res1[i] && a1>=_amo1[i] && c1>=_cla1[i]) && (r2==_res2[i] && a2>=_amo2[i] && c2>=_cla2[i]) && (r3==_res3[i] && a3>=_amo3[i] && c3>=_cla3[i]) && (cost<=0 || cost<$game_party.gold)
              return true
            else
              if a%2==1
                temp2=[r2,a2,c2,r1,a1,c1]
                r1=temp2[0]
                a1=temp2[1]
                c1=temp2[2]
                r2=temp2[3]
                a2=temp2[4]
                c2=temp2[5]
              else
                temp2=[r3,a3,c3,r1,a1,c1]
                r1=temp2[0]
                a1=temp2[1]
                c1=temp2[2]
                r3=temp2[3]
                a3=temp2[4]
                c3=temp2[5]
              end
            end
          end
          return false
        else
          for a in 1..24
            if (r1==_res1[i] && a1>=_amo1[i] && c1>=_cla1[i]) && (r2==_res2[i] && a2>=_amo2[i] && c2>=_cla2[i]) && (r3==_res3[i] && a3>=_amo3[i] && c3>=_cla3[i]) && (r4==_res4[i] && a4>=_amo4[i] && c4>=_cla4[i]) && (cost<=0 || cost<$game_party.gold)
              return true
            else
              if i%2==1
                temp2=[r2,a2,c2,r1,a1,c1]
                r1=temp2[0]
                a1=temp2[1]
                c1=temp2[2]
                r2=temp2[3]
                a2=temp2[4]
                c2=temp2[5]
              elsif i%4==2
                temp2=[r3,a3,c3,r1,a1,c1]
                r1=temp2[0]
                a1=temp2[1]
                c1=temp2[2]
                r3=temp2[3]
                a3=temp2[4]
                c3=temp2[5]
              else
                temp2=[r4,a4,c4,r3,a3,c3]
                r3=temp2[0]
                a3=temp2[1]
                c3=temp2[2]
                r4=temp2[3]
                a4=temp2[4]
                c4=temp2[5]
              end
            end
          end
          return false
        end
      end
    end
  end
  def outcome(cost=0,r1=0,a1=0,c1=0,r2=0,a2=0,c2=0,r3=0,a3=0,c3=0,r4=0,a4=0,c4=0,alch_num=0)
    over=100
    idid=0
    for i in 0...@count
      if(enough(_id[i],cost,r1,a1,c1,r2,a2,c2,r3,a3,c2,r4,a4,c4))
        if (r1==0 || a1==0) && (_alch_id[i] == 0 || _alch_id == alch_num)
          idid=_id[i]
          over=0
        else
          if (r2==0 || a2==0) && over > (a1-@_amo1[i]) && (_alch_id[i] == 0 || _alch_id == alch_num)
            idid=@_id[i]
            over=a1-@_amo1[i]
          else
            if (r3==0 || a3==0) && over > (a1 - self._amo1[i] + a2 - self._amo2[i]) && (_alch_id[i] == 0 || _alch_id == alch_num)
              idid=@_id[i]
              over=a1 - @_amo1[i] + a2 - @_amo2[i]
            else
              if (r4==0 || a4==0) && over>(a1-_amo1[i]+a2-_amo2+a3-_amo3[i]) && (_alch_id[i] == 0 || _alch_id == alch_num)
                idid=_id[i]
                over=a1-_amo1[i]+a2-_amo2[i]+a3-_amo3[i]
              else
                if over>(a1-_amo1[i]+a2-_amo2[i]+a3-_amo3[i]+a4-_amo4[i]) && (_alch_id[i] == 0 || _alch_id == alch_num)
                  idid=_id[i]
                  over=a1-_amo1[i]+a2-_amo2[i]+a3-_amo3[i]+a4-_amo4[i]
                end
              end
            end
          end
        end
      end
    end
    return idid
  end
  def canmake(id)
    for i in 0...self.count
      if self._id[i]==id
        if _switch[i] = 0 || $game_switches.[](_switch[i])
          if _var[i] == 0 || $game_variables.[](_var[i]) >= _var2[i]
            if _cost[i] == 0 || $game_party.gold >= _cost[i]
              if ($game_party.item_number(_res1[i]) >= _amo1[i] && _cla1[i]==0) || ($game_party.weapon_number(_res1[i]) >= _amo1[i] && _cla1[i]==1) || ($game_party.armor_number(_res1[i]) >= _amo1[i] && _cla1[i]==2) || _amo1[i]==0 || _res1[i]==0
                return true if _res2[i]==0 || _amo2[i] == 0
                if ($game_party.item_number(_res2[i]) >= _amo2[i] && _cla2[i]==0) || ($game_party.weapon_number(_res2[i]) >= _amo2[i] && _cla2[i]==1) || ($game_party.armor_number(_res2[i]) >= _amo2[i] && _cla2[i]==2) || _amo1[i]==0 || _res1[i]==0 || _amo2[i]==0 || _res2[i]==0
                  return true if _res3[i]==0 || _amo3[i] == 0
                  if ($game_party.item_number(_res3[i]) >= _amo3[i] && _cla3[i]==0) || ($game_party.weapon_number(_res3[i]) >= _amo3[i] && _cla3[i]==1) || ($game_party.armor_number(_res3[i]) >= _amo3[i] && _cla3[i]==2) || _amo1[i]==0 || _res1[i]==0 || _amo2[i]==0 || _res2[i]==0 || _amo3[i]==0 || _res3[i]==0
                    return true if _res4[i]==0 || _amo4[i] == 0
                    if ($game_party.item_number(_res4[i]) >= _amo4[i] && _cla4[i]==0) || ($game_party.weapon_number(_res4[i]) >= _amo4[i] && _cla4[i]==1) || ($game_party.armor_number(_res4[i]) >= _amo4[i] && _cla4[i]==2) || _amo1[i]==0 || _res1[i]==0 || _amo2[i]==0 || _res2[i]==0 || _amo3[i]==0 || _res3[i]==0 || _amo4[i]==0 || _res4[i]==0
                      return true
                    else
                      return false
                    end
                  else
                    return false
                  end
                else
                  return false
                end
              else
                return false
              end
            else
              return false
            end
          else
            return false
          end
        else
          return false
        end
      end
    end
    return false
  end
  def start_wo_scem(id,cost,r1,a1,c1,r2,a2,c2,r3,a3,c3,r4,a4,c4)
    for i in 0...self.count
      if self._id[i]==id
        $game_party.gain_gold(-cost)
        if r1>0 && a1>0
          if c1==0
            $game_party.gain_item(r1,-a1)
          elsif c1==1
            $game_party.gain_weapon(r1,-a1)
          else
            $game_party.gain_armor(r1,-a1)
          end
          if r2>0 && a2>0
            if c2==0
              $game_party.gain_item(r2,-a2)
            elsif c2==1
              $game_party.gain_weapon(r2,-a2)
            else
              $game_party.gain_armor(r2,-a2)
            end
            if r3>0 && a3>0
              if c3==0
                $game_party.gain_item(r3,-a3)
              elsif c3==1
                $game_party.gain_weapon(r3,-a3)
              else
                $game_party.gain_armor(r3,-a3)
              end
              if r4>0 && a4>0
                if c4==0
                  $game_party.gain_item(r4,-a4)
                elsif c4==1
                  $game_party.gain_weapon(r4,-a4)
                else
                  $game_party.gain_armor(r4,-a4)
                end
              end
            end
          end
        end
      end
    end
  end
  def start(id)
    for i in 0...self.count
      if self._id[i]==id
        if _cost[i]>0
          $game_party.gain_gold(-_cost[i])
        end
        if _res1[i]>0 && _amo1[i]>0
          if _cla1[i]==0
            $game_party.gain_item(_res1[i],-_amo1[i])
          elsif _cla1[i]==1
            $game_party.gain_weapon(_res1[i],-_amo1[i])
          else
            $game_party.gain_armor(_res1[i],-_amo1[i])
          end
          if _res2[i]>0 && _amo2[i]>0
            if _cla2[i]==0
              $game_party.gain_item(_res2[i],-_amo2[i])
            elsif _cla2[i]==1
              $game_party.gain_weapon(_res2[i],-_amo2[i])
            else
              $game_party.gain_armor(_res2[i],-_amo2[i])
            end
            if _res3[i]>0 && _amo3[i]>0
              if _cla3[i]==0
                $game_party.gain_item(_res3[i],-_amo3[i])
              elsif _cla3[i]==1
                $game_party.gain_weapon(_res3[i],-_amo3[i])
              else
                $game_party.gain_armor(_res3[i],-_amo3[i])
              end
              if _res4[i]>0 && _amo4[i]>0
                if _cla4[i]==0
                  $game_party.gain_item(_res4[i],-_amo4[i])
                elsif _cla4[i]==1
                  $game_party.gain_weapon(_res4[i],-_amo4[i])
                else
                  $game_party.gain_armor(_res4[i],-_amo4[i])
                end
              end
            end
          end
        end
      end
    end
  end
  def reward(id)
    for i in 0...self.count
      if self._id[i]==id
        if _outcome[i]==0
          $game_party.gain_item(_result[i],1)
        elsif _outcome[i]==1
          $game_party.gain_weapon(_result[i],1)
        else
          $game_party.gain_armor(_result[i],1)
        end
      end
    end
  end
end




class Scene_Plan_Alch
 
  attr_accessor :alch
  attr_accessor :daten
 
  def initialize(alch_num=0, version=0,version2=0)
    $game_system.menu_disabled = true
    @daten = []
    @alch  = ""
    @alch1 = []
    @alch2 = Alch.new
    @x=0
    @y=0
    @z=0
    @temp=0
    @temp2=0
    @text=""
    @alch_num=alch_num
    @version=version
    @version2=version2
  end
 
  def main
    $game_temp_tidloc_alch.alch_script = 1
   
    if $DEBUG
      @alch = ""
      File.open('Data\tidloc.ini','r') do |f1|
        while line=f1.gets
          @alch += line
        end
      end
      temp=@alch.index('{Alchemy}')
      for z in 0..(temp+8)
        @alch[z]=" "
      end
      @x=0
      @y=0
      @z=0
      @alch=@alch.lstrip
      @alch1=@alch
      @alch1=@alch1.scan(/\w+/)
      while @alch1[0]!='endAlchemy'
        @y=@alch1.shift
        if(@y[0].chr=='n')
          @y[0] = ' '
          @y.lstrip
          @y = -(@y.to_i)
        else
          @y = @y.to_i
        end
        @alch2.init(@y)
        if @y==0
          @alch2.add(@y,"Res1",1)
        end
        @text+=@y.to_s
        a=0
        while @alch1[0]!='end'
          a+=1
          @temp=@alch1.shift
          if @temp=='_Name'
            @alch2.add(@y,@temp,@alch1.shift)
            while @alch1[0]!="_Result" && @alch1[0]!="_Prop" && @alch1[0]!="_Cost" && @alch1[0]!="_Res1" && @alch1[0]!="_Res2" && @alch1[0]!="_Res3" && @alch1[0]!="_Res4" && @alch1[0]!="_Outcome" && @alch1[0]!="_Time" && @alch1[0]!="end" && @alch1[0]!="_ID" && @alch1[0]!="_Var" && @alch1[0]!="_Switch" && @alch1[0]!="_Text" && @alch1[0]!="_Text2"
              @alch2.add(@y,@temp,@alch2.ausgabe(@y,"Name") + " " + @alch1.shift)
            end
          elsif @temp=='_Text'
            @alch2.add(@y,@temp,@alch1.shift)
            while @alch1[0]!="_Result" && @alch1[0]!="_Prop" && @alch1[0]!="_Cost" && @alch1[0]!="_Res1" && @alch1[0]!="_Res2" && @alch1[0]!="_Res3" && @alch1[0]!="_Res4" && @alch1[0]!="_Outcome" && @alch1[0]!="_Time" && @alch1[0]!="end" && @alch1[0]!="_ID" && @alch1[0]!="_Var" && @alch1[0]!="_Switch" && @alch1[0]!="_Name" && @alch1[0]!="_Text2"
              @alch2.add(@y,@temp,@alch2.ausgabe(@y,"Text") + " " + @alch1.shift)
            end
          elsif @temp=='_Text2'
            @alch2.add(@y,@temp,@alch1.shift)
            while @alch1[0]!="_Result" && @alch1[0]!="_Prop" && @alch1[0]!="_Cost" && @alch1[0]!="_Res1" && @alch1[0]!="_Res2" && @alch1[0]!="_Res3" && @alch1[0]!="_Res4" && @alch1[0]!="_Outcome" && @alch1[0]!="_Time" && @alch1[0]!="end" && @alch1[0]!="_ID" && @alch1[0]!="_Var" && @alch1[0]!="_Switch" && @alch1[0]!="_Name" && @alch1[0]!="_Text"
              @alch2.add(@y,@temp,@alch2.ausgabe(@y,"Text2") + " " + @alch1.shift)
            end
          elsif @temp=='_Result'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
          elsif @temp=='_Prop'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
          elsif @temp=='_Cost'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
          elsif @temp=='_Res1'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
            @alch2.add(@y,"c1",@alch1.shift.to_i)
            @alch2.add(@y,"a1",@alch1.shift.to_i)
          elsif @temp=='_Res2'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
            @alch2.add(@y,"c2",@alch1.shift.to_i)
            @alch2.add(@y,"a2",@alch1.shift.to_i)
          elsif @temp=='_Res3'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
            @alch2.add(@y,"c3",@alch1.shift.to_i)
            @alch2.add(@y,"a3",@alch1.shift.to_i)
          elsif @temp=='_Res4'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
            @alch2.add(@y,"c4",@alch1.shift.to_i)
            @alch2.add(@y,"a4",@alch1.shift.to_i)
          elsif @temp=='_Outcome'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
          elsif @temp=='_Var'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
            @alch2.add(@y,"v2",@alch1.shift.to_i)
          elsif @temp=='_Switch'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
          elsif @temp=='_ID'
            @alch2.add(@y,@temp,@alch1.shift.to_i)
          elsif @temp=='_Time'
            if ((@alch1[0])[0]).chr=='p'
              (@alch1[0])[0]=' '
              @alch1[0].lstrip
              @alch2.add(@y,@temp,-(@alch1.shift.to_i))
            else
              @alch2.add(@y,@temp,@alch1.shift.to_i)
            end
          end
        end
        @alch1.shift
      end
      save_data(@alch2,"Data\\tidloc_alch.rxdata")
    else
      @alch2 = load_data("Data\\tidloc_alch.rxdata")
    end
     
    @help_window = Window_Help.new
    kommando = []
    if @version==0 || @version==1
      kommando.push "Mix after recipe"
    end
    if @version==0 || @version==2
      kommando.push "Mix without recipe"
    end
    kommando.push "Stop mixing"
    @message_window = Window_Message.new
    @command_window = Window_Command.new(250, kommando, 0, 1)
    @command_window.y     = 64
    if $game_temp_tidloc_alch.alch_busy[@alch_num] == 1
      @command_window.disable_item(0)
      @command_window.disable_item(1)
    end
    @require_window = Window_Require.new
    @require_window.y     = 64
    @require_window.x     = 250
    @require_window.width = 390
    @require_window.need_refresh = true
    if @version != 1
      @itemwahl_window = Window_Alch_choose.new
      @itemwahl_window.active  = false
      @itemwahl_window.visible = false
     
      @foralch_window = Window_Require2.new
      @foralch_window.y     = 64
      @foralch_window.x     = 320
      @foralch_window.width = 320
      @foralch_window.active  = false
      @foralch_window.visible = false
    end
    @gold_window = Window_Require3.new
    @gold_window.active  = false
    @gold_window.visible = false
    @itemwahl=[]
    @itemname=[]
    @itempass=[]
    a=0
    @text=""
    for i in 0...@alch2.count
      if @alch2._id[i] > 0
        if $game_party.item_number(@alch2._id[i])>0
          @itemwahl.push @alch2._id[i]
          @itemname.push @alch2._name[i]
          @itempass.push @alch2.canmake(@alch2._id[i])
          a+=1
        end
      end
    end
    @item_window = Window_Command2.new(250, @itemname)
    @item_window.y = 225
    @item_window.active = false
    @item_window.index = -1
    @item_window._usable = @itempass
    @item_window.refresh
   
    Graphics.transition
    if $game_temp_tidloc_alch.alch_busy[@alch_num]==1 && $game_temp_tidloc_alch.alch_time[@alch_num] == 0
      @command_window.active = false
      $game_temp_tidloc_alch.alch_busy[@alch_num] = 0
      temp = rand(100)
      if temp > @alch2.ausgabe(i,"Prop").to_i
        $game_temp_tidloc_alch.alch_id[@alch_num] = 0
      end
      @alch2.reward($game_temp_tidloc_alch.alch_id[@alch_num])
      text=@alch2.ausgabe($game_temp_tidloc_alch.alch_id[@alch_num],"Name")
      $game_temp.message_proc = Proc.new { @message_waiting = false;$scene = Scene_Map.new }
      @message_waiting = true
      if $game_temp_tidloc_alch.alch_id[@alch_num] != 0
        $game_temp.message_text = "The Alchemist has finished your request!\nYou receive: "+text+"!"
      else
        $game_temp.message_text = "Unfortunately the Alchemist wasn't successful\nYou receive: "+text+"..."
      end
    end
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @help_window.dispose
    @require_window.dispose
    @item_window.dispose
    @message_window.dispose
    if @version != 1
      @itemwahl_window.dispose
      @foralch_window.dispose
    end
    $game_system.menu_disabled = false
  end
 
  def update
    if @item_window.active
      if @require_window.need_refresh
        @require_window.newvalues(@alch2.ausgabe(@itemwahl[@item_window.index],"window"))
        @require_window.refresh
      end
    end
    if @command_window.active && $game_temp_tidloc_alch.alch_busy[@alch_num] == 1
      temp=@alch2.ausgabe($game_temp_tidloc_alch.alch_id[@alch_num],"window")
      temp[2]=$game_temp_tidloc_alch.alch_time[@alch_num]
      if $game_temp_tidloc_alch.alch_scem[@alch_num] ==0
        temp[0]=" "
      end
      @require_window.newvalues(temp)
      @require_window.refresh if @require_window.need_refresh
    end
    if @itemwahl_window.active || @foralch_window.active
      @itemwahl_window.update
      if @foralch_window.need_update
        @foralch_window.refresh
        @itemwahl_window.refresh
      end
    else
      @command_window.update
      @require_window.update
      @item_window.update
      @message_window.update
    end
    @help_window.update
    @gold_window.update
    if @gold_window.active
      update_gold
      return
    end
    if @command_window.active
      update_command
      return
    end
    if @item_window.active
      update_item
      return
    end
    if @itemwahl_window.active
      @help_window.set_text(@itemwahl_window.update_help)
      update_itemwahl
      return
    end
    if @foralch_window.active
      update_foralch
    end
  end
 
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if  @version==0
        case @command_window.index
        when 0
          if $game_temp_tidloc_alch.alch_busy[@alch_num] == 1
            $game_system.se_play($data_system.cancel_se)
          elsif @item_window.item_max < 1
            $game_system.se_play($data_system.cancel_se)
          else
            $game_system.se_play($data_system.decision_se)
            @item_window.active      = true
            @item_window.index       = 0
            @command_window.active   = false
          end
        when 1
          if $game_temp_tidloc_alch.alch_busy[@alch_num] == 1
            $game_system.se_play($data_system.cancel_se)
          else
            if @version2 != 1
              $game_system.se_play($data_system.decision_se)
              @gold_window._gold   = 0
              @gold_window.visible = true
              @gold_window.active  = true
              @command_window.active = false
              @command_window.active   = false
              @command_window.visible  = false
              @item_window.visible     = false
              @require_window.visible  = false
              return
            end
            if @version2 == 1
              $game_system.se_play($data_system.decision_se)
              $game_temp_tidloc_alch.alch_choose_cost = 0
              @itemwahl_window.visible = true
              @itemwahl_window.active  = true
              @foralch_window.visible = true
              @item_window.index       = 0
              @command_window.active   = false
              @command_window.visible  = false
              @item_window.visible     = false
              @require_window.visible  = false
              return
            end
          end
        when 2 
          $game_system.se_play($data_system.cancel_se)
          $scene = Scene_Map.new
        end
      elsif @version==1
        case @command_window.index
        when 0
          if $game_temp_tidloc_alch.alch_busy[@alch_num] == 1
            $game_system.se_play($data_system.cancel_se)
          elsif @item_window.item_max<1
            $game_system.se_play($data_system.cancel_se)
          else
            $game_system.se_play($data_system.decision_se)
            @item_window.active = true
            @item_window.index = 0
            @command_window.active = false
          end
        when 1 
          $game_system.se_play($data_system.cancel_se)
          $scene = Scene_Map.new
        end
      elsif @version==2
        case @command_window.index
        when 0
          if $game_temp_tidloc_alch.alch_busy[@alch_num] == 1
            $game_system.se_play($data_system.cancel_se)
          else
            if @version2 != 1
              $game_system.se_play($data_system.decision_se)
              @gold_window._gold   = 0
              @gold_window.visible = true
              @gold_window.active  = true
              @command_window.active = false
              @command_window.active   = false
              @command_window.visible  = false
              @item_window.visible     = false
              @require_window.visible  = false
              return
            end
            if @version2 == 1
              $game_system.se_play($data_system.decision_se)
              @itemwahl_window.visible = true
              @itemwahl_window.active  = true
              @foralch_window.visible = true
              @item_window.index       = 0
              @command_window.active   = false
              @command_window.visible  = false
              @item_window.visible     = false
              @require_window.visible  = false
              return
            end
          end
        when 1 
          $game_system.se_play($data_system.cancel_se)
          $scene = Scene_Map.new
        end
      end
      return
    end
  end
 
  def update_item
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @require_window.newvalues()
      @require_window.refresh
      @command_window.active = true
      @item_window.active = false
      @item_window.index = -1
      return
    end
    if Input.trigger?(Input::C)
      if(@alch2.canmake(@itemwahl[@item_window.index]))
        $game_system.se_play($data_system.decision_se)
        a=@itemwahl[@item_window.index]
        @alch2.start(@itemwahl[@item_window.index])
        if @alch2._time[@itemwahl[@item_window.index]] == 0
          @alch2.reward(@itemwahl[@item_window.index])
        else
          $game_temp_tidloc_alch.alch_busy[@alch_num] = 1
          $game_temp_tidloc_alch.alch_time[@alch_num] = @alch2.ausgabe(@itemwahl[@item_window.index],"Time")
          $game_temp_tidloc_alch.alch_id[@alch_num]   = @itemwahl[@item_window.index]
          $game_temp_tidloc_alch.alch_scem[@alch_num] = 1
          @command_window.disable_item(0)
          @command_window.disable_item(1)
        end
        @require_window.newvalues()
        @require_window.refresh
        @command_window.active = true
        @item_window.active = false
        @item_window.index = -1
        return
      else
        $game_system.se_play($data_system.cancel_se)
      end
    elsif Input.repeat?(Input::UP)
      @require_window.need_refresh = true
    elsif Input.repeat?(Input::DOWN)
      @require_window.need_refresh = true
    end
  end
 
  def update_itemwahl
   
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $game_temp_tidloc_alch.alch_empty
      @foralch_window.refresh
      @itemwahl_window.refresh
      @command_window.active   = true
      @command_window.visible  = true
      @item_window.visible     = true
      @require_window.visible  = true
      @itemwahl_window.active  = false
      @itemwahl_window.visible = false
      @foralch_window.active  = false
      @foralch_window.visible = false
      return
    elsif Input.trigger?(Input::C)
      case @itemwahl_window.item
      when RPG::Item
        cla = 0
      when RPG::Weapon
        cla = 1
      when RPG::Armor
        cla = 2
      end
      if $game_temp_tidloc_alch.add_alchemy_item(@itemwahl_window.item.id,1,cla)
        $game_system.se_play($data_system.decision_se)
        @foralch_window.need_update = true
      else
        $game_system.se_play($data_system.cancel_se)
      end
      return
    elsif Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      if @itemwahl_window.active
        @itemwahl_window.active = false
        @foralch_window.active = true
        @foralch_window.add_text = "ready to mix?"
        @foralch_window.need_update = true
      else
        @itemwahl_window.active = true
        @foralch_window.active = false
        @foralch_window.add_text = " "
        @foralch_window.need_update = true
      end
    elsif Input.repeat?(Input::LEFT)
      if @itemwahl_window.active
        @itemwahl_window.active = false
        @foralch_window.active = true
        @foralch_window.add_text = "ready to mix?"
        @foralch_window.need_update = true
      else
        @itemwahl_window.active = true
        @foralch_window.active = false
        @foralch_window.add_text = " "
        @foralch_window.need_update = true
      end
    end
  end
  def update_foralch
    if Input.trigger?(Input::B)
      $game_temp_tidloc_alch.alch_empty
      @foralch_window.refresh
      @itemwahl_window.refresh
      @command_window.active   = true
      @command_window.visible  = true
      @item_window.visible     = true
      @require_window.visible  = true
      @itemwahl_window.active  = false
      @itemwahl_window.visible = false
      @foralch_window.active  = false
      @foralch_window.visible = false
      return
    elsif Input.trigger?(Input::C)
      if $game_temp_tidloc_alch.alch_choose_item[0] != 0
        temp=@alch2.outcome($game_temp_tidloc_alch.alch_choose_cost,$game_temp_tidloc_alch.alch_choose_item[0],$game_temp_tidloc_alch.alch_choose_number[0],$game_temp_tidloc_alch.alch_choose_class[0],$game_temp_tidloc_alch.alch_choose_item[1],$game_temp_tidloc_alch.alch_choose_number[1],$game_temp_tidloc_alch.alch_choose_class[1],$game_temp_tidloc_alch.alch_choose_item[2],$game_temp_tidloc_alch.alch_choose_number[2],$game_temp_tidloc_alch.alch_choose_class[2],$game_temp_tidloc_alch.alch_choose_item[3],$game_temp_tidloc_alch.alch_choose_number[3],$game_temp_tidloc_alch.alch_choose_class[3],@alch_num)
        @alch2.start_wo_scem(temp,$game_temp_tidloc_alch.alch_choose_cost,$game_temp_tidloc_alch.alch_choose_item[0],$game_temp_tidloc_alch.alch_choose_number[0],$game_temp_tidloc_alch.alch_choose_class[0],$game_temp_tidloc_alch.alch_choose_item[1],$game_temp_tidloc_alch.alch_choose_number[1],$game_temp_tidloc_alch.alch_choose_class[1],$game_temp_tidloc_alch.alch_choose_item[2],$game_temp_tidloc_alch.alch_choose_number[2],$game_temp_tidloc_alch.alch_choose_class[2],$game_temp_tidloc_alch.alch_choose_item[3],$game_temp_tidloc_alch.alch_choose_number[3],$game_temp_tidloc_alch.alch_choose_class[3])
        $game_temp_tidloc_alch.alch_busy[@alch_num] = 1
        $game_temp_tidloc_alch.alch_time[@alch_num] = @alch2.ausgabe(temp,"Time")
        $game_temp_tidloc_alch.alch_id[@alch_num]   = temp
        $game_temp_tidloc_alch.alch_scem[@alch_num] = 0
        $game_temp_tidloc_alch.alch_empty
        @command_window.active   = true
        @command_window.visible  = true
        @item_window.visible     = true
        @require_window.visible  = true
        @itemwahl_window.active  = false
        @itemwahl_window.visible = false
        @foralch_window.active  = false
        @foralch_window.visible = false
      end
      return
    elsif Input.repeat?(Input::RIGHT)
      $game_system.se_play($data_system.cursor_se)
      if @itemwahl_window.active
        @itemwahl_window.active = false
        @foralch_window.active = true
        @foralch_window.add_text = "ready to mix?"
        @foralch_window.need_update = true
      else
        @itemwahl_window.active = true
        @foralch_window.active = false
        @foralch_window.add_text = " "
        @foralch_window.need_update = true
      end
    elsif Input.repeat?(Input::LEFT)
      if @itemwahl_window.active
        @itemwahl_window.active = false
        @foralch_window.active = true
        @foralch_window.add_text = "ready to mix?"
        @foralch_window.need_update = true
      else
        @itemwahl_window.active = true
        @foralch_window.active = false
        @foralch_window.add_text = " "
        @foralch_window.need_update = true
      end
    end
  end
  def update_gold
    @gold_window.refresh
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @gold_window._gold   = 0
      @command_window.active = true
      @gold_window.visible = false
      @gold_window.active  = false
    elsif Input.trigger?(Input::C)
      if @version2 == 0
        $game_system.se_play($data_system.decision_se)
        $game_temp_tidloc_alch.alch_choose_cost  = @gold_window._gold
        @gold_window._gold           = 0
        @itemwahl_window.visible     = true
        @itemwahl_window.active      = true
        @foralch_window.visible      = true
        @item_window.index           = 0
        @gold_window.visible         = false
        @gold_window.active          = false
        @command_window.visible      = false
        @item_window.visible         = false
        @require_window.visible      = false
        return
      else
        temp=@alch2.outcome($game_temp_tidloc_alch.alch_choose_cost,$game_temp_tidloc_alch.alch_choose_item[0],$game_temp_tidloc_alch.alch_choose_number[0],$game_temp_tidloc_alch.alch_choose_class[0],$game_temp_tidloc_alch.alch_choose_item[1],$game_temp_tidloc_alch.alch_choose_number[1],$game_temp_tidloc_alch.alch_choose_class[1],$game_temp_tidloc_alch.alch_choose_item[2],$game_temp_tidloc_alch.alch_choose_number[2],$game_temp_tidloc_alch.alch_choose_class[2],$game_temp_tidloc_alch.alch_choose_item[3],$game_temp_tidloc_alch.alch_choose_number[3],$game_temp_tidloc_alch.alch_choose_class[3],@alch_num)
        @alch2.start_wo_scem(temp,$game_temp_tidloc_alch.alch_choose_cost,$game_temp_tidloc_alch.alch_choose_item[0],$game_temp_tidloc_alch.alch_choose_number[0],$game_temp_tidloc_alch.alch_choose_class[0],$game_temp_tidloc_alch.alch_choose_item[1],$game_temp_tidloc_alch.alch_choose_number[1],$game_temp_tidloc_alch.alch_choose_class[1],$game_temp_tidloc_alch.alch_choose_item[2],$game_temp_tidloc_alch.alch_choose_number[2],$game_temp_tidloc_alch.alch_choose_class[2],$game_temp_tidloc_alch.alch_choose_item[3],$game_temp_tidloc_alch.alch_choose_number[3],$game_temp_tidloc_alch.alch_choose_class[3])
        $game_temp_tidloc_alch.alch_busy[@alch_num] = 1
        $game_temp_tidloc_alch.alch_time[@alch_num] = @alch2.ausgabe(temp,"Time")
        $game_temp_tidloc_alch.alch_id[@alch_num]   = temp
        $game_temp_tidloc_alch.alch_scem[@alch_num] = 0
        $game_temp_tidloc_alch.alch_empty
        @command_window.active   = true
        @command_window.visible  = true
        @item_window.visible     = true
        @require_window.visible  = true
        @gold_window.visible     = false
        @gold_window.active      = false
        return
      end
    elsif Input.repeat?(Input::RIGHT)
      @gold_window._gold += 1
    elsif Input.repeat?(Input::LEFT)
      @gold_window._gold -= 1
    elsif Input.repeat?(Input::UP)
      @gold_window._gold += 100
    elsif Input.repeat?(Input::DOWN)
      @gold_window._gold -= 100
    end
    if @gold_window._gold < 0
      @gold_window._gold  = 0
      return
    elsif @gold_window._gold > $game_party.gold
      @gold_window._gold  = $game_party.gold
      return
    end
  end
end

please don't use this anymore. instead use the attachments of my first post.
« Last Edit: July 25, 2010, 01:42:54 PM by tidloc »
[...]And they feared him.
He understands that cruelty arises from opportunity![...]

*
Rep:
Level 96
2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member2010 Best RPG Maker User (Scripting)2010 Best Use Of Avatar And Signature Space
Sorry for not noticing this before. It looks nice!

**
Rep:
Level 81
*obsolete post, since I gathered everything in my first post* ;-)
« Last Edit: July 25, 2010, 01:51:19 PM by tidloc »
[...]And they feared him.
He understands that cruelty arises from opportunity![...]

**
Rep:
Level 82
Mama told you not to make that uu-uu noise...
o.e I got an error right when I stuck it in.

#------------------------------------------------------------------------------#
#   special smith IDs should only be used with no-scematic-recipes or else     #
#   people will wonder why different recipes won't work, or you simply         #
#   write a hint into the item description ;-)                                 #
################################################################################
{Alchemy}     <------------THIS LINE
 

   _Name    = Copper
   _Outcome = 0
   _Time    = 81
   _Result    = 19
  [end]


Um..I'm not a scripty person, so if you could help..?
I'm a moron e.e

(syntax error on line 69..or something)
« Last Edit: September 15, 2009, 12:39:25 AM by gurevich42 »

**
Rep:
Level 81
Detective Scrotes
o.e I got an error right when I stuck it in.

#------------------------------------------------------------------------------#
#   special smith IDs should only be used with no-scematic-recipes or else     #
#   people will wonder why different recipes won't work, or you simply         #
#   write a hint into the item description ;-)                                 #
################################################################################
{Alchemy}     <------------THIS LINE
 

   _Name    = Copper
   _Outcome = 0
   _Time    = 81
   _Result    = 19
  [end]


Um..I'm not a scripty person, so if you could help..?
I'm a moron e.e

(syntax error on line 69..or something)
Did you put that in as a script in RMXP? Because from reading his post it seems as though that is an ini file. Try pasting that code into notepad and saving it as tidloc.ini (make you you don't save it as a text file) and delete that code from RMXP.

**
Rep:
Level 81
yeah, Albertfish is right ^^

it's supposed to be the "tidloc.ini", a file within the data-folder!  ;D

Just edited my post before to clear that out  ;)
« Last Edit: September 15, 2009, 08:52:26 AM by tidloc »
[...]And they feared him.
He understands that cruelty arises from opportunity![...]

**
Rep: +0/-0Level 80
So, just to be sure: I understand it at all three code snippets as being part of the same .ini file. If this is so, does that mean that there is no need to enter any code in the Script Editor. Sry for asking what is probably a redundant question, but im new to using scripts...
The things we do for pizza!

**
Rep:
Level 81
So, just to be sure: I understand it at all three code snippets as being part of the same .ini file. If this is so, does that mean that there is no need to enter any code in the Script Editor. Sry for asking what is probably a redundant question, but im new to using scripts...

Nope, the first two posts are the script you have to paste above main. (Both in one script or you will get error ;D)
The third is an additional Script, you may paste it in the same as the first two.
Only the fourth is the ini-file, which you have to alter for your own desires and must be in the data folder. ;)

Edited the first posts to clear that (hopefully) out too ^^
« Last Edit: April 06, 2010, 10:23:48 PM by tidloc »
[...]And they feared him.
He understands that cruelty arises from opportunity![...]

**
Rep: +0/-0Level 80
thx, that cleared up alot. I only have one problem though, when i run the game I get the error code:

Script line 241: TypeError occured.
no implicit conversion from nil to integer

I have to admit, this is a wierd error, that line is:
if klein == 0
      self.contents.font.size = $defaultfontsize
I changed it to
if klein == 0
      self.content.font.size = 20

that fixed the error code, but now I dont get text on my start screen or my menu, regular text field is fine though. wierd!
The things we do for pizza!

**
Rep:
Level 81
maybe you're using VX?
because in VX $defaultfontsize is named something different.
I wrote it under XP, so for VX some adjustments have to be made. ;)

Besides the default font size is 22 or 24, i think, but that shouldn't be that important just to use this script....
« Last Edit: September 16, 2009, 09:23:19 AM by tidloc »
[...]And they feared him.
He understands that cruelty arises from opportunity![...]

**
Rep: +0/-0Level 80
No, I'm using XP. Like I said, this is a wird error, not sure what to make of it. But I'm new to scripts so it's probably something I did wrong, no biggie though. Although I am confused on one part, how do I acces the script, that is call it for use?
The things we do for pizza!

**
Rep:
Level 81
yeah, really wierd... ???
You mean to change the scene to the crafting-scene?
Within an event use call script command and paste
Code: [Select]
$scene=Scene_Plan_Alch.new (*possible commands*)
where the possible commands are mentioned in the first lines of the script.
« Last Edit: April 11, 2010, 06:54:36 PM by tidloc »
[...]And they feared him.
He understands that cruelty arises from opportunity![...]

**
Rep:
Level 82
Mama told you not to make that uu-uu noise...
ehm *cough*
As I said before, I'm not very knowledgeable in this subject.
Thank you. :]

**
Rep: +0/-0Level 80
Yay! i fixed it! Apparently, having text disappear when you apply scripts is a common thing.

Open the scripts and go to MAIN. Find this line:

Code:
$scene = Scene_ ... .new
and just before that line add:

Code:
Font.default_name = $fontface = $defaultfonttype = "Tahoma"
Font.default_size = $fontsize = $defaultfontsize = 22

this fixed the problem for me...
The things we do for pizza!

**
Rep: +0/-0Level 80
I did end up with another issue though, When using $Scene=Scene_Plan_Alchemy.new, my game crashes. I get the error:
Uninitialized constant Interpreter::Scene_Plan_Alchemy

is there another way to run the script? I also used the #scene=.......new(0,0,0) though im not sure if thats how it was supposed to work.
« Last Edit: September 20, 2009, 09:25:35 PM by eps5000 »
The things we do for pizza!

**
Rep:
Level 81
And  that without me changing ever fontname or -soze...

When reading your second post, i felt, something was wierd, after some minutes i found it:
Scene_Plan_Alch :D
I changed it above too ;)
[...]And they feared him.
He understands that cruelty arises from opportunity![...]

*
Rep: +0/-0Level 80
I cannot get it to work.  I got the .ini file by saving the text as alchemy.ini  ,  I put both beginning script into the game, saving them above main, and I have an error.  Says this:

Script 'Alchemy' (the script i named, that is, the script for the blacksmith/alchemist) line 241 : TypeError occurred

no implicit conversion from nil to interger.

EDIT:

I have fixed it partially ; i get to the load your game screen.
I load my game and it breaks on line 50
or I start a new game and a NameError occurred while running script.  unitialized constant interpreter :: Screen_Plan_Alchemy      {When I talk to my guy with the script event}

EDIT:

I have fixed it by changing my script event caller from alchemy to alch.

My only remaining problem is that I cannot actually talk to my script activator.  Also minor error about KGSerpentine background, but fixed by making it auto choice of background.
« Last Edit: November 07, 2009, 12:04:43 PM by devex3 »