Thread: [Guide] Scripting in Essentials 101
View Single Post
Old December 8th, 2012 (8:57 AM). Edited December 15th, 2012 by carmaniac.
carmaniac's Avatar
carmaniac carmaniac is offline
Where the pickle surprise at?
    Join Date: Apr 2009
    Location: England
    Age: 23
    Nature: Relaxed
    Posts: 683

    Scripting 101, things you may want to know.


    Section 1: Images.
    Section 2: Pokémon.

    Hello, and welcome to Carmaniac's; Scripting, things you may want to know. In this thread, I shall be providing most functions within codes that people may want to know, but can't seem to find the help to learn it. For instance, how to show images, how to add in text, how to do checks for Pokémon, or anything else you guys would like to learn.

    Section 1: Images.

    In this section, we shall learn the basic commands on how to load up images. To begin with, we shall start by seeing what type of variables there are, that we can use to first, define an image. There's two different ways you can conduct this. You can create an array, to display the images, which, is easier to remove all the images when the script ends. Or you can use a standard variable to display the image. Examples below:

    @sprites = {} #This line is crucial if you want to use the array method.

    @sprites["Background"] = # This defines the variable is a new sprite.
    @sprites["Background"].x = 20 # This sets the horizontal position, showing it as
    # the value of 20.
    @sprites["Background"].y = 100 # This sets the verticle position.
    @sprites["Background"].z = 900 # This sets which layer the image is on, higher the
    #number is, the higher the image is set above other images.
    @sprites["Background"].bitmap = BitmapCache.load_bitmap("Graphics/FolderName/ImageName")
    #This line is setting what the image will be, ("Graphics/FolderName/ImageName") is
    #important as it directs the code to where the image is.

    You can also manipulate the images in many ways. For example:

    @sprites["Background"].zoom_x = 2
    @sprites["Background"].zoom_y = 2

    The lines above change the zoom size of the graphic by a scale of 2.
    @sprites["Background"].angle = 0
    Use this if you would like to change the angle of the image. You can also do fun things in the update
    method of the script with this. For instance @sprites["Background"].angle+=1 with constantly
    rotate the image.
    @sprites["Background"].opacity = 255
    This changes the opacity of the chosen image 255 being visible and 0 being invisible.

    @Background = # Defines normal variable as a sprite
    @Background.x = 20 # Defines the horizontal position.
    @Background.y = 100 # Defines the verticle position.
    @Background.z = 999 # Defines layer
    @Background.bitmap = BitmapCache.load_bitmap("Graphics/FolderName/ImageName")
    # Defines image path.

    That is the basic information you need to know when it comes to displaying images.

    Section 2: Pokémon.

    In this section, we look at basic functions that relate to Pokémon. We shall be using functions from the previous section, to display the Pokémon, and also a new function of images will be included. Lets begin.

    if $>=1
    # This checks if you have 1 or more Pokémon.
    @sprites["Pkm1"] ="Graphics/Icons/icon%03d",$[0].species),2,128/2,64,2)
    # This line is creating the image of the first Pokémon in the party.
    # $[0].species is the first party, party numbers go 0-5.
    @sprites["Pkm1"].x = 20
    @sprites["Pkm1"].y = 20
    @sprites["Pkm1"].z = 999
    # This ends the check.
    This shows the current hp for the first Pokémon.
    This is the max hp value for the first Pokémon.
    This is seeing the value of the first Pokémons' first move pp amount. Moves are shown in the values 0-3
    0 being move 1 and 3 being move 4.
    Checks the max amount of pp for the first move of Pokémon 1.

    I will be adding more functions to this thread as I go along, for now, this is the basic info people may want. If you'd like anything else, please send a PM to me or post in this thread about what you would like, and I shall get back to you with the information on here.
    This signature has been disabled.
    Spoilers are not allowed in signatures.
    Please review and fix the issues by reading the signature rules.

    You must edit it to meet the limits set by the rules before you may remove the [sig-reason] code from your signature. Removing this tag will re-enable it.

    Do not remove the tag until you fix the issues in your signature. You may be infracted for removing this tag if you do not fix the specified issues. Do not use this tag for decoration purposes.
    Reply With Quote