Looking for some advice on Scripting: What do these errors m

Post » Sun Jun 17, 2012 4:51 pm

I'm pretty sure there are some global variables that the game updates. GameHour and stuff, I think (going by memory alone).

Cipscis
User avatar
Rudy Paint fingers
 
Posts: 3416
Joined: Sun Nov 11, 2007 1:52 am

Post » Sun Jun 17, 2012 6:27 pm

Just figured something intresting out: you need to put "function" in front of most script functions. Or not. I'm so confused.
User avatar
Bird
 
Posts: 3492
Joined: Fri Nov 30, 2007 12:45 am

Post » Sun Jun 17, 2012 9:41 pm

Hey Cipsis, I sure hope you're planning a Script validator again. That was invaluable when I poked around with the NV cs
User avatar
Trent Theriot
 
Posts: 3395
Joined: Sat Oct 13, 2007 3:37 am

Post » Sun Jun 17, 2012 6:05 pm

Alright, I've run into a problem, namely regarding how one should reference the player in a script.

If GetCurrentTime >= 20 || GetCurrentTime <= 6 && cohPhaseDay == 1SetStage(5)cohCanTransform == trueelseif GetCurrentTime <= 20 || GetCurrentTime >= 6 && cohPhaseDay == 0SetStage(0)cohCanTransform == falseendifif GetGlobalValue(PlayerIsWerewolf) == 1if cohCanTransform == trueWerewolfChangeEffect.Cast(game.getplayer, game.getplayer)elseif game.getplayer().HasMagicEffect(WerewolfChangeEffect) == 1 && cohCanTransform == falsegame.getplayer().DispelSpell(WerewolfChangeEffect)

These lines return several relevant errors


c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(30,31): a property cannot be used directly on a type, it must be used on a variablec:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(30,31): getplayer is not a property on script game or one of its parentsc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(30,47): a property cannot be used directly on a type, it must be used on a variablec:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(30,47): getplayer is not a property on script game or one of its parentsc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(31,24): type mismatch on parameter 1 (did you forget a cast?)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(31,61): cannot compare a none to a int (cast missing or types unrelated)No output generated for cohTransformTiming, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on cohTransformTiming
User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am

Post » Sun Jun 17, 2012 11:03 pm

Hmm, the wiki says

float timeOfDay = TimeOfDayGlobalProperty.GetValue()

should return the time of day. It's not working =(

Any suggestions?
User avatar
Fanny Rouyé
 
Posts: 3316
Joined: Sun Mar 25, 2007 9:47 am

Post » Mon Jun 18, 2012 3:48 am

scriptname cohTransformTiming extends Quest{Controls the Timing for transformation.}int property cohGetMoonPhase autofloat property cohPhaseDay autobool property cohCanTransform autobool property cohbmvar autoSpell property WerewolfChangeEffect auto;declaring propertiesEvent OnUpdateGameTime()RegisterForUpdateGameTime(5.0)float timeOfDay = TimeOfDayGlobalProperty.GetValue()cohGetMoonPhase = (( GameDaysPassed + ( TimeOfDay / 24 ) - 0.5 ) % 24 )cohPhaseDay = cohGetMoonPhase / 3;/List of moon phases returned by cohGetMoonPhase calculation0 = full moon1 = 3/4 waning2 = half waning3 = 1/4 waning4 = new moon5 = 1/4 waxing6 = half waxing7 = 3/4 waxing/;If game.GetCurrentTime() >= 20 || game.GetCurrentTime() <= 6 && cohPhaseDay == 1SetStage(5)cohCanTransform == trueelseif TimeOfDay <= 20 || TimeOfDay >= 6 && cohPhaseDay == 0SetStage(0)cohCanTransform == falseendifif GetGlobalValue(PlayerIsWerewolf) == 1if cohCanTransform == trueWerewolfChangeEffect.Cast(player, player)elseif game.getplayer().HasMagicEffect(WerewolfChangeEffect) == 1 && cohCanTransform == falsegame.getplayer().DispelSpell(WerewolfChangeEffect)endifendifEndEvent


Alright, that's where I'm at now. I resolved a few of the undefined errors, though only the spell effect ones. I'm still not sure how to declare Global Variables that are being used and altered in the script, which would clear up the other undefined errors. That leaves a few things I'm not so sure about, first and foremost how to apply a spell effect to a player; cast doesn't seem to want to take the player reference.


Starting 1 compile threads for 1 files...Compiling "cohTransformTiming"...c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(13,18): variable TimeOfDayGlobalProperty is undefinedc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(13,42): none is not a known user-defined typec:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(13,6): type mismatch while assigning to a float (cast missing or types unrelated)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(14,21): variable GameDaysPassed is undefinedc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(14,36): cannot add a none to a float (cast missing or types unrelated)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(14,57): cannot subtract a none from a float (cast missing or types unrelated)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(14,65): Cannot calculate the modulus of non-integersc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(14,0): type mismatch while assigning to a int (cast missing or types unrelated)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(28,8): GetCurrentTime is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(28,8): cannot call the member function GetCurrentTime alone or on a type, must call it on a variablec:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(28,25): cannot compare a none to a int (cast missing or types unrelated)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(28,25): cannot relatively compare variables to Nonec:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(28,39): GetCurrentTime is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(28,39): cannot call the member function GetCurrentTime alone or on a type, must call it on a variablec:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(28,56): cannot compare a none to a int (cast missing or types unrelated)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(28,56): cannot relatively compare variables to Nonec:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(35,18): variable PlayerIsWerewolf is undefinedc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(35,3): GetGlobalValue is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(35,36): cannot compare a none to a int (cast missing or types unrelated)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(37,26): variable player is undefinedc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(37,34): variable player is undefinedc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(38,24): type mismatch on parameter 1 (did you forget a cast?)c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\cohTransformTiming.psc(38,61): cannot compare a none to a int (cast missing or types unrelated)No output generated for cohTransformTiming, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on cohTransformTiming

These are the remaining errors I'm getting.
User avatar
Janette Segura
 
Posts: 3512
Joined: Wed Aug 22, 2007 12:36 am

Post » Mon Jun 18, 2012 4:11 am

I'm guessing, in that case, there is an existing property called TimeOfDayGlobalProperty that is associated with the correct global variable. How does your setup compare to that?

In order to reference the player, you need to use this, as you seem to have found:
Game.GetPlayer()

Be careful that you're using = (assignment) and == (comparison) appropriately - the script you posted above seems to be using == in some places where it should be using =. You're also missing parentheses on a couple of calls to Game.GetPlayer()

Cipscis
User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Previous

Return to V - Skyrim