Guest Jezzy Posted March 29, 2012 Posted March 29, 2012 hello i dont know if this is the right place to ask but, i'll never know until i try! im goofing around geck scripting for my personal version of jet classic and im trying to refresh a random number on a quest script that seem to run in background. short rnd begin gamemode set rnd to GetRandomPercent etc.. This works, my rnd variable is set once and wont change on each quest script tick and I don't understand why =>.<= thanks for your help ^.^
sen4mi Posted March 29, 2012 Posted March 29, 2012 You have not posted your quest here, so I cannot see it, and cannot know for sure. However, I suspect you have a script processing delay of 0. According to http://geck.bethsoft.com/index.php/Quest_scripts this means that your quest script gets processed every five seconds. (This is an edit: I wrote minutes here, originally) But something else might also be happening?
Guest Jezzy Posted March 29, 2012 Posted March 29, 2012 You have not posted your quest here' date=' so I cannot see it, and cannot know for sure. However, I suspect you have a script processing delay of 0. According to http://geck.bethsoft.com/index.php/Quest_scripts this means that your quest script gets processed every five minutes. But something else might also be happening? [/quote'] Here the script. Its only a editing of a existing script with a few sound effects and a edited visual impairement for the withdrawal effect. Im a total noob in scripting so maybe what im trying to do is impossible lol scn 00AddictionsTrackerScript short AddictedJet short AddictionStageJet float LastDoseJet short rnd begin gamemode set rnd to GetRandomPercent if player.IsSpellTarget WithdrawalJet == 1 && AddictedJet == 0 set AddictedJet to 1 endif if player.HasMagicEffect ChemIncAPJet > 0 set LastDoseJet to gamedayspassed set AddictionStageJet to 0 endif if AddictionStageJet > 1 if rnd <= 9 PlaySound 00JezzyAgitatedBreathing else if rnd == 55 PlaySound QstSunnySmilesDistantGecko else if rnd == 65 PlaySound NPCSuperMutantBehemothAttack01 else if rnd == 75 PlaySound FXExplosionCollar else if rnd == 85 PlaySound NPCSuperMutantBehemothTauntDemo else if rnd >= 90 PlaySound 00JezzySneezing endif endif if AddictionStageJet == 2 || AddictionStageJet == 3 ApplyImageSpaceModifier ARJetSweats else RemoveImageSpaceModifier ARJetSweats endif if AddictedJet == 1 && LastDoseJet < gamedayspassed - 0.05 && AddictionStageJet == 0 set AddictionStageJet to 1 showmessage ARJet1MSG endif if AddictedJet == 1 && LastDoseJet < gamedayspassed - 0.1 && AddictionStageJet == 1 set AddictionStageJet to 2 showmessage ARJet2MSG endif if AddictedJet == 1 && LastDoseJet < gamedayspassed -1 && AddictionStageJet == 2 set AddictionStageJet to 3 showmessage ARJet3MSG endif if AddictedJet == 1 && LastDoseJet < gamedayspassed -3 && AddictionStageJet == 3 set AddictionStageJet to 4 showmessage ARJet4MSG endif end
Tonoma Posted March 29, 2012 Posted March 29, 2012 Curious how you know the random number is not changing beyond the first time? I would have used PrintToConsole to verify that; I suspect you are assuming it is not changing when in fact it is changing. I glanced at JetClassic in FNVedit. This script, if you did not change it, originally ran at a default quest delay of 0 as sen4mi suspected. If so, it runs once every five seconds and not once per frame (would PlaySound work properly if called every frame - I have no idea how that works). But the real problem seems to be your if...elseif block since it is not how you probably intended it to be. Consider changing all the "==" therein to "<=" so that the next range of values trigger the code. Otherwise ran values such as 60, for example, have no affect and are skipped entirely. Now, a bigger problem yet is one that just happened to me two days ago, which is why I am responding to your posting. At least for me, if I am not imagining it, GECK did not properly compile "else if". It only accepts "elseif". No error message, but the script compiles and runs (somehow) both incorrectly and illogically - a particularly mean bug. I came close to abandoning my patch altogether out of frustration - a particularly hard-to-see error for those of us new to GECK.
sen4mi Posted March 29, 2012 Posted March 29, 2012 I tried replicating your bug with "else if" and I was able to reproduce a problem which seems like yours. I was able to delete the inner endif and geck accepted my unbalanced code. But we need one endif for each if.
prideslayer Posted March 30, 2012 Posted March 30, 2012 "else if" is wrong, "elseif" is correct. You have the first version several times in the addictionstage script. Because of that what you end up with is a *lot* of missing elseifs. This should explain more clearly, pay close attention to the indenting; this is your code, just reformatted to show the problem if AddictionStageJet > 1 if rnd <= 9 PlaySound 00JezzyAgitatedBreathing else if rnd == 55 PlaySound QstSunnySmilesDistantGecko else if rnd == 65 PlaySound NPCSuperMutantBehemothAttack01 else if rnd == 75 PlaySound FXExplosionCollar else if rnd == 85 PlaySound NPCSuperMutantBehemothTauntDemo else if rnd >= 90 PlaySound 00JezzySneezing endif endif This alone is screwing up everything after it in the script, so fix all of those first.
Halstrom Posted March 30, 2012 Posted March 30, 2012 Yep, learn to nest your if/else/endif's or you'll go insane (and others will hate reading your code)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.