Need a bit of help

I am currently making a teleport script which I have got a problem with. I need to allow the user to put as many "add_command()" without actually writing "add_command()", just filling in the following variables:    

@numberteleports = 1 # Put how many teleports you have in here# Teleport 1 @tp_1_id = 1 # A no that is different for all TP's @tp_1_name = "Example" # A name to identify the TP @tp_1_text = "Example" # The text that will be shown in game @tp_1_map_id = 1 # The number associated with the map you're teleporting to @tp_1_map_x = 5 # The X possition where you want to TP to @tp_1_map_y = 5 # The Y possition where you want to TP to @tp_1_map_d = 4

I would prefer it if I didn't have number of teleports but I can have that. I want people to just be able to copy and paste the "Teleport 1", change all the 1's to 2, change the number of teleports and then I could script the rest. After that I have:

def make_command_list add_command()and I want all the teleports that the user makes to have a seperate "add_command".

I hope I have been as clear as possible. And thanks in advance!
your_counter.each.with_index(1) do | lalala, i| #lalala is irrelevant, but i is the indexAt default, with_index will start at 0.

Code:
your_counter.each.with_index do | asd, i|  #starts at 0  add_command("Tele#{i}", yadayada, yadayada, yadayada)end
your_counter.each.with_index(1) do | lalala, i| #lalala is irrelevant, but i is the indexAt default, with_index will start at 0.

your_counter.each.with_index do | asd, i| #starts at 0 add_command("Tele#{i}", yadayada, yadayada, yadayada)end
I understand the second part and what to do with that but where do I put the first line of code?

I have this at the moment:

Code:
   class Teleportwindow < Window_Command     def make_command_list       counter.each.with_index do | asd, i|       add_command(tp_text{i}, :tp_name{i})     end   end
Well, you would like the user to be able to see the choices, right? One way to do it is by using custom window derived from window_command.

class Window_Teleport < Window_Commanddef make_command_list add_teleport_commandsenddef add_teleport_commands (1..get_number_teleport_here).each do |i| add_command("Teleport Area #{i}", teleport_to_destination(i)) endenddef teleport_to_destination(destination) #do your stuff hereendSince you're using int as your # of teleport, you can use range to do the loop.  

(start_from_number..end_at_number).each do |number| endor

Code:
(start_from_number...end_right_before_number).each do |number| end
What about for create_command_window? The one with the @command_window.set_handler - how does that work with this?
Slot_Number = 10class Window_Slot < Window_Command def make_command_list (1..Slot_Number).each do |i| add_command("slot#{i}", :anything_goes_lol) end endendOn the Scene, you could do

@window_slot = Window_Slot.new@window_slot.set_handler🙂anything_goes_lol, method🙂do_teleport))If you are also wondering how to determine the teleport #, then I suggest you check the Scene_File and its inheritance (Scene_Save and Scene_Load). Particularly check how the index-ing works.

Original thread: https://forums.rpgmakerweb.com/threads/need-a-bit-of-help.23244/