Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Bigace360

[Help] Removing old commands.

Recommended Posts

Okay this for the same script as the other post I posted last week. For this one, how would you create a switch for when you select something, from lets say the command window, it disappears. Like once you click on it read what there then go back, its gone from the list. Because what I have here is this list:

 

First Command list:

  • New Entries
  • Places
  • People
  • etc

Second Command List: New Entries

  • Some Location
  • Some People
  • Some other stuff.

As you see in the 2 list above, one is the overall list, the other is New Entries list I selected. Inside the New Entries Selection are some more selections that lead to descriptions. Since the New Entries info isn't one of the other 3 categories (Places, People, etc). I want the info to disappear once someone views it. However it's still stored in the system so It isn't removed from the other 3 categories. Hopefully that made since.

Share this post


Link to post
Share on other sites

well it all depends on how your storing your entries, the most efficient way would be to store them in an array, and make a new array for each entry type, heres an example how i would go around it:

module Config
 def self.places_entries(id)
   case id
   when 0 then return [false, WHATEVER_DATA YOUR ENTRY HOLDS] #the false value represents it hasnt been read yet
   end
 end
end

class Game_System
 attr_accessor :places #variable that stores places
 attr_accessor :people #variable that stores people

 alias init_init initialize
 def initialize
   init_init
   @places = []
   @people = []
 end

 def add_entry(type, id)
   case type
   when 0
     array = Config.places_entries(id)
     @places.push(array)
   when 1
     #etc
   end
 end
end

now as you see i made an array that contains each entry category and they get there data from the config, so what you would do is just loop through the arrays to display them under the correct category window, as for showing new entries, you will see i added a false value within the config of the entry, that represents if it had been viewed yet, so just add all entry categories to your new entries window that have the false value set, then when you view them change that value to true so that they are no longer displayed to the new entries window

Edited by diagostimo

Share this post


Link to post
Share on other sites

Well I had something similar:

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# â–  Module ACE::Dictionary
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module ACE
module Dictionary
DICTIONARY_COMMANDS =[ # The order at which the menu items are shown.
# [:command, 'Display'],
[:terms, 'New Terms'],
[:places, 'Poltical Bodies / Places'],
[:people, 'People'],
[:races, 'Races'],
[:misc, 'Misceilaneous'],
[:all,	 'All Terms'],
] # Do not remove this.
#===========================================================================
MISC ={}
PLACE ={}
PEOPLE ={
# id => [term_name, term_type, file_name],
1 => ['Aluxes', 'People', ''],
2 => ['Basil', 'People', ''],
3 => ['Cyrus', 'People', ''],
4 => ['Dorothy', 'People', ''],
5 => ['Estelle', 'People', ''],
6 => ['Felix', 'People', ''],
7 => ['Gloria', 'People', ''],
8 => ['Hilda', 'People', ''],
}
RACES ={
1 => ['Human', '(Race)', ''],
2 => ['Elve', '(Race)', ''],
3 => ['Demons','(Race)', ''],
}

#===========================================================================
def self.add_character(id)
$game_system.entries_held[id] = true
unless $game_system.dictionary[:people].include?(id)
$game_system.dictionary[:people] << id
$game_system.dictionary[:people].sort!
end
end
def self.add_location(id)
$game_system.entries_held[id] = true
unless $game_system.dictionary[:places].include?(id)
$game_system.dictionary[:places] << id
$game_system.dictionary[:places].sort!
end
end
def self.add_race(id)
$game_system.entries_held[id] = true
unless $game_system.dictionary[:races].include?(id)
$game_system.dictionary[:races] << id
$game_system.dictionary[:races].sort!
end
end
def self.add_misceilaneous(id)
$game_system.entries_held[id] = true
unless $game_system.dictionary[:misc].include?(id)
$game_system.dictionary[:misc] << id
$game_system.dictionary[:misc].sort!
end
end
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# â–  Game_System
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
class Game_System
include ACE::Dictionary
attr_accessor :dictionary, :entries_held
alias :ace_journal_initial :initialize unless $@
def initialize(*args)
ace_journal_initial(*args)
@entries_held = []; @dictionary = {}
DICTIONARY_COMMANDS.each {|key| @dictionary[key] = []}
end
def dictionary_entries(type)
entries = []
case type
when :all
@dictionary[type].each do |i|
entries << MISC[i][0]
entries << PEOPLE[i][0]
entries << PLACE[i][0]
entries << RACES[i][0]
end
when :misc then @dictionary[type].each {|i| entries << MISC[i][0]}
when :people then @dictionary[type].each {|i| entries << PEOPLE[i][0]}
when :places then @dictionary[type].each {|i| entries << PLACE[i][0]}
when :races then @dictionary[type].each {|i| entries << RACES[i][0]}
when :terms
end
return entries.empty? ? ['?????'] : entries
end
end

I'll see what I can do with your true or false thing after I get some food. Thank you

Edited by bigace

Share this post


Link to post
Share on other sites

ye, all you would have to do is add the truth/false value to the array so that when it reads it it knows whether it belongs, it might also be more beneficial to create your ellements as classes i.e:

class Location
attr_accessor :viewed?, :name, :info #etc
def initialize(parameters)
@viewed? = false
@name = parameters[0]
@info = parameters[1]
end
end
#then you method that adds them in whatever class
def add_location(id)
@locations.push(Location.new(Config.location(id))
end
#then to check if it has been viewed or not:
if @locations[iD].viewed?
#or to change it
@locations[id].viewed? = true

Edited by diagostimo

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...