fg109 Posted February 22, 2011 Share Posted February 22, 2011 I'm a total beginner at modding so I'm not sure what I'm doing wrong. I tried to make a menu to display the stats of my companions but it's not working right. (If it matters, I'm using CM Partners Mod Basic and I know it already has a stats menu but I wanted to try making one of my own anyway.) I'm using an activator for the menu script as recommended here: http://cs.elderscrolls.com/constwiki/index.php/MessageBox_Tutorial I've followed the instructions there and I have an OnActivate block that sets up all the variables as well as a GameMode block that will display the actual menu. When I try to use it, it runs the OnActivate block (i can see it doing the stuff on the console) but not the GameMode block unless I use the moveto command to move the activator to me. After I move it next to me, I can use the menu just fine and everything works correctly. But I don't see the tutorial saying to do that at all, so am I doing something wrong or did the author just forget to mention it? Anyway, this is my script: Begin OnActivate set refpartner to cmPartnersQuest.StatsPartnerRef set npclevel to refpartner.GetLevel set npchealthbase to refpartner.GetBaseActorValue Health set npchealthcurrent to refpartner.GetActorValue Health set npcmagickabase to refpartner.GetBaseActorValue Magicka set npcmagickacurrent to refpartner.GetActorValue Magicka set npcfatiguebase to refpartner.GetBaseActorValue Fatigue set npcfatiguecurrent to refpartner.GetActorValue Fatigue set npcencumbrancebase to refpartner.GetBaseActorValue Encumbrance set npcencumbrancecurrent to refpartner.GetActorValue Encumbrance set npcagility to refpartner.GetActorValue Agility set npcendurance to refpartner.GetActorValue Endurance set npcintelligence to refpartner.GetActorValue Intelligence set npcluck to refpartner.GetActorValue Luck set npcpersonality to refpartner.GetActorValue Personality set npcspeed to refpartner.GetActorValue Speed set npcstrength to refpartner.GetActorValue Strength set npcwillpower to refpartner.GetActorValue Willpower set npcarmorer to refpartner.GetActorValue Armorer set npcathletics to refpartner.GetActorValue Athletics set npcblade to refpartner.GetActorValue Blade set npcblock to refpartner.GetActorValue Block set npcblunt to refpartner.GetActorValue Blunt set npchandtohand to refpartner.GetActorValue HandtoHand set npcheavyarmor to refpartner.GetActorValue HeavyArmor set npcalchemy to refpartner.GetActorValue Alchemy set npcalteration to refpartner.GetActorValue Alteration set npcconjuration to refpartner.GetActorValue Conjuration set npcdestruction to refpartner.GetActorValue Destruction set npcillusion to refpartner.GetActorValue Illusion set npcmysticism to refpartner.GetActorValue Mysticism set npcrestoration to refpartner.GetActorValue Restoration set npcacrobatics to refpartner.GetActorValue Acrobatics set npclightarmor to refpartner.GetActorValue LightArmor set npcmarksman to refpartner.GetActorValue Marksman set npcmercantile to refpartner.GetActorValue Mercantile set npcsecurity to refpartner.GetActorValue Security set npcsneak to refpartner.GetActorValue Sneak set npcspeechcraft to refpartner.GetActorValue Speechcraft set menuactivated to 1 set menunumber to 1 set choice to -1 set working to 1 End Begin GameMode if working > 0 set working to 1 if menuactivated == 1 set menuactivated to 0 set menudisplayed to 1 if menunumber == 1 MessageBoxEX "%n%rLevel %g%r%rHealth %g/%g%rMagicka %g/%g%rFatigue %g/%g%rEncumbrance %g/%g%r%r|Attributes|Combat Skills|Magic Skills|Stealth Skills|Close" refpartner npclevel npchealthcurrent npchealthbase npcmagickacurrent npcmagickabase npcfatiguecurrent npcfatiguebase npcencumbrancecurrent npcencumbrancebase elseif menunumber == 2 MessageBoxEX "ATTRIBUTES%r%rAgility %g%rEndurance %g%rIntelligence %g%rLuck %g%rPersonality %g%rSpeed %g%rStrength %g%rWillpower %g%r%r|Main|Combat Skills|Magic Skills|Stealth Skills|Close" npcagility npcendurance npcintelligence npcluck npcpersonality npcspeed npcstrength npcwillpower elseif menunumber == 3 MessageBoxEX "COMBAT SKILLS%r%rArmorer %g%rAthletics %g%rBlade %g%rBlock %g%rBlunt %g%rHand to Hand %g%rHeavy Armor %g%r%r|Main|Attributes|Magic Skills|Stealth Skills|Close" npcarmorer npcathletics npcblade npcblock npcblunt npchandtohand npcheavyarmor elseif menunumber == 4 MessageBoxEX "MAGIC SKILLS%r%rAlchemy %g%rAlteration %g%rConjuration %g%rDestruction %g%rIllusion %g%rMysticism %g%rRestoration %g%r%r|Main|Attributes|Combat Skills|Stealth Skills|Close" npcalchemy npcalteration npcconjuration npcdestruction npcillusion npcmysticism npcrestoration elseif menunumber == 5 MessageBoxEX "STEALTH SKILLS%r%rAcrobatics %g%rLightArmor %g%rMarksman %g%rMercantile %g%rSecurity %g%rSneak %g%rSpeechcraft %g%r%r|Main|Attributes|Combat Skills|Magic Skills|Close" npcacrobatics npclightarmor npcmarksman npcmercantile npcsecurity npcsneak npcspeechcraft endif endif if menudisplayed == 1 if choice == -1 set choice to GetButtonPressed Return elseif choice == 4 set menudisplayed to 0 set choice to -1 set working to 0 Return elseif menunumber == 1 if choice == 0 set menunumber to 2 elseif choice == 1 set menunumber to 3 elseif choice == 2 set menunumber to 4 elseif choice == 3 set menunumber to 5 endif set choice to -1 set menudisplayed to 0 set menuactivated to 1 Return elseif menunumber == 2 if choice == 0 set menunumber to 1 elseif choice == 1 set menunumber to 3 elseif choice == 2 set menunumber to 4 elseif choice == 3 set menunumber to 5 endif set choice to -1 set menudisplayed to 0 set menuactivated to 1 Return elseif menunumber == 3 if choice == 0 set menunumber to 1 elseif choice == 1 set menunumber to 2 elseif choice == 2 set menunumber to 4 elseif choice == 3 set menunumber to 5 endif set choice to -1 set menudisplayed to 0 set menuactivated to 1 Return elseif menunumber == 4 if choice == 0 set menunumber to 1 elseif choice == 1 set menunumber to 2 elseif choice == 2 set menunumber to 3 elseif choice == 3 set menunumber to 5 endif set choice to -1 set menudisplayed to 0 set menuactivated to 1 Return elseif menunumber == 5 if choice == 0 set menunumber to 1 elseif choice == 1 set menunumber to 2 elseif choice == 2 set menunumber to 3 elseif choice == 3 set menunumber to 4 endif set choice to -1 set menudisplayed to 0 set menuactivated to 1 Return endif endif endif End I didn't copy the variable declarations since it's large enough already as it is... Link to comment Share on other sites More sharing options...
fg109 Posted February 23, 2011 Author Share Posted February 23, 2011 (edited) BUMP My problem is that the GameMode block isn't running. Well I know that since the activator it's attached to is in a remote cell and not loaded, it normally shouldn't be running. But in the tutorial, it says that the script should run for 1 frame after you set a variable, and so if you keep setting a variable every frame then it will run. So that's what I tried to do with the "working" variable in my script, but it's not running it even 1 time after I first set the variable in the OnActivate block. So is the tutorial wrong and this method doesn't work? Or is my script too long to be run in one frame? Edited February 23, 2011 by fg109 Link to comment Share on other sites More sharing options...
whalecakes Posted February 23, 2011 Share Posted February 23, 2011 Problem:'if working > 0' Link to comment Share on other sites More sharing options...
Kdaj Posted February 23, 2011 Share Posted February 23, 2011 i've looked to the script code and... what's that? the script from visual basic? or C++? Link to comment Share on other sites More sharing options...
whalecakes Posted February 23, 2011 Share Posted February 23, 2011 ...that would be the scripting from Oblivion. Visual basic and C++ aren't even scripting languages... o_O Link to comment Share on other sites More sharing options...
fg109 Posted February 24, 2011 Author Share Posted February 24, 2011 (edited) I figured out what I was doing wrong; it's pretty stupid of me... I set it up so that I activated the script through dialogue, but dialogue is actually one of the menus in the game. And when I tried to activate it through the console, the console is also one of the menus in the game. In short, the script worked after I added a MenuMode block with the same code I put in the GameMode block. But now I have an unrelated question... I read on the construction set wiki that the game won't carry out but still process a script even when the condition function returns false. It said a way to get around it was like this: ;; optimized begin GameMode If (somecondition == 0) ;; logical negation RETURN endif (...some inefficient/complex algorithm...) end But suppose I had a long script with a lot of blocks of code, each one operating under different condition functions, inside the GameMode block. For example: if GetCombatTarget == Player ;some long block of code here endif if (GetAV Health) < (0.25 * (GetBaseAV Health)) ;another long block of code here endif If I did as in the example, then as soon as one of the conditions returned false, it wouldn't try to process any of the following blocks of code. So I thought of OBSE. If I use OBSE's label and goto functions, would the game still try to process all the code between them? Okay, I just thought of an analogy. Let's say that the script is a mall, each block of code is a store, and the game is a customer. From what I understand in the construction set wiki, this customer will inspect every item in every store he passes even if he decides not to buy anything when he enters the store. The return statement used to stop him from looking returns him to the entrance of the mall, and he never gets to the back stores where he might actually decide to buy something. Is there a way to make it so that if he decides to not buy something at store A, to move him along to store B without letting him inspect all the merchandise at store A? Edited February 24, 2011 by fg109 Link to comment Share on other sites More sharing options...
whalecakes Posted February 24, 2011 Share Posted February 24, 2011 The only way to stop it from processing is to use return, so you can't skip anything. Even with an if branch it still needs to go through find the endif that closes it.OBSE labels only let you jump backwards, I think, and it would still have to process things like opening/closing if branches. Link to comment Share on other sites More sharing options...
fg109 Posted February 24, 2011 Author Share Posted February 24, 2011 The only way to stop it from processing is to use return, so you can't skip anything. Even with an if branch it still needs to go through find the endif that closes it.OBSE labels only let you jump backwards, I think, and it would still have to process things like opening/closing if branches. OK, thanks for all your help! :thumbsup: Link to comment Share on other sites More sharing options...
Recommended Posts