Jump to content

Scripts help


Deleted945227User

Recommended Posts

hi there, i'm new in the forums, and i did not made any search in the forums related to what i will ask, and also i don't know if i'm making this question i the right forum, for that i'm sorry...

 

heres my trouble:

 

anyone knows here can i find a tutorial for scripting?

or anything that explain a bit how the sintax works on the script code??

i have a bit of knowledge on "C PROGRAMMING" and for what i saw in the code of the scripts i don't think it will be to hard to learn, and do a little magic, but i could use some info about the sintax or functions:

 

for example:

 

i downloaded a mod from nexus called "empties" ( http://fallout3nexus.com/downloads/file.php?id=2164 ), that gives the player empty bottles after drinking. i saw that the autor created diferent script files, each script to a specific bottle. i'm trying to make only one script file with everything inside it, i tried to do it, but i found out that each time i drink a bottle of beer i received an empty beer bottle and also other empty bottles; tried to fix it but i could not do it because i don't know exactly how the script code works, i was trying to write a piece of code like this:

 

use a variable that receives a number diferent than ZERO (like boolean, receiving TRUE), and use that variable to confirm wich empty bottle to use (a bit like the SWITCH statment in C), but the main problem i found is that i don't know the sintax that would make the variable receive the "information"...

for better explaining: in C PROGRAMMING if we want to receive "info" from the keyboard we can use the function "scanf()", and the value of the keyboard will be saved in a variable, then used were we want....

 

i don't know if i explained very well whats my problem, i'm not english so i can't explain to well like i can in my language...

 

waiting for any feedback ... and thanks for your time reading this...

Link to comment
Share on other sites

hi there, i'm new in the forums, and i did not made any search in the forums related to what i will ask, and also i don't know if i'm making this question i the right forum, for that i'm sorry...

 

heres my trouble:

 

anyone knows here can i find a tutorial for scripting?

or anything that explain a bit how the sintax works on the script code??

i have a bit of knowledge on "C PROGRAMMING" and for what i saw in the code of the scripts i don't think it will be to hard to learn, and do a little magic, but i could use some info about the sintax or functions:

 

for example:

 

i downloaded a mod from nexus called "empties" ( http://fallout3nexus.com/downloads/file.php?id=2164 ), that gives the player empty bottles after drinking. i saw that the autor created diferent script files, each script to a specific bottle. i'm trying to make only one script file with everything inside it, i tried to do it, but i found out that each time i drink a bottle of beer i received an empty beer bottle and also other empty bottles; tried to fix it but i could not do it because i don't know exactly how the script code works, i was trying to write a piece of code like this:

 

use a variable that receives a number diferent than ZERO (like boolean, receiving TRUE), and use that variable to confirm wich empty bottle to use (a bit like the SWITCH statment in C), but the main problem i found is that i don't know the sintax that would make the variable receive the "information"...

for better explaining: in C PROGRAMMING if we want to receive "info" from the keyboard we can use the function "scanf()", and the value of the keyboard will be saved in a variable, then used were we want....

 

i don't know if i explained very well whats my problem, i'm not english so i can't explain to well like i can in my language...

 

waiting for any feedback ... and thanks for your time reading this...

 

 

Well thats easy.

 

Make a new script and write something like this:

 

if getisid bottle01 == 1

 

copy script 1 here

 

if getisid bottle02 == 1

 

copy script 2 here

 

and so on

Link to comment
Share on other sites

Yossarian22 is right that GetIsID is the function that you want to use here. However, using " == 1" is unnecessary. If GetIsID returns a value of 1, then the condition will evaluate to true and the code contained within the "if" statement will run. Using "if GetIsID == 1" is essentially saying "if (GetIsID is true) is true", which is obviously unnecessary as all you need is essentially "if (GetIsID is true)".

 

Cipscis

 

EDIT:

 

The GECK Wiki is probably the best place to look up functions and scripting syntax for Fallout 3. The FOSE team has also put together a list of Fallout 3 Functions that was pulled from the v1.0 exe (it's missing some functions added by the patch but is otherwise complete and very useful), and if you're using FOSE then you'll want to use their Function Documentation as well.

 

There aren't many scripting tutorials on the GECK Wiki yet, but the scripting syntax of Fallout 3 is pretty much identical to that of Oblivion, so the Oblivion CS Wiki is a good place to look for scripting tutorials.

 

A good place to ask about scripting problems, if you're having trouble, is the Official GECK Forum. You'll probably find that you get more help there when it comes to Fallout 3 scripting problems than you will anywhere else.

 

Cipscis

Link to comment
Share on other sites

Yossarian22 is right that GetIsID is the function that you want to use here. However, using " == 1" is unnecessary. If GetIsID returns a value of 1, then the condition will evaluate to true and the code contained within the "if" statement will run. Using "if GetIsID == 1" is essentially saying "if (GetIsID is true) is true", which is obviously unnecessary as all you need is essentially "if (GetIsID is true)".

 

Well, it's a matter of taste I guess, both should work. I always use getisid == 1 and never had problems with it.

Link to comment
Share on other sites

So long as the function or equality you're using can only return a value of 0 or 1, then you won't have a problem. This is because "((X is true) is true)" is equal to (X is true)" (or "((X == 1) == 1) == (X == 1)" returns true). They will return the same value, but you're doing an extra unnecessary check.

 

The only time in which using " == 1" is necessary or advisable is when you're looking specifically for a value of 1. For example, if you're checking the return value of a function like GetLastPlayerAction, which can return values other than 0 and 1. If you just want to check if a function or equality returns true, then you shouldn't use " == 1".

 

While you could argue that it's a matter of personal taste, I personally think it's more a matter of habit. Including an unnecessary " == 1" might not be a very big deal, but something that does nothing other than make your script larger and less efficient is just wrong.

 

Cipscis

 

EDIT:

 

Sorry, I'm not trying to sound arrogant and just say "you're wrong, I'm right", but using " == 1" in a case like this really doesn't add anything to a script, it just makes it larger and less efficient. I hope this hasn't sounded like a personal attack or anything because that's really not my intention at all.

 

Cipscis

Link to comment
Share on other sites

So long as the function or equality you're using can only return a value of 0 or 1, then you won't have a problem. This is because "((X is true) is true)" is equal to (X is true)" (or "((X == 1) == 1) == (X == 1)" returns true). They will return the same value, but you're doing an extra unnecessary check.

 

The only time in which using " == 1" is necessary or advisable is when you're looking specifically for a value of 1. For example, if you're checking the return value of a function like GetLastPlayerAction, which can return values other than 0 and 1. If you just want to check if a function or equality returns true, then you shouldn't use " == 1".

 

While you could argue that it's a matter of personal taste, I personally think it's more a matter of habit. Including an unnecessary " == 1" might not be a very big deal, but something that does nothing other than make your script larger and less efficient is just wrong.

 

Cipscis

 

EDIT:

 

Sorry, I'm not trying to sound arrogant and just say "you're wrong, I'm right", but using " == 1" in a case like this really doesn't add anything to a script, it just makes it larger and less efficient. I hope this hasn't sounded like a personal attack or anything because that's really not my intention at all.

 

Cipscis

 

Well, i am always willing to learn. So, if this is true^^ like you said, I will change it in future, coz it saves also little of typing.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...