FANDOM


Simple version check
This tutorial was written by Elyssia. Please give credit.
Click here for more tutorials!


Current Script Version: Version 1.0

I have recently been making my own basic scripts for my Pokémon Game.

However, this is one of my own scripts I want to share with the other fellow Developers.

In this case an Simple Version Check script which tells you if your version is Current(Up-to-Date) or needs an Update.

What is the function of this script?

  1. The script will check the local txt file if it matches with the Download URL txt file.
  2. Checks if Update is needed or not needed.

For the txt file we will use 'version.txt' which has to be located in the Project's Main folder!

The other 'version.txt' much be existing and located on the server!

In this case i will use http://localhost/ as my server.

Getting the Script ready to be added into the game

Version.txt

version.txt

First you need to create a new TXT file where you'll put the current version of your game, in this case we will use: "1.00"

The text file should look like this one:

Then you need to upload the file onto a server, with your FTP account.

Now open your Project and go to the 'Script Editor'(F11 hotkey).

Now make a new Script Section between the scripts: 'DependentEvents' and 'Compiler'.

Also don't forget to give it a name! (In this case, I am using the name 'CustomScripts')

Now add the following script in there:

 #=============================================================================
 #  Version Module - by Elyssia(Forum nick) aka R3zonance(Developer nick)
 #  and modified by Polectron aka Pokebuzo
 #=============================================================================
 
 #=============================================================================
 # Version Module 1.5
 #-----------------------------------------------------------------------------
 # A simple design that checks if the game's variable version matches with the
 # Server's txt URL.
 #
 # *Note: If using this script, please give credits to Elyssia aka R3zonance!
 #=============================================================================
 
def pbVersionCheck
  link="PUT HERE THE LINK TO YOUR TXT FILE (example:http://hakome.com/version/ditw.txt)"
  version=pbDownloadToString(link)
  #link2="C:\Users\User\Documents\RPGXP\Pokémon Essentials\version.txt"
  #array = IO.readlines('version.txt')
  #current = array[0]
  #Part redone by Polectron
  current = "1.00" #Change that number for the actual version of your game.
  Kernel.pbMessage(_INTL("Current Version = " + current + "\nLatest Version = " + version + " \\wtnp[30]"))
  if current == version
    Kernel.pbMessage(_INTL("Version is up-to-date, no update needed! \\wtnp[30]"))
  elsif version == ""
    Kernel.pbMessage(_INTL("Unable to fetch latest Version from server. Check your internet connection! \\wtnp[30]"))
  else
    Kernel.pbMessage(_INTL("Version does not match! \nUpdate required. \\wtnp[30]"))
  end
end

Please note this is only an Basic script for the Developers that likes the idea of an Version Checker script.

Making changes are completely allowed without asking for permissions!

How to add script into Main Menu(Selectable)

Adding this script into the Main Menu is possible, and isn't that tricky after all.

But you do have to know WHAT you are changing inside the scripts.

Go back to the 'Script Editor'(F11 hotkey) and go to Script: 'PokemonLoad'.

1. Find around line 358:

  commands[cmdContinue=commands.length]=_INTL("Continue") if showContinue
  commands[cmdNewGame=commands.length]=_INTL("New Game")
  commands[cmdOption=commands.length]=_INTL("Options")
else
  commands[cmdNewGame=commands.length]=_INTL("New Game")
  commands[cmdOption=commands.length]=_INTL("Options")
end

2. Change this to:

  commands[cmdContinue=commands.length]=_INTL("Continue") if showContinue
  commands[cmdNewGame=commands.length]=_INTL("New Game")
  commands[cmdOption=commands.length]=_INTL("Options")
  commands[cmdVersion=commands.length]=_INTL("Version Check")
else
  commands[cmdNewGame=commands.length]=_INTL("New Game")
  commands[cmdOption=commands.length]=_INTL("Options")
  commands[cmdVersion=commands.length]=_INTL("Version Check")
end

3. Find around line 496:

elsif cmdOption>=0 && command==cmdOption
  scene=PokemonOptionScene.new
  screen=PokemonOption.new(scene)
  pbFadeOutIn(99999) { screen.pbStartScreen }
end

4. Add before 'end':

elsif cmdVersion>=0 && command==cmdVersion
  pbVersionCheck

5. Save Script changes and test the script out.

Please note that my current project uses Version 1.00 Beta <3 And also ignore my Project Name.....

VersionCheck

Version check option in Main Menu

This is what you should see in the Main Menu.

Of course you are also able to use pbVersionCheck in Events without problems.

Don't forget to change http://localhost/ into your website and the Local location of the local txt file.

To-do list

  • Fixing Local version.txt path.
  • Making the script a bit more advanced. (looks too simple and messy currently)
  • Changing the script bit by bit so it will function through a Application that will be used as Server Version for the Host System.
  • Adding the Version Check system into the Main Menu as a Separate Window, probably going to be located on the Left Bottom side of the Main Menu. (This means the Text you see in the Screenshot will be remove, and script should function as a Real-time updater script that contantly checks for new versions every 5 - 10 minutes)
  • Game should close in order to let the player(s) know that they should install the latest version first before continu'ing into the game.
  • Auto-updater should come up whenever the Versioning needs an up-date after Versions does not match.

If using this script, don't forget to give credits to Elyssia aka R3zonance.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.