Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Could someone [Review] my script and give me feedback?

Seto

Member

[EDIT] Below is the original post, I just though I should add the most recent script version up here so that people do not read through the old version and offer feedback based on it, rather then the more current version. I will keep updating this version every time I post now. Thanks

Code:
 

#-------------------------------------------------------------------------------

# * Farming Script

#-------------------------------------------------------------------------------

#The "Order" data is entered below is as follows, for plant 1 you add its information

#seperatly into the arrays, e.g. the first position of each array here is an example

#

# @plants_times = [plant one's growing time, plant two's growing time, plant three's growing time]

# @plants_exp = [plant one's exp, plant two's exp, plant three's exp

# Continue filling in the data like this, so all the data in the "first" slot of these varibles 

# belongs to the "first" plant and so on.

# There is an explaination about what each varible is next to it so you know what information to enter

# This farming system runs off real time, checking the computers data and time

# and uses this to calculate when a plant has grown to the next stage.

# There are four stages for each plant, seedling, sprout, bud and bloom (Bloom is fully grown)

#-------------------------------------------------------------------------------

 

 

class Farming

 

  

  attr_accessor :plants_times, :plants_exp, :plants_water

  attr_accessor :plants_itemid, :plants_herbid, :plants_stages

  attr_accessor :plants_list, :plants_graphics, :plants_column

  attr_accessor :plot_ID, :event_ID, :seeds_page

  

 

  def initialize

#Plant Arrays and Information (Found this easier then multidementional arrays or other methods.)

  #In Minuets, the amount of time it takes the plant to gorw through each stage. 

  #To find the full length of time the plant takes to grow times your minuets by 3

  @plants_times = [2, 3, 1, 5] 

  # The amount of exp gained from growing the plant

  @plants_exp = [3, 3.5, 0.01, 6]

  #Number of times plant needs to be watered each stage

  @plants_water = [1, 2, 3, 3] 

  #The item id of the seed

  @plants_itemid = [1, 2, 3, 4]

  #The item id of the produced plant

  @plants_herbid = [5, 6, 7, 8]

  #Do not change this

  @plants_stages = [2, 4, 6, 8] 

  #If you do not set the following names will be generated by the names of the item produced.

  @plants_list = [] #Add in the "names" of the plants in order. Put them in "" and adding a commar after each one

  #If nothing is set here the graphics for you plants will be set to their names e.g. "plants_name.png"

  @plants_graphics = [] #If setting the graphics files yourself put them here in order

  #If you did not set custom graphics do no set this

  @plants_column = [] #If setting custom graphic files select the colum of the plant here, 0 = first column, 1 = second column, ect...

  #For calling Famring Scene

  @plot_ID

  @event_ID

  #Needed for Scene_Farming

  @seeds_page = 0

end

 

#Basic Plant Array Structure (No longer needed at this time)

  @basic_plant = ["Growth Time", "Exp", "Water Needed", "Seed ID", "Herb ID", "Graphics", "Column"]

#Basic Plot Array Structure (So that I know where the information I need is stored when using "$game_farming_plots")

  @basic_plot = ["Plant Type", "Growth State", "Water Level", "Time Planted", "Event ID", "Map ID"]

#Set Number of plots to use (Change this to the number of plots used in the game)

  @number_of_plots = 1

#Create Arrary for multidentionalisim (I am pretty sure thats a made up word *Chuckels*)

  $game_farming_plots

 

#Allows Data to be Accessed

$game_farming = Farming.new

 

 

 

 

  def self.setup

    #Checks how long each array should be (I didn't set this in stone so I could add or take features e.g. watering)

    l = @basic_plot.length

    #Checks how many plots are needed

    n = @number_of_plots

    #Ceates the multidementional Array

    $game_farming_plots = Tools.mda(n, l)

    #If the user has not set a list of plant names, the names are compiled from the end items names.

    if @plants_list == nil

    i = 0

    while i < @plants_itemid.length

      id = @plants_itemid[i].to_i

      @plants_list[i] = $data_items[id].name

      i = i + 1

    end

  end

    #If the user has not set a list of plant names, the names are compiled from the end items names.

    if @plants_graphics == nil

    z = 0

    while z < @plants_list.length

      @plants_graphics[z] = @gplants_list[z].to_s

      z = z + 1

    end

  end

    #Loops runs to convent the users input from seconds into minuets

    t = 0

    while t < @plants_times.length

      @plants_times[t] = @plants_times[t].to_i * 60

      t = t + 1

    end

  end

 

 

  def self.plant(itemID)

  #PlotID is the plot number assigned to the event, itemID is the item planted's number

  #eventID is so that the plot and event as bound and change be changed together

  #Gets the event's ID

  eventID = @event_ID

  #Gets the plot's ID

  plotID = @plot_ID

  #Sets the index i to 0

  i = 0

  #Gets the plants id number by comparing the item id using i as the index

  while i < @plants_itemid.length

    #checks if the itemID given matches the item id at i in $game_farming_itemid

    if itemID == @gplants_itemid[i]

      #if the item id matches sets the varible plantID to the plants id

      plantID = i

      #Sets i to the length of #game_farming_plants_itemid so to finish the when loop

      i = @plants_itemid.length

    end

    #if the item id's did not match adds 1 to i and checks the next value fot a match

    i = i + 1

  end

    #Sets time to the current time, including day and year.

    time = Time.now

    mapID = $game_map.map_id

    #sets the selected plot to the selected plant (Stage to 0, water level to 0, and time plant needs, which event the plot is)

    $game_farming_plots[plotID] = plantID, 0, 0, time, eventID, mapID

    #Changes the event to the next page ready to turn into a plant

    $game_self_switches[[mapID, eventID, "A"]] = true

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

    #Change the plots image to a seedling after checking if the player as set custom graphics

    if @plants_graphics == nil

    $game_map.events[eventID].character_name = @plants_list[plantID]

    #First column from the left facing up (Defult settings)

    $game_map.events[eventID].subgraphic!(0, 2)

  else

    #If the player as set up their own graphics use them instead

    $game_map.events[eventID].character_name = @plants_graphics[plantID]

    #Set the graphic to the plant selected by the user and set to seedling (2)

    $game_map.events[eventID].subgraphic!(@plants_column[plantID], 2)

  end

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

end

 

 

 

  def self.check(plotID)

    #Sets up all the data that may be needed for the method so it does not need to be set by seperate sections

    #Sets the plots event ID

    eventID = $game_farming_plots[plotID][4]

    #Checks which map the plot is on

    mapID = $game_farming_plots[plotID][5]

    #Set growth to the time the plant takes to grow each stage

    plantID = $game_farming_plots[plotID][0]

    #Set start to time of planting

    start = $game_farming_plots[plotID][3]

    growth = @plants_times[plantID]

    #to find when the next stage is complete

    finish = start + growth

    #Set time to current time

    time = Time.now

    if time >= finish

      #Set plant to the plant type

      plantID = $game_farming_plots[plotID][0]

      #Check what stage the plot it up to

      stage = $game_farming_plot[plotID][1]

      #Checks if the plants has been watered enough to advance

      if $game_farming_plots[plotID][2] >= @plants_water[plantID]

        #Adds one to the plots/plants stage

        $game_farming_plots[plotID][1] += 1

        #Resets the plants water level

        $game_farming_plots[plotID][2] -= 1

        #refresh map so that the changes are shown

      case stage

      when 1

        #Sets the plots graphic to that of the next stage

        $game_map.events[eventID].subgraphic! (@plants_column[plantID], 4)

        #refresh the map so that the changes are shown

        $game_map.need_refresh = true

      when 2

         #Sets the plots graphic to that of the next stage

        $game_map.events[eventID].subgraphic! (@plants_column[plantID], 6)

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      when 3

        #Sets the plots graphic to that of the next stage

        $game_map.events[eventID].subgraphic! (@plants_column[plantID], 8)

        #change self switch d on for the plot

        $game_self_switches[[mapID, eventID, "B"]] = true

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      end

      end

    end

  end

 

  def self.harvest(plotID)

    #Get plant ID

    plantID = $game_farming_plot[plotID][0]

    #Get Map ID

    mapID = $game_farming_plot[plotID][5]

    #Gets the exp for growing such plant

    exp = @game_farming_plants_exp[plantID]

    #add the exp to the skill farming (I created a skillbook to keep record of exp and levels and to display this information to the user)

    #When the exp is added skillbook also checks if a level should be awarded and that kind of thing

    Skillbook.addexp("farming", exp)

    #Resets the plots switches ready for replanting

    $game_self_switches[[mapID, eventID, "A"]] = false

    $game_self_switches[[mapID, eventID, "B"]] = false

    $game_self_switches[[mapID, eventID, "C"]] = false

    $game_self_switches[[mapID, eventID, "D"]] = false

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

    #clears the plots data ready for reuse and so that it can not cause any issues (Just in case really)

    $game_farming_plots[plotID].clear

    #sets the item to gain

    item = @game_farming_plants_items[plantID]

    #adds the item nessacry

    $game_party.gain_item(item, 1)

    #Sets V6 to the name of the plant recived so that it can be displayed to the player in the textbox

    $game_variables[6] = @game_plants_list[plantID]

  end

 

end

 


Hello everyone,

Basically I would like someone to look over my script that I am writing and give me feedback on how things should and shouldn't be done, if I have done things in the right manner that kind of thing. This is the first time I have ever attempted to write an actual script, ever! And I don't know a scripting language either, just some basics I have picked up while reading over others scripts or editing scripts with little tweaks. And I have done a little course with basic Java which helped a lot. The whole thing was written yesterday, for start to the point it is now. Zarieb (I hope thats spelt right) helped me with the following which I added this morning. But that was just a few line so I don't count it as working on it, when I already knew where they where to go.
1) Changing the self switches
Code:
$game_self_switches[[$game_map.map_id, eventID, "A"]] = false
2) Changing the graphic of the event
Code:
#Change the plots image to a seedling

    $game_map.events[eventID].character_name = 'Grid Seeds'

    #First column from the left facing up

    $game_map.events[eventID].subgraphic!(0,8)
3) Gave me this so that step two works correctly
Code:
class Game_Character

  attr_writer :character_name

 

  def subgraphic!(pattern, direction)

    # Pattern

    @original_pattern = pattern

    @pattern = pattern

    # Direction

    @original_direction = direction

    @direction = direction

  end

end

When I run the game I receive syntax error for 1 or 2 (Above) only when its inside my script though, what am I doing wrong? Thanks to anyone who can help with that.

About the script, its designed to be a farming script.
1) player plants a seed in the plot (Not complete but that will be another script anyway, Window to check the seeds and call the plant function once a seed is seleced)
2) when the player plants the seed "plant" is called from the script below to set the plot up and record what was planted that kind of thing.
3) "check" is called every so often by a parallel event to check if the plants have matured to the next stage
3.5) because the event checking is parallel and not the event itself the player can interact with the plot so it can be watered. Adding to the water level (Not fully implemented into the script yet)
4) if they are ready changes the plant/plot to the next image and to the next page of the event.
5) once the plant/plot is ready to harvest the player clicks on it and "Harvest" is run to collect the plant (This is not finished yet because I don't know what the script is to add an item, but I have it setup pretty close and ready to simply insert it.

Here is the script
Code:
 

class Farming

  

#Plant Arrays and Information (Found this easier then multidementional arrays or other methods.)

  $game_farming_plants_list = ["Golden Wattle", "Orange Fungi", "Anthers", "Rosmary"]

  $game_farming_plants_times = [2, 3, 5, 5]

  $game_farming_plants_stageone = ["Golden Wattle", "Orange Fungi", "Grid Flowers", "Random"]

  $game_farming_plants_stagetwo = ["Golden Wattle", "Orange Fungi", "Grid Flowers 2", "Random"]

  $game_farming_plants_stagethree = ["Golden Wattle", "Orange Fungi", "Grid Flowers 3", "Random"]

  $game_farming_plants_exp = [3, 3.5, 0.1, 6]

  $game_farming_plants_water = [1, 2, 3, 3]

  $game_farming_plants_itemid = [1, 2, 3, 4]

#Basic Plant Array Structure (No longer needed at this time)

  $game_farming_plant_basic_plant = ["Growth Time", "Stage One", "Stage Two", "Stage Three", "Exp", "Water Needed"]

#Basic Plot Array Structure (So that I know where the information I need is stored when using "$game_farming_plots")

  $game_farming_basic_plot = ["Plant Type", "Growth State", "Water Level", "Time Planted", "Time Ready", "Event ID]

#Set Number of plots to use (Change this to the number of plots used in the game)

  $game_farming_number_of_plots = 1

#Create Arrary for multidentionalisim (I am pretty sure thats a made up word lol!)

  $game_farming_plots

  

  def self.setup

    #Checks how long each array should be (I didn't set this in stone so I could add or take features e.g. watering)

    l = $game_farming_basic_plot.length

    #Checks how many plots are needed

    n = $game_farming_number_of_plots

    #Ceates the multidementional Array

    $game_farming_plots = Tools.mda(n, l)

  end

  

      #(PlotID is the plot number assigned to the event, plantID is the planted chosen to grow (Number form to information can be pulled from the array), 

      #eventID is so that the plot and event as bound and change be changed together without having to request which event to change)

  def self.plant(plotID, plantID, eventID) 

    #Sets the time the plot was planted V1 is hours, V2 is minuets

    #Becuase V2 is in the format "00" / by 100 then adding to V1 gives us the format "00.00"

    time = $game_variables[1].to_i + $game_variables[2].to_i / 100

    #sets the selected plot to the selected plant (Stage to 1, water level to 0, and time plant needs, which event the plot is)

    $game_farming_plots[plotID] = [$game_farming_plants_list[PlantID], 1, 0, time, $game_farming_plant_times[plantID], eventID]

    #Change the plots image to a seedling

    $game_map.events[eventID].character_name = 'Grid Seeds'

    #First column from the left facing up

    $game_map.events[eventID].subgraphic!(0,8)

  end

  

 

  def self.check(plotID)

    #Sets the plots event ID

    eventID = $game_farming_plots[plotID][5]

    #Set start to time of planting

    start = $game_farming_plots[plotID][3]

    #Set growth to the time the plant takes to grow each stage

    growth = $game_farming_plots[plotID][4]

    #to find when the next stage is complete

    finish = start + growth

    #Set time to current time

    time = $game_variables[1].to_i + $game_variables[2].to_i / 100

    #Subtract time now from the plant is ready if the stage is complete

    if (finish - time) == 0

      #Set p to the plant type

      plant = $game_farming_plots[plotID][0]

      #Check what stage the plot it up to

      stage = $game_farming_plot[plotID][1]

      if stage == 1

        picture = $game_farming_plants_stageone[plant]

        #Change events pictue to that stored in picture

        $game_map.events[eventID].character_name = picture.to_s

        #Takes the plot to the next stage

        $game_farming_plots[plotID][1] += 1

        #change self switch b on for the plot

        $game_self_switches[[$game_map.map_id, eventID, "B"]] = true

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      end

      if stage == 2

        picture = $game_farming_plants_stagetwo[plant]

        #Change events pictue to that stored in picture

        $game_map.events[eventID].character_name = picture.to_s

        #Takes the plot to the next stage

        $game_farming_plots[plotID][1] += 1

        #change self switch c on for the plot

        $game_self_switches[[$game_map.map_id, eventID, "C"]] = true

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      end

      if stage == 3

        picture = $game_farming_plants_stagethree[plant]

        #Change events pictue to that stored in picture

        $game_map.events[eventID].character_name = picture.to_s

        #Takes the plot to the next stage

        $game_farming_plots[plotID][1] += 1

        #change self switch d on for the plot

        $game_self_switches[[$game_map.map_id, eventID, "D"]] = true

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      end

    end

  end

  

  def self.harvest(plotID)

    #Get plant ID

    plant = $game_farming_plot[0]

    #Gets the exp for growing such plant

    exp = $game_farming_plants_exp[plant]

    #add the exp to the skill farming (I created a skillbook to keep record of exp and levels and to display this information to the user)

    #When the exp is added skillbook also checks if a level should be awarded and that kind of thing

    Skillbook.addexp("farrming", exp)

    #Resets the plots switches ready for replanting

    $game_self_switches[[$game_map.map_id, eventID, "A"]] = false

    $game_self_switches[[$game_map.map_id, eventID, "B"]] = false

    $game_self_switches[[$game_map.map_id, eventID, "C"]] = false

    $game_self_switches[[$game_map.map_id, eventID, "D"]] = false

    #clears the plots data ready for reuse and so that it can not cause any issues (Just in case really)

    $game_farming_plots[plotID].clear

    #sets the item to gain

    item = $game_farming_plants_items[plant]

    #adds the item nessacry

    #$game_items[item].add (I don't know how to do it, but i figured that would show what I planned)

    #Sets V6 to the name of the plant recived so that it can be displayed to the player in the textbox

    $game_variables[6] = $game_plants_list[plant]

  end

  

    

    

end

    

 

I am not very good with the commenting or anything script related for that matter. Any help or feedback is appreciated. However being mean or calling me stupid for how badly the script has turned out isn't nice :P.

Also I apologize if this post is in the wrong section.

If you need any more information after reading my commenting please ask, and I will do my best. Thanks everyone!

EDIT
If possible, could someone please test this script for syntax errors? Above when I said the codes that I were given results in syntax errors that doesn't seem to be true. After I added more comments those lines of code have moved down, but I still receive syntax errors on line "34" and "63" which are now comments and not even coding. Would anyone have any idea why this is happening? I have tried copying the script to a new project and have the same result. Could it just be my computer? Thanks again for any help offered
 

Seto

Member

I would really like some kind of feed back, anything? Anyone? I always thought people liked reviewing scripts lol. Its been over 72 hours so it's ok for me to bump this correct? I have just been waiting for a reply because on my computer i just get syntax errors on comment lines and I can't fix it. So before I can continue I need someone else to tell me if it works for them? I'm sorry to bother everyone like this. Did I do something wrong in the above post? Was it to confusing and that's why no-one has replied?
 
The main problem, you were missing a quotation mark at the end of line 16. This broke everything that had quotes further down. Just fixing that got rid of the syntax errors.
For some other suggestions:

You should use a case statement instead of your multiple if statements in self.check(plotID). Unless there's a reason they're if statements? You didn't use any elsif's, which is odd. :eek:
I don't think you intended to misspell "farming" in (Skillbook.addexp("farrming", exp))
I don't know the best way to go about it, since I don't know how you intend to use this script, but I would suggest not using RM's built-in switches/variables for scripts.

The changes I made:
[rgss] 
class Farming
 
#Plant Arrays and Information (Found this easier then multidementional arrays or other methods.)
  $game_farming_plants_list = ["Golden Wattle", "Orange Fungi", "Anthers", "Rosmary"]
  $game_farming_plants_times = [2, 3, 5, 5]
  $game_farming_plants_stageone = ["Golden Wattle", "Orange Fungi", "Grid Flowers", "Random"]
  $game_farming_plants_stagetwo = ["Golden Wattle", "Orange Fungi", "Grid Flowers 2", "Random"]
  $game_farming_plants_stagethree = ["Golden Wattle", "Orange Fungi", "Grid Flowers 3", "Random"]
  $game_farming_plants_exp = [3, 3.5, 0.1, 6]
  $game_farming_plants_water = [1, 2, 3, 3]
  $game_farming_plants_itemid = [1, 2, 3, 4]
#Basic Plant Array Structure (No longer needed at this time)
  $game_farming_plant_basic_plant = ["Growth Time", "Stage One", "Stage Two", "Stage Three", "Exp", "Water Needed"]
#Basic Plot Array Structure (So that I know where the information I need is stored when using "$game_farming_plots")
  $game_farming_basic_plot = ["Plant Type", "Growth State", "Water Level", "Time Planted", "Time Ready", "Event ID"]
#Set Number of plots to use (Change this to the number of plots used in the game)
  $game_farming_number_of_plots = 1
#Create Arrary for multidentionalisim (I am pretty sure thats a made up word lol!)
  $game_farming_plots
 
  def self.setup
    #Checks how long each array should be (I didn't set this in stone so I could add or take features e.g. watering)
    l = $game_farming_basic_plot.length
    #Checks how many plots are needed
    n = $game_farming_number_of_plots
    #Ceates the multidementional Array
    $game_farming_plots = Tools.mda(n, l)
  end
 
      #(PlotID is the plot number assigned to the event, plantID is the planted chosen to grow (Number form to information can be pulled from the array),
      #eventID is so that the plot and event as bound and change be changed together without having to request which event to change)
  def self.plant(plotID, plantID, eventID)
    #Sets the time the plot was planted V1 is hours, V2 is minuets
    #Becuase V2 is in the format "00" / by 100 then adding to V1 gives us the format "00.00"
    time = $game_variables[1].to_i + $game_variables[2].to_i / 100
    #sets the selected plot to the selected plant (Stage to 1, water level to 0, and time plant needs, which event the plot is)
    $game_farming_plots[plotID] = [$game_farming_plants_list[PlantID], 1, 0, time, $game_farming_plant_times[plantID], eventID]
    #Change the plots image to a seedling
    $game_map.events[eventID].character_name = 'Grid Seeds'
    #First column from the left facing up
    $game_map.events[eventID].subgraphic!(0,8)
  end
 
 
  def self.check(plotID)
    #Sets the plots event ID
    eventID = $game_farming_plots[plotID][5]
    #Set start to time of planting
    start = $game_farming_plots[plotID][3]
    #Set growth to the time the plant takes to grow each stage
    growth = $game_farming_plots[plotID][4]
    #to find when the next stage is complete
    finish = start + growth
    #Set time to current time
    time = $game_variables[1].to_i + $game_variables[2].to_i / 100
    #Subtract time now from the plant is ready if the stage is complete
    if (finish - time) == 0
      #Set p to the plant type
      plant = $game_farming_plots[plotID][0]
      #Check what stage the plot it up to
      stage = $game_farming_plot[plotID][1]
      case stage
      when 1
        picture = $game_farming_plants_stageone[plant]
        #Change events pictue to that stored in picture
        $game_map.events[eventID].character_name = picture.to_s
        #Takes the plot to the next stage
        $game_farming_plots[plotID][1] += 1
        #change self switch b on for the plot
        $game_self_switches[[$game_map.map_id, eventID, "B"]] = true
        #refresh map so that the changes are shown
        $game_map.need_refresh = true
      when 2
        picture = $game_farming_plants_stagetwo[plant]
        #Change events pictue to that stored in picture
        $game_map.events[eventID].character_name = picture.to_s
        #Takes the plot to the next stage
        $game_farming_plots[plotID][1] += 1
        #change self switch c on for the plot
        $game_self_switches[[$game_map.map_id, eventID, "C"]] = true
        #refresh map so that the changes are shown
        $game_map.need_refresh = true
      when 3
        picture = $game_farming_plants_stagethree[plant]
        #Change events pictue to that stored in picture
        $game_map.events[eventID].character_name = picture.to_s
        #Takes the plot to the next stage
        $game_farming_plots[plotID][1] += 1
        #change self switch d on for the plot
        $game_self_switches[[$game_map.map_id, eventID, "D"]] = true
        #refresh map so that the changes are shown
        $game_map.need_refresh = true
      end
    end
  end
 
  def self.harvest(plotID)
    #Get plant ID
    plant = $game_farming_plot[0]
    #Gets the exp for growing such plant
    exp = $game_farming_plants_exp[plant]
    #add the exp to the skill farming (I created a skillbook to keep record of exp and levels and to display this information to the user)
    #When the exp is added skillbook also checks if a level should be awarded and that kind of thing
    Skillbook.addexp("farming", exp)
    #Resets the plots switches ready for replanting
    $game_self_switches[[$game_map.map_id, eventID, "A"]] = false
    $game_self_switches[[$game_map.map_id, eventID, "B"]] = false
    $game_self_switches[[$game_map.map_id, eventID, "C"]] = false
    $game_self_switches[[$game_map.map_id, eventID, "D"]] = false
    #clears the plots data ready for reuse and so that it can not cause any issues (Just in case really)
    $game_farming_plots[plotID].clear
    #sets the item to gain
    item = $game_farming_plants_items[plant]
    #adds the item nessacry
    #$game_items[item].add (I don't know how to do it, but i figured that would show what I planned)
    #Sets V6 to the name of the plant recived so that it can be displayed to the player in the textbox
    $game_variables[6] = $game_plants_list[plant]
  end
 
end
[/rgss]
 

Seto

Member

Thanks so much Yeti!

I am so stupid, if only I had looked harder. Thanks! To tell the truth, I didn't actually know you could use case statements, I did learn how to do them in java ages ago. But I had never seen them in ruby so I never tried. So no there was no good reason for using all those "if" statements and that's also why there were no "else" statements because I was using it like a case. And no I didn't mean to misspell farming, my bad. Don't you hate typo's? Yeah after you said that I realized I already have my own variable with the same data. Basically the time keeping sets RM's variables to that data so that I can display it in a text box using \v. But the data is added to the variable like "$game_variable[3] = $game_timesystem_current" (That's just an example of what it looks like, their not actually the variables used) so instead I will just use my own variable.

I'll still welcome anyone else who has feed back though, so I won't close this tread just yet.
Thank again Yeti!

EDIT: There were still errors in the script, but I have fixed them now. Here it is again, its still not completely finished yet.

Code:
 

class Farming

 

#Plant Arrays and Information (Found this easier then multidementional arrays or other methods.)

  $game_farming_plants_list = ["Golden Wattle", "Orange Fungi", "Anthers", "Rosmary"]

  $game_farming_plants_times = [2, 3, 5, 5]

  $game_farming_plants_stageone = ["Golden Wattle", "Orange Fungi", "Grid Flowers", "Random"]

  $game_farming_plants_stagetwo = ["Golden Wattle", "Orange Fungi", "Grid Flowers 2", "Random"]

  $game_farming_plants_stagethree = ["Golden Wattle", "Orange Fungi", "Grid Flowers 3", "Random"]

  $game_farming_plants_exp = [3, 3.5, 0.1, 6]

  $game_farming_plants_water = [1, 2, 3, 3]

  $game_farming_plants_itemid = [1, 2, 3, 4]

#Basic Plant Array Structure (No longer needed at this time)

  $game_farming_plant_basic_plant = ["Growth Time", "Stage One", "Stage Two", "Stage Three", "Exp", "Water Needed"]

#Basic Plot Array Structure (So that I know where the information I need is stored when using "$game_farming_plots")

  $game_farming_basic_plot = ["Plant Type", "Growth State", "Water Level", "Time Planted", "Time Ready", "Event ID"]

#Set Number of plots to use (Change this to the number of plots used in the game)

  $game_farming_number_of_plots = 1

#Create Arrary for multidentionalisim (I am pretty sure thats a made up word lol!)

  $game_farming_plots

 

  def self.setup

    #Checks how long each array should be (I didn't set this in stone so I could add or take features e.g. watering)

    l = $game_farming_basic_plot.length

    #Checks how many plots are needed

    n = $game_farming_number_of_plots

    #Ceates the multidementional Array

    $game_farming_plots = Tools.mda(n, l)

  end

 

      #(PlotID is the plot number assigned to the event, plantID is the planted chosen to grow (Number form to information can be pulled from the array),

      #eventID is so that the plot and event as bound and change be changed together without having to request which event to change)

  def self.plant(plotID, plantID, eventID)

    #Sets the time the plot was planted V1 is hours, V2 is minuets

    #Becuase V2 is in the format "00" / by 100 then adding to V1 gives us the format "00.00"

    time = $game_variables[1].to_i + $game_variables[2].to_i / 100

    #sets the selected plot to the selected plant (Stage to 1, water level to 0, and time plant needs, which event the plot is)

    $game_farming_plots[plotID] = $game_farming_plants_list[plantID], 1, 0, time, $game_farming_plants_times[plantID], eventID

    #Changes the event to the next page ready to turn into a plant

    $game_self_switches[[$game_map.map_id, eventID, "A"]] = true

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

    #Change the plots image to a seedling

    $game_map.events[eventID].character_name = 'Grid Seeds'

    #First column from the left facing up

    #$game_map.events[eventID].subgraphic!(0,8)

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

  end

 

 

  def self.check(plotID)

    #Sets the plots event ID

    eventID = $game_farming_plots[plotID][5]

    #Set start to time of planting

    start = $game_farming_plots[plotID][3]

    #Set growth to the time the plant takes to grow each stage

    growth = $game_farming_plots[plotID][4]

    #to find when the next stage is complete

    finish = start + growth

    #Set time to current time

    time = $game_variables[1].to_i + $game_variables[2].to_i / 100

    #Subtract time now from the plant is ready if the stage is complete

    if (finish - time) == 0

      #Set p to the plant type

      plant = $game_farming_plots[plotID][0]

      #Check what stage the plot it up to

      stage = $game_farming_plot[plotID][1]

      case stage

      when 1

        picture = $game_farming_plants_stageone[plant]

        #Change events pictue to that stored in picture

        $game_map.events[eventID].character_name = picture.to_s

        #Takes the plot to the next stage

        $game_farming_plots[plotID][1] += 1

        #change self switch b on for the plot

        $game_self_switches[[$game_map.map_id, eventID, "B"]] = true

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      when 2

        picture = $game_farming_plants_stagetwo[plant]

        #Change events pictue to that stored in picture

        $game_map.events[eventID].character_name = picture.to_s

        #Takes the plot to the next stage

        $game_farming_plots[plotID][1] += 1

        #change self switch c on for the plot

        $game_self_switches[[$game_map.map_id, eventID, "C"]] = true

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      when 3

        picture = $game_farming_plants_stagethree[plant]

        #Change events pictue to that stored in picture

        $game_map.events[eventID].character_name = picture.to_s

        #Takes the plot to the next stage

        $game_farming_plots[plotID][1] += 1

        #change self switch d on for the plot

        $game_self_switches[[$game_map.map_id, eventID, "D"]] = true

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      end

    end

  end

 

  def self.harvest(plotID)

    #Get plant ID

    plant = $game_farming_plot[0]

    #Gets the exp for growing such plant

    exp = $game_farming_plants_exp[plant]

    #add the exp to the skill farming (I created a skillbook to keep record of exp and levels and to display this information to the user)

    #When the exp is added skillbook also checks if a level should be awarded and that kind of thing

    Skillbook.addexp("farming", exp)

    #Resets the plots switches ready for replanting

    $game_self_switches[[$game_map.map_id, eventID, "A"]] = false

    $game_self_switches[[$game_map.map_id, eventID, "B"]] = false

    $game_self_switches[[$game_map.map_id, eventID, "C"]] = false

    $game_self_switches[[$game_map.map_id, eventID, "D"]] = false

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

    #clears the plots data ready for reuse and so that it can not cause any issues (Just in case really)

    $game_farming_plots[plotID].clear

    #sets the item to gain

    item = $game_farming_plants_items[plant]

    #adds the item nessacry

    #$game_items[item].add (I don't know how to do it, but i figured that would show what I planned)

    #Sets V6 to the name of the plant recived so that it can be displayed to the player in the textbox

    $game_variables[6] = $game_plants_list[plant]

  end

 

end

 
 
Tsk tsk, globals are not good.

[rgss] 
class Farming
  attr_accessor :plants_list, :plants_times, :plants_stageone
  attr_accessor :plants_stagetwo, :plants_stagethree, :plants_exp
  attr_accessor :plants_water, :plants_itemid
 
  def initialize
    @plants_list = ["Golden Wattle", "Orange Fungi", "Anthers", "Rosmary"] # list
    @plants_times = # times
    # etc
  end
end
 
[/rgss]

Do something like that.

$game_farming = Farming.new
p $game_farming.plants_list[0] # -> Golden Wattle

access the variables like that.
 

Seto

Member

Hello and thanks Ulqiorra for the advice and feedback.

I did know you weren't supposed to use many global variables, or as little as possible. and your suggestion seems to solve the problem with that. But I am don't really understand the method you have used. I mean I can see it works, but can you explain using "attr_accessor"'s to me a little, so I understand what's actually going on instead of just scripting blind? Does it just mean that by calling that method the script can access local data from another class? And what if I want to change these values from another class/script? I can just go $game_farming.plants_list[0] = "blah blah blach" Right? Liked I did with the changing of events self switches, I know that also used "attr_accessor"'s. Thanks for this, your a great help.

I have now done up a window and scene for selecting the seed you wish to plant and calls the plant method with the info according to the seed selected. I am going to add to the farming script which map the plant is on, so that it can be updated while the player is on another map, and I am also going to adjust and fix the time settings and the whole stage thing? I am going to change that so you just specify the image and the row the plant it on and it runs through the images on that row as the plant grows, so stage one, two ect are no longer needed. And I am going to add the need for water levels too. But I have another question before I do all that, I am going to make another method that runs through all the active plots and updates them. Would this kind of method lag the game if its called often? Or since the method will mainly consist of the same piece of code running over and over until conditions are met make it less laggy? If so, how often should I call it? Every 1min, 10min?

Thanks for all the input and feedback everyone. I am going to post a much more updated version within the next day or so.
 
Alright, the Object#attr_ methods are for data access.

attr_accessor :variable, simply adds a method to the class with the name "variable", and another with the name "variable="(this one contains an argument for the value of "variable").

so it basically adds

def variable # The reading method
return @variable
end
def variable=(value) # The writing method.
@variable = value
end

And attr_reader does about the same, but it only adds the reading method. Same with attr_writer, except it only includes the writing method.

And I don't fully understand your other question to be honest. Do you mean that you want to update your farming class every frame? If so, it's easy enough to add an update command to Scene_Map.

Do you know how to use aliases? If so, this should be a snap.

class Scene_Map
alias farming_scene_map_update update
def update
$game_farming.update
farming_scene_map_update
end
end

Now, of course you still need a method in Farming called "update", but that shouldn't be too hard to accomplish.

But anyway, what that alias does is takes the method(in this case, "update") specified in the second argument, and makes a copy of it called(in this case "farming_scene_map_update")whatever you put for the first argument.

I believe the standard for aliases in RGSS is to have the name(first argument)be "scripter_script_class_method".

Is that any help?
 

Seto

Member

Thanks again, wow your so helpful 0.0! I understand whats going on with the attr methods now. It makes sense, I just needed someone to explain it to me and you did a really good job of it too (Thanks). My other question was basically this
if I added a method to check the plots/plants that had been planted and update them (all of them)
1) Is it practical to it updating every frame?
2) Would it cause noticeable lag?
3) if not every frame, how often should I update it so that no lag is noticed. (On the average computer)

Update on my farming script:
I have created a scene and window set that allows the user to select any seeds they have and plant them. In a panel next to each seeds name there is information about the seed, like its description and price ect.. So after I finish up some lose bits a pieces and rewrite it according to Ulqiorra's amazing help. I will repost like a working beta of it with a demo soon. But this week is Christmas, and I celebrate it. So I am going to be busy over the next couple days so it might be another week before this is all done. Sorry :s

Thanks to everyone who has helped out. I am really happy with my progress as a scripter/novice now. Releasing this as a finished working system will make me so happy. And I know that there will be room for so much improvement and I look forward to working with everyone's feedback in the future.

Off Topic: Ulqiorra I love your signature picture about text speak, totally agree! (I use very very little, e.g. lol.)
 
Ah, well, you probably should update it every frame, and i doubt it would cause much lag as long as you do it correctly.

Off Topic: Thanks, me too. And I don't even use "lol". I say "that was so funny that i laughed", mainly to poke fun at Wyatt.
 

Seto

Member

Oh I have a quick question. As the plants grows through stages e.g. stage one, two, three. It has to be read from an image file. But I can do it one of either two ways

1) The image used for the plant is selected by the user, by entering the images name into the editing part of the script, and then the user selects a column from that image. As the plants grows it's image changes going down the column e.g. left most column is selected and the plant changes from what would have been, down, left, right, up. For a normal character, but for a plant becomes, seed, sapling, plant, fully grown.

The benefit of this would be that you could fit 4 plants on one image.

The Disadvantage of this is that the user then as to put in values for two different things and it could become confusing.

2) The image used for the plant is the same as the name of the plant to be grown, e.g. if your growing a plant called "Orange Fungi" the image used as it grows would be called "Orange Fungi" as well. Meaning less user input. And the plants stage would run down the first column automatically without the user needed to add any extra input.

The Advantage of this would be that the user as to set less up within the actual script.

The Disadvantage with this that one plants takes a whole image but only used 4 out of the 16 slots. (4 column x 4 rows = 16 slots)

Another question, the user has to specify the item id for the seed and for the end item (The item id for the herb gained after picking the plant)
Should I set the script to take the name of the plant as the name of the end item, reducing the amount of editing needed to be done to the script? Or allow the player to set the name from each plant manually?
 

Seto

Member

[EDIT] Even more pressing question! Once I use attr_accessor can the class that the data is from e.g. class Farming access the data like i = @plants_list[5] or do I have to write it out $game_farming.plants_list[5] even within the class that creates the data? or do I have to swap from @plants_list to just plants_list? Please help, after changing my whole script to use the "attr_accessor" instead of global variables nothing works and now I am having to change everything to $game_farming.variable even within its own class. Is that right? Sorry, I am still learning and I will only ever have to ask these questions once :P.


Here I will also post the most recent version on my script (That still needs a hell of a lot of work on it)
Code:
 

#-------------------------------------------------------------------------------

# * Farming Script

#-------------------------------------------------------------------------------

#The "Order" data is entered below is as follows, for plant 1 you add its information

#seperatly into the arrays, e.g. the first position of each array here is an example

#

# @plants_times = [plant one's growing time, plant two's growing time, plant three's growing time]

# @plants_exp = [plant one's exp, plant two's exp, plant three's exp

# Continue filling in the data like this, so all the data in the "first" slot of these varibles 

# belongs to the "first" plant and so on.

# There is an explaination about what each varible is next to it so you know what information to enter

# This farming system runs off real time, checking the computers data and time

# and uses this to calculate when a plant has grown to the next stage.

# There are four stages for each plant, seedling, sprout, bud and bloom (Bloom is fully grown)

#-------------------------------------------------------------------------------

 

 

class Farming

 

  

  attr_accessor :plants_times, :plants_exp, :plants_water

  attr_accessor :plants_itemid, :plants_herbid, :plants_stages

  attr_accessor :plants_list, :plants_graphics, :plants_column

  attr_accessor :plot_ID, :event_ID, :seeds_page

  

 

  def initialize

#Plant Arrays and Information (Found this easier then multidementional arrays or other methods.)

  #In Minuets, the amount of time it takes the plant to gorw through each stage. 

  #To find the full length of time the plant takes to grow times your minuets by 3

  @plants_times = [2, 3, 1, 5] 

  # The amount of exp gained from growing the plant

  @plants_exp = [3, 3.5, 0.01, 6]

  #Number of times plant needs to be watered each stage

  @plants_water = [1, 2, 3, 3] 

  #The item id of the seed

  @plants_itemid = [1, 2, 3, 4]

  #The item id of the produced plant

  @plants_herbid = [5, 6, 7, 8]

  #Do not change this

  @plants_stages = [2, 4, 6, 8] 

  #If you do not set the following names will be generated by the names of the item produced.

  @plants_list = [] #Add in the "names" of the plants in order. Put them in "" and adding a commar after each one

  #If nothing is set here the graphics for you plants will be set to their names e.g. "plants_name.png"

  @plants_graphics = [] #If setting the graphics files yourself put them here in order

  #If you did not set custom graphics do no set this

  @plants_column = [] #If setting custom graphic files select the colum of the plant here, 0 = first column, 1 = second column, ect...

  #For calling Famring Scene

  @plot_ID

  @event_ID

  #Needed for Scene_Farming

  @seeds_page = 0

end

 

#Basic Plant Array Structure (No longer needed at this time)

  @basic_plant = ["Growth Time", "Exp", "Water Needed", "Seed ID", "Herb ID", "Graphics", "Column"]

#Basic Plot Array Structure (So that I know where the information I need is stored when using "$game_farming_plots")

  @basic_plot = ["Plant Type", "Growth State", "Water Level", "Time Planted", "Event ID", "Map ID"]

#Set Number of plots to use (Change this to the number of plots used in the game)

  @number_of_plots = 1

#Create Arrary for multidentionalisim (I am pretty sure thats a made up word *Chuckels*)

  $game_farming_plots

 

#Allows Data to be Accessed

$game_farming = Farming.new

 

 

 

 

  def self.setup

    #Checks how long each array should be (I didn't set this in stone so I could add or take features e.g. watering)

    l = @basic_plot.length

    #Checks how many plots are needed

    n = @number_of_plots

    #Ceates the multidementional Array

    $game_farming_plots = Tools.mda(n, l)

    #If the user has not set a list of plant names, the names are compiled from the end items names.

    if @plants_list == nil

    i = 0

    while i < @plants_itemid.length

      id = @plants_itemid[i].to_i

      @plants_list[i] = $data_items[id].name

      i = i + 1

    end

  end

    #If the user has not set a list of plant names, the names are compiled from the end items names.

    if @plants_graphics == nil

    z = 0

    while z < @plants_list.length

      @plants_graphics[z] = @gplants_list[z].to_s

      z = z + 1

    end

  end

    #Loops runs to convent the users input from seconds into minuets

    t = 0

    while t < @plants_times.length

      @plants_times[t] = @plants_times[t].to_i * 60

      t = t + 1

    end

  end

 

 

  def self.plant(itemID)

  #PlotID is the plot number assigned to the event, itemID is the item planted's number

  #eventID is so that the plot and event as bound and change be changed together

  #Gets the event's ID

  eventID = @event_ID

  #Gets the plot's ID

  plotID = @plot_ID

  #Sets the index i to 0

  i = 0

  #Gets the plants id number by comparing the item id using i as the index

  while i < @plants_itemid.length

    #checks if the itemID given matches the item id at i in $game_farming_itemid

    if itemID == @gplants_itemid[i]

      #if the item id matches sets the varible plantID to the plants id

      plantID = i

      #Sets i to the length of #game_farming_plants_itemid so to finish the when loop

      i = @plants_itemid.length

    end

    #if the item id's did not match adds 1 to i and checks the next value fot a match

    i = i + 1

  end

    #Sets time to the current time, including day and year.

    time = Time.now

    mapID = $game_map.map_id

    #sets the selected plot to the selected plant (Stage to 0, water level to 0, and time plant needs, which event the plot is)

    $game_farming_plots[plotID] = plantID, 0, 0, time, eventID, mapID

    #Changes the event to the next page ready to turn into a plant

    $game_self_switches[[mapID, eventID, "A"]] = true

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

    #Change the plots image to a seedling after checking if the player as set custom graphics

    if @plants_graphics == nil

    $game_map.events[eventID].character_name = @plants_list[plantID]

    #First column from the left facing up (Defult settings)

    $game_map.events[eventID].subgraphic!(0, 2)

  else

    #If the player as set up their own graphics use them instead

    $game_map.events[eventID].character_name = @plants_graphics[plantID]

    #Set the graphic to the plant selected by the user and set to seedling (2)

    $game_map.events[eventID].subgraphic!(@plants_column[plantID], 2)

  end

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

end

 

 

 

  def self.check(plotID)

    #Sets up all the data that may be needed for the method so it does not need to be set by seperate sections

    #Sets the plots event ID

    eventID = $game_farming_plots[plotID][4]

    #Checks which map the plot is on

    mapID = $game_farming_plots[plotID][5]

    #Set growth to the time the plant takes to grow each stage

    plantID = $game_farming_plots[plotID][0]

    #Set start to time of planting

    start = $game_farming_plots[plotID][3]

    growth = @plants_times[plantID]

    #to find when the next stage is complete

    finish = start + growth

    #Set time to current time

    time = Time.now

    if time >= finish

      #Set plant to the plant type

      plantID = $game_farming_plots[plotID][0]

      #Check what stage the plot it up to

      stage = $game_farming_plot[plotID][1]

      #Checks if the plants has been watered enough to advance

      if $game_farming_plots[plotID][2] >= @plants_water[plantID]

        #Adds one to the plots/plants stage

        $game_farming_plots[plotID][1] += 1

        #Resets the plants water level

        $game_farming_plots[plotID][2] -= 1

        #refresh map so that the changes are shown

      case stage

      when 1

        #Sets the plots graphic to that of the next stage

        $game_map.events[eventID].subgraphic! (@plants_column[plantID], 4)

        #refresh the map so that the changes are shown

        $game_map.need_refresh = true

      when 2

         #Sets the plots graphic to that of the next stage

        $game_map.events[eventID].subgraphic! (@plants_column[plantID], 6)

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      when 3

        #Sets the plots graphic to that of the next stage

        $game_map.events[eventID].subgraphic! (@plants_column[plantID], 8)

        #change self switch d on for the plot

        $game_self_switches[[mapID, eventID, "B"]] = true

        #refresh map so that the changes are shown

        $game_map.need_refresh = true

      end

      end

    end

  end

 

  def self.harvest(plotID)

    #Get plant ID

    plantID = $game_farming_plot[plotID][0]

    #Get Map ID

    mapID = $game_farming_plot[plotID][5]

    #Gets the exp for growing such plant

    exp = @game_farming_plants_exp[plantID]

    #add the exp to the skill farming (I created a skillbook to keep record of exp and levels and to display this information to the user)

    #When the exp is added skillbook also checks if a level should be awarded and that kind of thing

    Skillbook.addexp("farming", exp)

    #Resets the plots switches ready for replanting

    $game_self_switches[[mapID, eventID, "A"]] = false

    $game_self_switches[[mapID, eventID, "B"]] = false

    $game_self_switches[[mapID, eventID, "C"]] = false

    $game_self_switches[[mapID, eventID, "D"]] = false

    #refresh map so that the changes are shown

    $game_map.need_refresh = true

    #clears the plots data ready for reuse and so that it can not cause any issues (Just in case really)

    $game_farming_plots[plotID].clear

    #sets the item to gain

    item = @game_farming_plants_items[plantID]

    #adds the item nessacry

    $game_party.gain_item(item, 1)

    #Sets V6 to the name of the plant recived so that it can be displayed to the player in the textbox

    $game_variables[6] = @game_plants_list[plantID]

  end

 

end

 

So I should allow the player to set up as many things themselves as possible? See I thought it would be a problem because "some" people have so much trouble setting up scripts. Well I will take your advise and use option 1 for the graphics, but I think I will go with option 1 for the items. However if I put in a simple

Code:
 

if $game_farming_plants_list == nil

#set up the list according to the name of the final item

else

#using the information preset by the user

 

I could do both at once, and I suppose I could do the same for the graphics too. Is that a good or bad idea though? Would that just make things ever more confusing?
 
Wait a sec... You never include a script call for the same class you're working on inside the class script...

[rgss]# #Allows Data to be Accessed
# $game_farming = Farming.new
# a bunch of code
$game_farming_plots[plotID].clear
# a bunch of code
if $game_farming_plants_list == nil
[/rgss]

Global variables should be pasted somewhere in Scene_Title script so they are already loaded when the game actually starts (on the map screen). And you should REALLY avoid using that many $variables... use the attr_accessor's more efficiently.

Use $game_farming.plants_list instead of $game_farming_plants_list... A more elaborated way to achieve the same results would be to define methods on a new Module... but you'll later learn more about that some day.
 

Seto

Member

OK so I move the $game_farming = Farming.new to the Scene class instead. Easy I suppose. But I thought I did remove all the global's except that one $game_farming_plots[][] (Which I will change later but I want to keep it the way it is for the time being, me being crazy and all). Now every thing is accessed by $game_farming.plants_list like you suggested. I was just asking if I needed to write it out $game_farming.plants_list inside the farming class or could I just go @plants_list.

If you feel like explaining modules please go ahead, or post a link. But I am happy to just use attr_accessor's if there isn't an advantage in using modules... Thanks for your help. I think I am getting there, well closer at least.
 
Here's an example on how to call plant_list. It's main purpose is to allow you to call it @plant_list inside the same script but $game_farming.plant_list from any other script you'd like to use...

[rgss]class Farming
attr_accessor :plant_list
 
def initialize
  @plant_list =[]
  # bunch of code
end
#rest of the script
end
[/rgss]

You should do the same thing with any other variable that you previously created as a $variable.

Well, the "advantage" of using Modules is that you don't need $variables but just to include the module script in any other script as needed, but in this case, since you just started learning RGSS and it's a farming script, it's OK to use a class script and call it with $variables.
 

Seto

Member

Well thanks for the help kyon. It's much appreciated, I am very glad I get a chance to learn scripting in this way and environment. I mean learning to script will help me with many other things and applications then just rpg maker in the future. I mean ruby alone it a powerful tool, but knowing any language helps you learn another right? Especially if its also object orientated? And this is a great way to learn, making games. Enjoying yourself and having access to great people who are helpful and kind. Thanks everyone!

My latest version (Now on the first post) uses the attr_accessor's for everything except the plots, which will change soon. And now I know how to use them I won't fall into the global variables trap in the future for other scripts or projects. However I get an error whenever I try to access the data, as soon as I put @plants_list[number] within the class Farming script I get an error that it hasn't been defined. So I am going to have to go through and change them all over to $game_farming.variable_needed. Which is not how its supposed to be done right?

Oh and does anyone have comments on the idea, a farming script? Is it a good one (idea)? Could I be doing it a better way? and is there any features I should add? (I do plan on making the plants died if not watered on time, for the record
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top