Script not running

Discussions and questions about the CS and mods for Oblivion
Locked
User avatar
DeadBread
Initiate
Initiate
Posts: 31
Joined: Sun Nov 28, 2010 11:49 pm
ES Games: Oblivion
Platform: PC

Script not running

Post by DeadBread »

I might be a bit of a noob here, but do I need to do anything special in the CS to make scripts run?

I can't figure out why this isn't running:
Scriptname AAATest
float fquestdelaytime
short doonce

Begin GameMode
if (doonce == 0)
message "Doonce is 0"
set doonce to 1

player.additem f 100
set fquestdelaytime to 60

End Gamemode
Thanks!
Spiney
Master
Master
Posts: 1498
Joined: Sun Jan 03, 2010 11:12 am
ES Games: Arena, Daggerfal, Redguard, Morrowind, Oblivion + DLC, Skyrim
Platform: PC, Xbox 360
Status: Laughing like every jokes my last
Location: Laughing at life
Contact:

Re: Script not running

Post by Spiney »

Hmm, well there's no EndIf and the end of the If clause. I think the script sequence is meant to skip any errors like that. Also what Item is being added? Also you had "End Gamemode", I don't think that is an actual operation. All you need is "End"

Try this:

Code: Select all

Scriptname AAATest
     float fquestdelaytime
     short doonce

Begin GameMode
     if (doonce == 0)
        message "Doonce is 0"
        set doonce to 1

        player.additem f 100
        set fquestdelaytime to 60
     EndIf

End 
Image
Aquatic Beauty
User avatar
Jeff
Grand Master
Grand Master
Posts: 4680
Joined: Wed Sep 06, 2006 2:35 pm
Status: Gone

Re: Script not running

Post by Jeff »

Ninja'd...

What are you trying to do?

Does it run in game? or What does it do? or what does it not do?

This will help the people that know Scripting better than I do, to help determine if the script is correct, or what you need to do to fix it.

It looks like you are wanting to add 100 Gold.
User avatar
DeadBread
Initiate
Initiate
Posts: 31
Joined: Sun Nov 28, 2010 11:49 pm
ES Games: Oblivion
Platform: PC

Re: Script not running

Post by DeadBread »

Sorry, I should've been more specific!
Yes, Jeff, the script is supposed to add 100 gold to the player every minute.
But the script doesn't run in game at all. I don't see the message that doonce is 0. Attempting 'set aaatest.doonce to 0' results in the engine saying that the variable doesn't exist!

Spiney, yeah, I forgot to put in the endif when I typed it!
I was under the assumption though that End basically signaled the end of the script, rather than the end of the GameMode block? I've seen other scripts that had End GameMode and the next block would be a Begin MenuMode that would run when any menus are open....
Spiney
Master
Master
Posts: 1498
Joined: Sun Jan 03, 2010 11:12 am
ES Games: Arena, Daggerfal, Redguard, Morrowind, Oblivion + DLC, Skyrim
Platform: PC, Xbox 360
Status: Laughing like every jokes my last
Location: Laughing at life
Contact:

Re: Script not running

Post by Spiney »

*IDEA* Your not setting doone to any value so the start of the script it is undefined, causing the script to never run.

Try this:

Code: Select all

Scriptname AAATest
     float fquestdelaytime
     short doonce

Begin GameMode
     set doonce to 0

     if (doonce == 0)
        message "Doonce is 0"
        set doonce to 1

        player.additem f 100
        set fquestdelaytime to 60
     EndIf

End 
Image
Aquatic Beauty
User avatar
Andere
Grand Master
Grand Master
Posts: 1603
Joined: Mon Mar 08, 2010 3:19 pm
ES Games: Morrowind GOTY, Oblivion GOTY, Skyrim
Platform: PC desktop
Status: Concerning games, restarting my engine
Location: Helsinki, Finland

Re: Script not running

Post by Andere »

Life is a comedy to those who think, a tragedy to those who feel. - Jean Racine
User avatar
DeadBread
Initiate
Initiate
Posts: 31
Joined: Sun Nov 28, 2010 11:49 pm
ES Games: Oblivion
Platform: PC

Re: Script not running

Post by DeadBread »

Spiney wrote:*IDEA* Your not setting doone to any value so the start of the script it is undefined, causing the script to never run.

Try this:

Code: Select all

Scriptname AAATest
     float fquestdelaytime
     short doonce

Begin GameMode
     set doonce to 0

     if (doonce == 0)
        message "Doonce is 0"
        set doonce to 1

        player.additem f 100
        set fquestdelaytime to 60
     EndIf

End 
Hm thanks for that! But it seems that the script isn't running at all, despite me specifically enabling the associated esp.

Thanks Andere for that link! It seems quite useful.
User avatar
PrinceShroob
Apprentice
Apprentice
Posts: 158
Joined: Wed Mar 17, 2010 7:58 pm
ES Games: Oblivion, Morrowind
Platform: Xbox 360, PC

Re: Script not running

Post by PrinceShroob »

You don't need to set "doonce" to 0 - all variables start at 0 by default.

Not to be rude, but did you attach the script to an object or quest?

Quest scripts should be set as such and attached to quests flagged as "start game enabled".

Object scripts should be defined as such and (if you want the script to run when the player isn't near the object) flagged as a quest item.

Oh - and your script will cease function after running once. You'll want:

Scriptname AAATest
float fquestdelaytime
short doonce

Begin GameMode

if (doonce == 0)
message "Doonce is 0"
set fQuestDelayTime to 60
set doonce to 1
[You can have "player.additem Gold001 100" here, if you want. Otherwise, the player will begin receiving gold one minute, five seconds into the start of the game.]
return
endif

player.additem f (You needn't put the base ID here - the editor ID, "Gold001" works as well) 100

End
User avatar
DeadBread
Initiate
Initiate
Posts: 31
Joined: Sun Nov 28, 2010 11:49 pm
ES Games: Oblivion
Platform: PC

Re: Script not running

Post by DeadBread »

PrinceShroob wrote:You don't need to set "doonce" to 0 - all variables start at 0 by default.

Not to be rude, but did you attach the script to an object or quest?

Quest scripts should be set as such and attached to quests flagged as "start game enabled".
End
So that's what I was doing wrong!
You're not rude at all! I just missed something very obvious!

Thanks for that!
Locked