Variables

    Share

    Guest
    Guest

    Variables

    Post by Guest on Thu Jul 16, 2009 9:20 pm

    After Monkeyuncle made his comment on my tutorial about variables, I decided to look them up, and realized not only are they simple, but basically useless for most spell scripts. That being the case, I still think that you should learn it bounce .

    Parts of a Variable
    • Variable Number - This is the first part of the Variable, it is either expressed as Short, Long, or Float. Short ranges from -32,768 to 32,767, long ranges from -2,147,483,648 to 2,147,483,647, and float is actually not used very often, because it has an extreme amount of inaccuracy, because it cannot go to a specific number, it must round all numbers to a certain number, creating inaccuracies. Long is pretty inaccurate as well, because variables will only read up to 7 digits, and long has 10, that means a 10 digit number will round at the 7th number. The best variable to use is often short. This all seems complicated, I know, so let me explain some things. You may be asking yourself, "what does the number represent Stickmenfalling?" well the number is whatever you desire it to be. In the variable you can assign the number to something the same way you would with a reference. We'll get to that next.

    • Variable Name - Variables actually work much like a reference, in fact, a reference is a special type of variable. So all you need to do in order to name a variable accurately, is to, well, name it. Variables, just like references, can have any name, but instead of the sole purpose of making the script more readable, variables are VERY useful for counting, like with time limits and percentage of health. You can declare a variable at any point on the script, as long as it comes before you use it in the actual script. However, it is best to have it just below the name of your script. A good tutorial name for our variable is "MyShortVariable", although you should use a name that is more specific to what you want to accomplish. This is how the variable should look now:

    Short MyShortVariable

    • Congratulations! You just declared a variable, easy as that. But that doesn't mean you understand the variable, does it? Well allow me to explain. With our current variable, we can have ANY number between -32,768 and 32,767, and I mean ANY number. If you wanted to have a countdown from 10, then short is your best number. You should always use short unless you absolutely NEED a number lower than -32,768 or higher than 32,767. Now we need to talk about actually using the variable in our script.

    • For this tutorial we are going to assign the variable to a command called GetRandomPercent. As far as I know, there is no short version of this name, like their is for Scriptname (scn) and reference (ref). Anyway, getrandompercent will return a random number between 0 and 99. We'll use our variable to simulate dice:

    Short MyShortVariable (We already declared our variable under our script's name, there is no need to do it twice. If it helps, you can rename it "dice")
    Set MyShortVariable to 1 + 0.06 * GetRandomPercent (in other words, 1 to 6)

    Please keep in mind that I have never actually used variables, as I think they aren't too useful for spell scripts, but they are useful for quests. As such, you should expect a couple of mistakes, if that is the case, either message me, Monkeyuncle (as he is more experienced in this matter), or go here. Thank you for your time, it may be a while for my next tutorial, as I'm going to be trying to learn some POWERFUL stuff geek .
    avatar
    Monkeyuncle8

    Posts : 468
    Skill points : 729
    Reputation : 22
    Join date : 2009-07-04
    Location : The last place you would look

    Re: Variables

    Post by Monkeyuncle8 on Thu Jul 16, 2009 9:31 pm

    one thing though float is only inacurite when it goes past SEVEN digets now if you want to declare a variable as a whole number then yes short is best


    _________________
    Always answer yes, unless no is required

    people are the embodyment of change, change and permenancy I am not differen't except in the ways that I am

    If I had a quarter every time I said if I had a nickle I would have five times the amout of theoretical money

    Guest
    Guest

    Re: Variables

    Post by Guest on Thu Jul 16, 2009 9:34 pm

    Haha only one correction? Must be doing something right Very Happy . OBSE is next on my list. Not necessarily a tutorial, unless it's for installing it Razz .
    avatar
    Monkeyuncle8

    Posts : 468
    Skill points : 729
    Reputation : 22
    Join date : 2009-07-04
    Location : The last place you would look

    Re: Variables

    Post by Monkeyuncle8 on Thu Jul 16, 2009 10:27 pm

    it is kinda a pain to open up oblivion and the construction set with obse, but it offers so much stuff, like you can change the type of a weapon, oh and do you know how to change variables in one script with another, just curious Question


    _________________
    Always answer yes, unless no is required

    people are the embodyment of change, change and permenancy I am not differen't except in the ways that I am

    If I had a quarter every time I said if I had a nickle I would have five times the amout of theoretical money
    avatar
    OblivionModda
    Admin

    Posts : 557
    Skill points : 964
    Reputation : 31
    Join date : 2009-06-08
    Age : 22
    Location : New Zealand

    Re: Variables

    Post by OblivionModda on Fri Jul 17, 2009 2:35 am

    Very Happy Great tutorial thanks. Question...does this mean that a Variable can be any name you want as long as you address this later on in your script and second what do the numbers do? Why would I use them and if I said MyShortVariable 1 to 0.06 then what would that do. Is it like a timer for things like quests when they are making scenes like when the Emperor is killed?


    _________________
    Fear Denies Fatih.

    Guest
    Guest

    Re: Variables

    Post by Guest on Fri Jul 17, 2009 8:09 am

    To Monkeyuncle: It's not too hard, just have to change the target location a little bit. And no, I don't know how to change the variable.

    To OblivionModda: Yes you can name it anything, as I said, as long as you keep using that name whenever you use the variable. And like I said in the tutorial, the numbers can be used for anything, and I don't know if that's what they did, it probably is but as I said, I don't use variables and so don't know much about them.
    avatar
    OblivionModda
    Admin

    Posts : 557
    Skill points : 964
    Reputation : 31
    Join date : 2009-06-08
    Age : 22
    Location : New Zealand

    Re: Variables

    Post by OblivionModda on Fri Jul 17, 2009 8:13 am

    Very Happy Thanks...clears things up a bit. By the way could you explain a little bit about how to use OBSE? You don't have too but I was wondering how people make mods with them and not the Construction Set. Is it completely Script based? Or do you get to have a look in game (or something just going on what you guys were saying).


    _________________
    Fear Denies Fatih.

    Guest
    Guest

    Re: Variables

    Post by Guest on Fri Jul 17, 2009 8:19 am

    All OBSE really does is add some new script commands to oblivion. OBSE stands for Oblivion Script Extender (I don't know where the letter "B" went, I guess it's included with the word "Oblivion"). But these script commands are VERY useful and powerful. As Monkeyuncle somewhat mentioned, you can actually make the game detect what kind of weapon they have equipped, but there are no standard commands that use it. If I were to make a tutorial for it, it would be only for showing you how to install it. However it seems to me that many of the OBSE commands use variables, which makes them kinda complicated.
    avatar
    OblivionModda
    Admin

    Posts : 557
    Skill points : 964
    Reputation : 31
    Join date : 2009-06-08
    Age : 22
    Location : New Zealand

    Re: Variables

    Post by OblivionModda on Fri Jul 17, 2009 8:21 am

    Yeah I kinda new that Laughing Thanks though.
    I guess I really have to brush up my scripting skills if I want to rule the world lol! nah but it would be nice Very Happy


    _________________
    Fear Denies Fatih.

    Guest
    Guest

    Re: Variables

    Post by Guest on Fri Jul 17, 2009 8:24 am

    One day they'll be eating out of the palms of our hands...muahahahaha!
    avatar
    OblivionModda
    Admin

    Posts : 557
    Skill points : 964
    Reputation : 31
    Join date : 2009-06-08
    Age : 22
    Location : New Zealand

    Re: Variables

    Post by OblivionModda on Fri Jul 17, 2009 8:42 am

    ahahaha Twisted Evil

    But first we need to kill that dancing Turtle
    |
    |
    |
    V


    _________________
    Fear Denies Fatih.

    Guest
    Guest

    Re: Variables

    Post by Guest on Fri Jul 17, 2009 9:35 am

    Yes...he is the only thing that can stop us...
    avatar
    OblivionModda
    Admin

    Posts : 557
    Skill points : 964
    Reputation : 31
    Join date : 2009-06-08
    Age : 22
    Location : New Zealand

    Re: Variables

    Post by OblivionModda on Fri Jul 17, 2009 12:05 pm

    I lol'd so hard when I read that ^^ heheheh Very Happy


    _________________
    Fear Denies Fatih.

    Guest
    Guest

    Re: Variables

    Post by Guest on Fri Jul 17, 2009 12:30 pm

    Hahaha. It's okay to spam on here because it's MY post and YOUR the Administrator.
    avatar
    OblivionModda
    Admin

    Posts : 557
    Skill points : 964
    Reputation : 31
    Join date : 2009-06-08
    Age : 22
    Location : New Zealand

    Re: Variables

    Post by OblivionModda on Fri Jul 17, 2009 1:13 pm

    Yeah Laughing
    By the way your up much later then usual Very Happy I was just watching Family Guy Laughing


    _________________
    Fear Denies Fatih.

    Guest
    Guest

    Re: Variables

    Post by Guest on Fri Jul 17, 2009 8:30 pm

    Yeah I was up pretty late haha.
    avatar
    Monkeyuncle8

    Posts : 468
    Skill points : 729
    Reputation : 22
    Join date : 2009-07-04
    Location : The last place you would look

    Re: Variables

    Post by Monkeyuncle8 on Fri Jul 17, 2009 8:59 pm

    I was watching family guy 2 last night


    _________________
    Always answer yes, unless no is required

    people are the embodyment of change, change and permenancy I am not differen't except in the ways that I am

    If I had a quarter every time I said if I had a nickle I would have five times the amout of theoretical money
    avatar
    psman012

    Posts : 335
    Skill points : 504
    Reputation : 20
    Join date : 2009-06-16
    Age : 22
    Location : Earth

    Re: Variables

    Post by psman012 on Fri Jul 17, 2009 9:14 pm

    I don't have cable. So I have to rely on Hulu Smile


    _________________
    "I know what you're thinking. "Did he fire six shots or only five?" Well, to tell you the truth, in all this excitement I kind of lost track myself. But being as this is a .44 Magnum, the most powerful handgun in the world, and would blow your head clean off, you've got to ask yourself one question: Do I feel lucky? Well, do ya, punk?"

    -Harry Callahan, Dirty Harry
    avatar
    OblivionModda
    Admin

    Posts : 557
    Skill points : 964
    Reputation : 31
    Join date : 2009-06-08
    Age : 22
    Location : New Zealand

    Re: Variables

    Post by OblivionModda on Sat Jul 18, 2009 3:22 pm

    hehe Yeah I was out all day but in NZ we family guy and the others are free Very Happy


    _________________
    Fear Denies Fatih.

    Guest
    Guest

    Re: Variables

    Post by Guest on Sat Jul 18, 2009 10:22 pm

    Family Guy is free here too! Smile
    avatar
    Monkeyuncle8

    Posts : 468
    Skill points : 729
    Reputation : 22
    Join date : 2009-07-04
    Location : The last place you would look

    Re: Variables

    Post by Monkeyuncle8 on Sat Jul 18, 2009 10:51 pm

    were a bit off topic


    _________________
    Always answer yes, unless no is required

    people are the embodyment of change, change and permenancy I am not differen't except in the ways that I am

    If I had a quarter every time I said if I had a nickle I would have five times the amout of theoretical money

    Guest
    Guest

    Re: Variables

    Post by Guest on Sun Jul 19, 2009 5:14 am

    We're off topic in about every post!
    avatar
    psman012

    Posts : 335
    Skill points : 504
    Reputation : 20
    Join date : 2009-06-16
    Age : 22
    Location : Earth

    Re: Variables

    Post by psman012 on Sun Jul 19, 2009 5:32 am

    Yeah, I know, really!


    _________________
    "I know what you're thinking. "Did he fire six shots or only five?" Well, to tell you the truth, in all this excitement I kind of lost track myself. But being as this is a .44 Magnum, the most powerful handgun in the world, and would blow your head clean off, you've got to ask yourself one question: Do I feel lucky? Well, do ya, punk?"

    -Harry Callahan, Dirty Harry
    avatar
    Monkeyuncle8

    Posts : 468
    Skill points : 729
    Reputation : 22
    Join date : 2009-07-04
    Location : The last place you would look

    Re: Variables

    Post by Monkeyuncle8 on Sun Jul 19, 2009 7:02 am

    not every topic I can think of about two or three that we have been on the same topic


    _________________
    Always answer yes, unless no is required

    people are the embodyment of change, change and permenancy I am not differen't except in the ways that I am

    If I had a quarter every time I said if I had a nickle I would have five times the amout of theoretical money

    Guest
    Guest

    Re: Variables

    Post by Guest on Sun Jul 19, 2009 7:15 am

    I wasn't being literal Monkeyuncle.

    Sponsored content

    Re: Variables

    Post by Sponsored content


      Current date/time is Sat Mar 25, 2017 5:10 pm