Promiment Studios

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Promiment Studios

A forum for my team

Ok, I have decided to make a point system. The more points you have the more your appreciated and trusted.1-5 points I can trust you a little. very little aprreciation5-10 pointsI can trust more than usual. regular appreciation (credits)10-15 pointsI can trust you highly. Moderator20+CO-LEADER

    creating variables

    avatar
    Tacopie981--Admin
    Admin


    Posts : 23
    Join date : 2009-04-13

    creating variables Empty creating variables

    Post  Tacopie981--Admin Mon Apr 20, 2009 3:12 pm

    What is a variable? Variables are data structures that can hold one piece of data while your game is running. They can hold either a number or a string. Custom variables are variables made by you or whoever.

    There are two kinds of user variables

    Global variables that exist across the entire game

    Local variables which are defined in objects and only exist in-game within specific instances.

    Creating them

    There are many ways to create a variable. One is to use D&D by which you use the set variable buttion in the control tab.
    Another way is to use GML(coding).


    Ex(GML):
    ___________________________
    chocolate=4
    ___________________________

    If you want to know more PM me!

    Names:
    Variables can be up to 64 characters long im pretty sure. They can begin with a letter/number/underscore.




    Decrementing:
    Decrementing variables is to subtract one from a variable.

    Ways:
    ________________________

    chocolate -=1

    ________________________


    chocolate = chocolate - 1

    ________________________

    Incrementing:
    Incrementing is to add 1 to a variable.
    ways:


    _______________________

    chocolate +=1

    _______________________ I prefer the first way tongue

    chocolate = chocolate + 1

    _______________________




    Wrapping:
    This means you want a variable that only can have a value from 1 to 100. And it wraps it's value from 100 to 1.

    if ( chocolate > 100 )
    then chocolate = 1

    if (chocolate < 1 )
    then chocolate = 100


    Drawing:

    You can draw the value of a variable using GML(coding) function draw_text() or the Draw Variable action.

    Any questions PM me....

      Current date/time is Mon May 13, 2024 10:38 am