export variables to txt file?

● ARCHIVED · READ-ONLY
Started by stiven202 6 posts View original ↗
  1. is there any way to export variables to a txt file?

     

    example:

     

    In part of my game, player will enter his name and ID. I want to keep those variables and then export them to a text file and can view them.

     

    List example:

     

    TXT FILE:

     

    Name: Esteban

    ID: 523,134->this ID, previously entered by each player

    Name: Alejandra

    ID: 564,146

    Name: Fernando

    ID: 564,466

    Name: Lily

    ID: 564,884

     

    thanks.

     

     
  2. I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.

    Why export them?  Why not just have the player send you his save file, then you can load that into your own game and look at everything.
  3. Try this script:

    http://forums.rpgmakerweb.com/index.php?/topic/45024-txt-files-builderopener/

    in the part where you set up the text,

    use something like this:

    Code:
    @DOC1 = $game_actors[1].name + "\n" + $game_actors[1].id.to_s + "\n" + $game_actors[2].name + "\n" + $game_actors[2].id.to_s + "\n" + $game_actors[3].name + "\n" + $game_actors[3].id.to_s + "\n" + $game_actors[4].name + "\n" + $game_actors[4].id.to_s + "\n"
  4. I highly doubt that will work, because $game_actors is not yet initialized when the module runs. It will throw an error immediately on game startup.

    I wonder too, why do you want to do this?

    You could try this snippet:

    Spoiler
    # Use the following script call in eventing:## save_txt_data("filename",actor_id,variable_id)## "filename" = The name of the text file you will save into.# If there is no such file in the game's directory, it will be# created automatically. If there is one already with the same# name, it will append the new text at the end of the txt file.## actor_id = The ID of the actor. The selected actor's name will be saved# in the txt file.## variable_id = The ID of the variable to save. The value of the variable will# be saved in the txt file.## Examples: ## save_txt_data("Player Data",12,78) - # Saves the name of actor 12 and the value of variable 78 into a file named# "Player Data.txt".## save_txt_data("InfoDump",8,9) - # Saves the name of actor 8 and the value of variable 9 into a file named# "InfoDump.txt".## Run a name input processing command and a number input command before you use# this script call, and enter the re-named actor's ID and the variable's ID used# in the number input. This way, the entered data will always be saved in the# text file, ready to be used for whatever purposes.## Made by: Sixthclass Game_Interpreter def save_txt_data(filename,aid,vid) File.open("#{filename}.txt", "a+") do |f| num = 0 f.each_line do |line| if line =~ /-- Player: (\d+) --/i num = $1.to_i end end num += 1 f.write("\n -- Player: #{num} -- \n") f.write("Name ------------------- #{$game_actors[aid].name} \n") f.write("ID --------------------- #{$game_variables[vid]} \n") end end end
    Use the provided script call, combine it with eventing, and you can easily do what you want with it.
  5. Yes, if you write that in an event script box, it won't throw an error.


    I meant in your script, if you enter what you wrote above in the module settings of your script, than it will throw an error.