Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Scripting Questions...?; my brain hurts
Topic Started: Sep 2 2009, 02:19 PM (152 Views)
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
K so im reading up on "scripting for dummies" and i feel like a bigger dummy for not understanding half of what this guy is saying... so i have some questions i hope you can answer...

Variables... example:
Begin my_first_script

Short controlvar

If ( OnActivate == 1 )
If ( controlvar == 0)
MessageBox "Voiceless it cries, wingless flutters, toothless bites, mouthless
mutters. What is it?", "Bat", "Old woman", "Wind", "Wraith"
Set controlvar to 1
endif
endif

End

I get that this message box will ask me the question and give me four answers but im confuesd abou what this other stuff means. Like, == 0 and == 1 ... what do these numbers mean? and controlvar?
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
lettuceman44
Member Avatar
Emperor
[ *  *  *  *  *  *  *  * ]
Alright, you gotta start from the beginning :P

In coding:
0 = false
1 = true

controlvar is a variable

Code:
 
Begin my_first_script

Short controlvar

If ( OnActivate == 1 )
If ( controlvar == 0)
MessageBox "Voiceless it cries, wingless flutters, toothless bites, mouthless
mutters. What is it?", "Bat", "Old woman", "Wind", "Wraith"
Set controlvar to 1
endif
endif

End


Code:
 

Begin my_first_script

Short controlvar


Ok, the first line is the name of your script. Scripts must always begin with "Begin (name)". Also don't use spaces, use underscores.
The second thing is declaring a variable. A variable is something that changes. You declare a variable by saying short(or another command which I won't get into here yet) and then variable name.

Code:
 

If ( OnActivate == 1 )
If ( controlvar == 0)
MessageBox "Voiceless it cries, wingless flutters, toothless bites, mouthless
mutters. What is it?", "Bat", "Old woman", "Wind", "Wraith"
Set controlvar to 1

Alright this next part is where all the things happen.
The like If ( OnActivate == 1) checks to see if the object the script is attached to has been activated. If it hasn't it = 0 and nothing happens. If it has, then it = 1 and the things underneath run.

If ( controlvar == 0 ) is next. If it = 0, it runs, if it equals anything else the rest of the code doesn't.

So if the above conditions are true, then the messageboxes appear, and then the variable controlvar is set to 1, so the code can't run again.
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
oh wow why could the guy who wrote the dang thing explain it like that? k now that i understand that im going back to the tutorial. im sure ill have more questions! thanks dude
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
*snip*

nevermind, the dude who wrote the tutorial screwed up on purpose *facepalm* this is so frustrating.

:( i just dont know... is there a list of commands i can look at to get a better understanding of what this all means? really i just dont get "else", "elseif", why you put "short" before words like controlvar or button, and am still a little confused about the variables.

maybe someone could explain this? and i need a test script... something i can try to do then maybe you could see if its right?



Edited by aceball69, Sep 2 2009, 05:47 PM.
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
lettuceman44
Member Avatar
Emperor
[ *  *  *  *  *  *  *  * ]
Just read the guide in order. It explains everything.

Your using version 9 right?
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
well it says 5th edition...? not sure what version. the one i have just pretty much throws me out in the deep end and expects me to swim
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
lettuceman44
Member Avatar
Emperor
[ *  *  *  *  *  *  *  * ]
Thats old....lol.

http://planetelderscrolls.gamespy.com/View.php?id=6083&view=Mods.Detail
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
oh! derrr... cool thanks ill read it through, but it looks pretty much the same so far
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
lettuceman44
Member Avatar
Emperor
[ *  *  *  *  *  *  *  * ]
Its quite different I assure you :P
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
ya you're right, i read through the tutorial and it was different. Im still pretty confused though :P but i guess i just have to keep practicing. but how do i practice when i dont know what to do? *shrug* :P
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
Unpleasant_Assailant
Member Avatar
Chief Global Moderator
[ *  *  *  *  *  *  * ]
Maybe you just aren't scripting material.... No just kidding. Keep going through the tutorial.... Also, look at premade scripts from other events in the game and see how they work. Disect each line of code and see what the guide says those tags and stuff do.
Posted Image
Offline Profile Quote Post Goto Top
 
vanir90210
Member Avatar
Budding Lyricist
[ *  *  *  *  *  *  * ]
Here's something you can try to do. Check to see if the character's strength is 100 or higher when activating a certain object, and if so, play a message and add a sword to the player's inventory.
Spoiler: click to toggle

Posted Image

"I look at the eyes, straight to the soul doorway"

Redsrock
 
Dammit, Vanir...... I had an awesome daydream of me and Anne Hathaway on a private island. And then in the daydream you came in and murdered her, then asking for my hand in marriage.
Offline Profile Quote Post Goto Top
 
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
thanks U_A, good idea. Vanir, thanks for the challenge, ill see what i can do ;) ill post back when i think im done then maybe you can check it.

oh and just to make sure, if i save a script thats not complete or is just for fun will it mess my game up?
Edited by aceball69, Sep 2 2009, 08:05 PM.
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
vanir90210
Member Avatar
Budding Lyricist
[ *  *  *  *  *  *  * ]
If it doesn't have 'end' at the end, or contains illegal syntax, it won't let you save. Otherwise, you're good.
Spoiler: click to toggle

Posted Image

"I look at the eyes, straight to the soul doorway"

Redsrock
 
Dammit, Vanir...... I had an awesome daydream of me and Anne Hathaway on a private island. And then in the daydream you came in and murdered her, then asking for my hand in marriage.
Offline Profile Quote Post Goto Top
 
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
Whadaya think?

Code:
 

Begin My_test_script

Short Controlvar

If (OnActivate == 1)
If (controlvar == 0)

If (Strength >= 100)
MessageBox "What a powerful being you are. Take this weapon!"
Player-> AddItem "katana_goldbrand_unique", 1
set controlvar to 1
elseif (controlvar ==1)
Activate
Endif

If (Strength < 100)
MessageBox "You are not worthy. Come back when you are much stronger."

Endif
Endif
Endif

End
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
lettuceman44
Member Avatar
Emperor
[ *  *  *  *  *  *  *  * ]
aceball69
Sep 3 2009, 12:03 PM
Whadaya think?

Code:
 

Begin My_test_script

Short Controlvar

if ( MenuMode == 1 ) ; added this so it wont run in menu mode which isn't needed, so it won't slow down the menu in anyway.
return
endif

If (OnActivate == 1)
If (controlvar == 0)

If (Strength >= 100)
MessageBox "What a powerful being you are. Take this weapon!"
Player-> AddItem "katana_goldbrand_unique", 1
set controlvar to 1
ElseIf (Strength < 100) ;Added this to go along with the first strength since its the same, seperate if isnt needed
MessageBox "You are not worthy. Come back when you are much stronger."
endif
ElseIf (controlvar == 1 ) ; Changed this so when first if isnt correct, it will automatically move onto this else if.
Activate
set controlvar to 2 ;Added controlvar to 2 so the script wont be able to run again
Endif



Endif

End


My comments are by the ;.

Also, what object are you activating?
Edited by lettuceman44, Sep 3 2009, 03:15 PM.
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
vanir90210
Member Avatar
Budding Lyricist
[ *  *  *  *  *  *  * ]
Instead of activate, do disable. Otherwise, you get the weapon(if it is a weapon) that is in the world as well as Goldbrand.
Spoiler: click to toggle

Posted Image

"I look at the eyes, straight to the soul doorway"

Redsrock
 
Dammit, Vanir...... I had an awesome daydream of me and Anne Hathaway on a private island. And then in the daydream you came in and murdered her, then asking for my hand in marriage.
Offline Profile Quote Post Goto Top
 
aceball69
Member Avatar
The Ace
[ *  *  *  *  *  *  * ]
i was thinking a chest i guess. thats why i added the "if (controlvar == 1) Activate". But i think you have a better idea to just end it after the player gets the sword cause chests are everywhere.

Vanir, sorry im not sure what you mean...?

ok lettuce, so you added the menu mode and return so it would stop processing the script every frame?

and then you added the set controlvar to 2 because if that wasnt there the player would be able to activate it and get the weapon as many times as they wanted, right?
"This might just feed the mother of all our needs"

Tri-shards of Weye- My first mod's unoficial WIP thread. check it out!

Best Oblivion Mod Ive ever stumbled across- Deadly Reflexes 5
How Cyrodiil SHOULD have been designed- Unique Landscapes

Offline Profile Quote Post Goto Top
 
vanir90210
Member Avatar
Budding Lyricist
[ *  *  *  *  *  *  * ]
Oh, if it's a chest nevermind. I was thinking you'd put a sword in the world with the script attached to it. Then, you'd be getting the sword AND Goldbrand.
Spoiler: click to toggle

Posted Image

"I look at the eyes, straight to the soul doorway"

Redsrock
 
Dammit, Vanir...... I had an awesome daydream of me and Anne Hathaway on a private island. And then in the daydream you came in and murdered her, then asking for my hand in marriage.
Offline Profile Quote Post Goto Top
 
lettuceman44
Member Avatar
Emperor
[ *  *  *  *  *  *  *  * ]
vanir90210
Sep 3 2009, 05:28 PM
Oh, if it's a chest nevermind. I was thinking you'd put a sword in the world with the script attached to it. Then, you'd be getting the sword AND Goldbrand.
What?


Activate has to do with what the actual object is.

For example, lets have a door. You put a script on the door that does something.

So it goes through the scripted thing
Activate makes the object do its original thing, which for the door is teleport you inside.

Disable has nothing to do with it.

edit: Why would you get goldbrand?
Edited by lettuceman44, Sep 3 2009, 05:45 PM.
Posted Image
Posted Image
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Elder Scrolls Modding and Construction Set Discussion · Next Topic »
Add Reply