Page 1 of 1
Script not running
Posted: Sat Dec 25, 2010 12:05 pm
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!
Re: Script not running
Posted: Sat Dec 25, 2010 2:22 pm
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
Re: Script not running
Posted: Sat Dec 25, 2010 2:27 pm
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.
Re: Script not running
Posted: Sat Dec 25, 2010 3:13 pm
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....
Re: Script not running
Posted: Sat Dec 25, 2010 4:06 pm
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
Re: Script not running
Posted: Sat Dec 25, 2010 4:52 pm
by Andere
Re: Script not running
Posted: Sat Dec 25, 2010 11:57 pm
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.
Re: Script not running
Posted: Sun Dec 26, 2010 5:27 am
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
Re: Script not running
Posted: Sun Dec 26, 2010 2:52 pm
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!