# Variables

Guest
Guest

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 .

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 .

Monkeyuncle8

Posts : 468
Skill points : 729
Reputation : 22
Join date : 2009-07-04
Location : The last place you would look
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

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

Monkeyuncle8

Posts : 468
Skill points : 729
Reputation : 22
Join date : 2009-07-04
Location : The last place you would look
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

_________________
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

OblivionModda

Posts : 557
Skill points : 964
Reputation : 31
Join date : 2009-06-08
Age : 24
Location : New Zealand
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

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.

OblivionModda

Posts : 557
Skill points : 964
Reputation : 31
Join date : 2009-06-08
Age : 24
Location : New Zealand
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

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.

OblivionModda

Posts : 557
Skill points : 964
Reputation : 31
Join date : 2009-06-08
Age : 24
Location : New Zealand
Yeah I kinda new that Thanks though.
I guess I really have to brush up my scripting skills if I want to rule the world nah but it would be nice

_________________
Fear Denies Fatih.

Guest
Guest

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

OblivionModda

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

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

_________________
Fear Denies Fatih.

Guest
Guest

Yes...he is the only thing that can stop us...

OblivionModda

Posts : 557
Skill points : 964
Reputation : 31
Join date : 2009-06-08
Age : 24
Location : New Zealand
I lol'd so hard when I read that ^^ heheheh

_________________
Fear Denies Fatih.

Guest
Guest

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

OblivionModda

Posts : 557
Skill points : 964
Reputation : 31
Join date : 2009-06-08
Age : 24
Location : New Zealand
Yeah
By the way your up much later then usual I was just watching Family Guy

_________________
Fear Denies Fatih.

Guest
Guest

Yeah I was up pretty late haha.

Monkeyuncle8

Posts : 468
Skill points : 729
Reputation : 22
Join date : 2009-07-04
Location : The last place you would look
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

psman012

Posts : 335
Skill points : 504
Reputation : 20
Join date : 2009-06-16
Age : 23
Location : Earth
I don't have cable. So I have to rely on Hulu

_________________
"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

OblivionModda

Posts : 557
Skill points : 964
Reputation : 31
Join date : 2009-06-08
Age : 24
Location : New Zealand
hehe Yeah I was out all day but in NZ we family guy and the others are free

_________________
Fear Denies Fatih.

Guest
Guest

Family Guy is free here too!

Monkeyuncle8

Posts : 468
Skill points : 729
Reputation : 22
Join date : 2009-07-04
Location : The last place you would look
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

We're off topic in about every post!

psman012

Posts : 335
Skill points : 504
Reputation : 20
Join date : 2009-06-16
Age : 23
Location : Earth
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

Monkeyuncle8

Posts : 468
Skill points : 729
Reputation : 22
Join date : 2009-07-04
Location : The last place you would look
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

I wasn't being literal Monkeyuncle.