Halstrom Posted December 3, 2014 Author Posted December 3, 2014 Don't use too many conditions in the same statement and avoid too many elseif in a row. It has been known to break (and answer select the wrong case). Nesting ifs should not be an issue, except the compiler will NOT complain you forgot an endif so indent well Nor will it complain if you add one extra endif in fact. I've got in the habit of commenting endif's if the matching if statement isn't visible on the same page. It saves a lot of confusion later when you add in more conditions, so you don't put them in the wrong nest.
prideslayer Posted December 3, 2014 Posted December 3, 2014 Is using too many if statements a bad thing? There's a mod I'm working with which involves more than three weapon mods and because of that I needed to make my own "mod" system. Basically what it should do is that depending on a key press, a mod menu should open up to change the weapon's mods, but there are three versions of the weapon, a 10 inch version, a 15 inch version and a 20 inch version, and each has different set of mods. Now here's what I do, I identify the weapon first, then depending on the options chosen in the menu it gets replaced with another version with the mod chosen, but then there are scenarios like this one. The weapon has a grip, and the player wants to add a silencer, so then it would have to check if the weapon is the 10,15 or 20 version and check if it has a grip in order to give the player a version that has both a grip and a silencer. I already saw how large and ugly it would be to check for all of those conditions for all three weapons, there were simply to many ifs, for something that should not be this complex. I thought about giving each mod option a number, and then selecting an index of an array with all the weapons with that number, but then the problem to check if it has a grip or not comes up, as well as I'm also not so sure what to do if the player wants to remove a mod and not just add it. I'd just do the ifs, but I want to see if I can figure out something else before resorting to that. What sort of "output" do you need from all this? I mean once the weapon is selected and the mods applied by the user, what's the end result? Edit: I mean are you changing the effect.. changing out the item to change the model.. all the above? I'm just wondering what kind of info you actually need, there is probably an easier way to dynamically build it without all the conditionals.
Guest Posted December 4, 2014 Posted December 4, 2014 Don't use too many conditions in the same statement and avoid too many elseif in a row. It has been known to break (and answer select the wrong case). Would you have something more specific about the "quantity" of elseif? In FO3 I'm using something like this: If A ;do code elseif B ;do code elseif C ;do code ... ... for about 70 times, I have 70 elseif. I can say they never broke (the script runs on a quest with 0.01 delay, I have an immediate visual result when the script executes and it's always correct), but since the number of elseif will increase, I would like to understand if I'm at risk or I'm still far from this "limit" of elseifs
DoctaSax Posted December 4, 2014 Posted December 4, 2014 Is using too many if statements a bad thing? There's a mod I'm working with which involves more than three weapon mods and because of that I needed to make my own "mod" system. Basically what it should do is that depending on a key press, a mod menu should open up to change the weapon's mods, but there are three versions of the weapon, a 10 inch version, a 15 inch version and a 20 inch version, and each has different set of mods. Now here's what I do, I identify the weapon first, then depending on the options chosen in the menu it gets replaced with another version with the mod chosen, but then there are scenarios like this one. The weapon has a grip, and the player wants to add a silencer, so then it would have to check if the weapon is the 10,15 or 20 version and check if it has a grip in order to give the player a version that has both a grip and a silencer. I already saw how large and ugly it would be to check for all of those conditions for all three weapons, there were simply to many ifs, for something that should not be this complex. I thought about giving each mod option a number, and then selecting an index of an array with all the weapons with that number, but then the problem to check if it has a grip or not comes up, as well as I'm also not so sure what to do if the player wants to remove a mod and not just add it. I'd just do the ifs, but I want to see if I can figure out something else before resorting to that. I'd go with a map let's say [0] == the10inchbase [1] == the15inchbase [2] == the20inchbase then step up a decimal for each type of mod, let's add 10 for grips [10] == theteninchwithgrip [11] == the15inchwithgrip [12] == the20inchwithgrip 100 for silencers [100] == teninchwithsilencer ; let's assume the 15inch doesn't have one [102] == 20inchwithsilencer obviously 110 for both [110] == the teninchwithboth etc if you need more mod types, just keep adding a decimal [1010] == teninchwithgripandbiggermagsbutnosilencer Then all you need to do is find the index number for the weapon with ar_Find, deduce what you want to know (if stuff can be added or removed) from the number, then step the number up or down, find the form for your new gun with map[number]. If some stuff is only available for some guns, get some ar_HasKey checks in to know if an option exists first. Edit: Because buttons in pre-made messageboxes can be dependent on conditions, you oughta look into using the index as a quest var condition there, so for instance a "remove" option shouldn't appear if index < 10 (but larger than -1 obviously).
RitualClarity Posted December 4, 2014 Posted December 4, 2014 Creeps into a thread that I probably shouldn't be in.. as i am such a noob I am not sure if this question applies to GECK scripting or not... Create an entry in the MCM Key Mapping in MCM If not can some of the wise individuals here point me to a source.. perhaps some tutorials etc to get me up to speed. Ducks and hides..
DoctaSax Posted December 4, 2014 Posted December 4, 2014 Creeps into a thread that I probably shouldn't be in.. as i am such a noob I am not sure if this question applies to GECK scripting or not... Create an entry in the MCM Key Mapping in MCM If not can some of the wise individuals here point me to a source.. perhaps some tutorials etc to get me up to speed. Ducks and hides.. You're such an experienced noob by now MCM comes with a guide on how to use it, either in the download or on the page. It gives you basic layout, to see how things are done in practice you can have a look at some of ours, try to figure out what does what.
RitualClarity Posted December 4, 2014 Posted December 4, 2014 Thanks Docta, Experienced player, and understand pretty well basic processes and what is going on however not the actual scripting or modding experience I was just looking at the guide. I don't see a key mapping feature described there. Guess I will have to look over some of the mods after I figure out this scripting thing... and actually load the GECK... It would be difficult to check the scripts without it.. On a different note.. well still follows scripting etc. Since scripting isn't advised to be done directly in the GECK unless you want to loose your sanity. Someone in RL advised I try Notepad ++ as it has some checks etc for scripts and such including C+ and Perl etc. Is this a good idea to work with this.. I can then keep copies easier and if .. correction .. when GECK freaks out I can just copy it back again. Also what scripting language is MCM and everybody using/ advising? I know next to nothing about scripting so I would need to check up on some of the rules etc. It would be better if I focus on what is being used. I know there might be many flavors being used currently.
DoctaSax Posted December 4, 2014 Posted December 4, 2014 Yeah, I use NP++ myself, along with this As to language, it's just beth language man, it's unlike anything else - why d'you think all these pro coders keep bitching about it?
RitualClarity Posted December 4, 2014 Posted December 4, 2014 So then tutorials on the GECK is where I would need to focus on (script wise) .. I need to look over the various tutorials anyway for basic functionality. Got the tool installed to Notepad ++ Hope I did it right.
Guest Posted December 4, 2014 Posted December 4, 2014 About MCM, may I suggest you to compare the script inside the guide with the one actually present inside one of the 3 examples included (specifically the first ESP, you don't need complicated stuff). It helped me more than the guide itself. For key mapping, check the various "types" you have in MCM: the "3" is the one you are looking for.
Halstrom Posted December 4, 2014 Author Posted December 4, 2014 Creeps into a thread that I probably shouldn't be in.. as i am such a noob I am not sure if this question applies to GECK scripting or not... Create an entry in the MCM Key Mapping in MCM If not can some of the wise individuals here point me to a source.. perhaps some tutorials etc to get me up to speed. Ducks and hides.. You're such an experienced noob by now MCM comes with a guide on how to use it, either in the download or on the page. It gives you basic layout, to see how things are done in practice you can have a look at some of ours, try to figure out what does what. Yeah you should have finished the Alpha for an Alien Breeder Episode by now, just pick a spot in NewVegas and plonk som Aliens and/or Robots down with a small spacecraft/base and start poking with them Shall I line up Aliens or Robots to be next Pregnancies added to the Pregnancy Beta for you? Umm, dumb question do we have Animations or at least Animationless Sex capability for either yet? Mind you being aliens they may not need to even use Sex to impregnate.
RitualClarity Posted December 4, 2014 Posted December 4, 2014 About MCM, may I suggest you to compare the script inside the guide with the one actually present inside one of the 3 examples included (specifically the first ESP, you don't need complicated stuff). It helped me more than the guide itself. For key mapping, check the various "types" you have in MCM: the "3" is the one you are looking for. Are you talking about the third esm or "3" in the tutorials. I looked through it and know it is way more advanced than my level of understanding can gather info. It will take dozens of readings and various other examples before I start to comprehend. Fortunately I don't have to comprehend I can type away like a mad monkey so long as I get somewhere and get something to work. I can do this by finding others examples and seeing what they have and what I need and copy /edit that to get the basic job done. By checking other works can get a basic understanding. It will take a load of time though. Creeps into a thread that I probably shouldn't be in.. as i am such a noob I am not sure if this question applies to GECK scripting or not... Create an entry in the MCM Key Mapping in MCM If not can some of the wise individuals here point me to a source.. perhaps some tutorials etc to get me up to speed. Ducks and hides.. You're such an experienced noob by now MCM comes with a guide on how to use it, either in the download or on the page. It gives you basic layout, to see how things are done in practice you can have a look at some of ours, try to figure out what does what. Yeah you should have finished the Alpha for an Alien Breeder Episode by now, just pick a spot in NewVegas and plonk som Aliens and/or Robots down with a small spacecraft/base and start poking with them Shall I line up Aliens or Robots to be next Pregnancies added to the Pregnancy Beta for you? Umm, dumb question do we have Animations or at least Animationless Sex capability for either yet? Mind you being aliens they may not need to even use Sex to impregnate. @Halstrom Ha.. User wasn't going to touch that as it was too complex to do with is skill and he changed entire world spaces... There are no animations, genitalia or any formlist/ references for aliens in Sexout currently. ( Kendo2 does have an abomination body that might be able to be used if it is still released and available )That would require a whole system to be set up before I can just plonk some aliens and/or Robots down in some world space and start poking with them.. At least from my understanding of the current level of Sexout and its abilities. that would require me to also learn 3DMax.. I might be an alien but your strange technology is just to difficult for me to take on all at once.. Oh we aliens might not need sex to impregnate.. even you humans have artificial insemination.. however that don't mean we don't want to have sex and impregnate.
Guest Posted December 4, 2014 Posted December 4, 2014 The first ESP should be enough (MCM Example Menu.Esp). The "3" I was referring is the "Type" you need for keymapping, you can find it on the bottom of Page 6 in the guide (page 9 if you look at the page numbers of Word) "Type 3 uses a keyboard/mouse button display. When the user selects the option, a prompt to “Press the new control for this action” is displayed." --- PS... since you talk about aliens... The alien skeleton is pretty similar to the human one. I'm pretty sure that you could invoke whatever animation you want and it will play fine enough, since the bone names are the sames
RitualClarity Posted December 4, 2014 Posted December 4, 2014 SetUIFloat "StartMenu/MCM/*:1/*:3/_enable" 1 SetUIString "StartMenu/MCM/*:1/*:3/_title" "Option 3" SetUIFloat "StartMenu/MCM/*:1/*:3/_type" 3 SetUIStringEx "StartMenu/MCM/*:1/*:3/value/*:1/string" "%k" iVariable3 Thanks I see it.. don't know what it means now but I see it at least.. .. I will at least now be able to look back as I slowly learn the scripting I need to do. I might have to put that on a back burner and play with records and such first. Maybe some other task as well. It will be awhile before I am able to do anything serious.. (Like Halstroms Alien Breeder Alpha.. lol)
Guest Posted December 4, 2014 Posted December 4, 2014 Don't worry you don't need to understand every line of the MCM script: it is for most of the time some copy paste, and you just need to change few values. However I guess that before starting with that, you should make easier things with scripts. PS I was curious so I just tried, the experiment failed. The alien is refusing most of the animations I invoke on him, all he does is bending a bit the neck... concerning how his skeleton is made, it doesn't make a lot of sense to me. Well it was just to make an experiment, I think it is not so much important until someone doesn't tell there's some interest on it
RitualClarity Posted December 4, 2014 Posted December 4, 2014 However I guess that before starting with that, you should make easier things with scripts. I will look over various scripts and such to get a better idea of what is going on and perhaps check the links as well from the OP which covers the GECK and such. It will take time. I agree that most of the work will be simply copy and paste and changing the necessary parts to get the MCM to work the way I want it to. I think when I load up the GECK (install) and start to look at a few of the mods with what I want showing in the MCM i will be better able to see what is going on as these will be real working models and their changes will be helpful to see what I need to do to get mine the way I want it. Then if all else fails and I have a copy of what I think should work I can post it here in a nice spoiler for all to laugh at.. hum... assist with.. . It will be likely some minor glitch like an punctuation or command that was missing/needed to be changed as well.
Guest Posted December 4, 2014 Posted December 4, 2014 If you are drowning in confusing lines of weird code, I'm pretty sure someone will help you or even write you the script if you need it. Or at least I talk for me, I would do it if it's something I can do.
Halstrom Posted December 4, 2014 Author Posted December 4, 2014 @Halstrom Ha.. User wasn't going to touch that as it was too complex to do with is skill and he changed entire world spaces... There are no animations, genitalia or any formlist/ references for aliens in Sexout currently. ( Kendo2 does have an abomination body that might be able to be used if it is still released and available )That would require a whole system to be set up before I can just plonk some aliens and/or Robots down in some world space and start poking with them.. At least from my understanding of the current level of Sexout and its abilities. that would require me to also learn 3DMax.. I might be an alien but your strange technology is just to difficult for me to take on all at once.. Oh we aliens might not need sex to impregnate.. even you humans have artificial insemination.. however that don't mean we don't want to have sex and impregnate. Those ET fingers they use for peni
Halstrom Posted December 4, 2014 Author Posted December 4, 2014 SetUIFloat "StartMenu/MCM/*:1/*:3/_enable" 1 SetUIString "StartMenu/MCM/*:1/*:3/_title" "Option 3" SetUIFloat "StartMenu/MCM/*:1/*:3/_type" 3 SetUIStringEx "StartMenu/MCM/*:3/*:3/value/*:1/string" "%k" iVariable3 Thanks I see it.. don't know what it means now but I see it at least.. .. I will at least now be able to look back as I slowly learn the scripting I need to do. I might have to put that on a back burner and play with records and such first. Maybe some other task as well. It will be awhile before I am able to do anything serious.. (Like Halstroms Alien Breeder Alpha.. lol) See above the most common mistake I've made in MCM scripts (putting 3 in wrong place on last line)
prideslayer Posted December 4, 2014 Posted December 4, 2014 MCMs interface is a real error-prone nightmare to be sure, but like with most things, it's better than what we had before. I'm sure with the NVSE changes in place now, MCM scripts could be made MUCH nicer. Stuff all those outrageous strings somewhere else, auto-construct them with NVSE concatenation and avoid all the printf weirdness, etc. 1
jaam Posted December 4, 2014 Posted December 4, 2014 Don't use too many conditions in the same statement and avoid too many elseif in a row. It has been known to break (and answer select the wrong case). Would you have something more specific about the "quantity" of elseif? In FO3 I'm using something like this: If A ;do code elseif B ;do code elseif C ;do code ... ... for about 70 times, I have 70 elseif. I can say they never broke (the script runs on a quest with 0.01 delay, I have an immediate visual result when the script executes and it's always correct), but since the number of elseif will increase, I would like to understand if I'm at risk or I'm still far from this "limit" of elseifs No definitive figures. For example, used to be Sexout Brutal Rapers main script begining was a very long elseif with multiple conditions on each test. After realizing it was selecting the wrong condition a lot of the time, it was reversed to be a series of independent ifs, with only one condition per line. It's possible the cure was overkill but it did stop the issue.
prideslayer Posted December 4, 2014 Posted December 4, 2014 I ran into a similar situation in the old sexout random picker, and in some other mod I was working on as well. It was a huge if/elseif/elseif/elseif/.../endif construct. I just broke it up into smaller ones that that solved the issue, I think I limited myself to 20 or 30 elseif's before starting over with a fresh 'if'.
RitualClarity Posted December 4, 2014 Posted December 4, 2014 If you are drowning in confusing lines of weird code, I'm pretty sure someone will help you or even write you the script if you need it. Or at least I talk for me, I would do it if it's something I can do. I am sure I can get good directions when I start. There is a very small project that I need to do but mostly scripts. (old mod... hint, hint) and might also look into making sure it is NX compatible for going forward as well. All easy for someone like you A.J or others .. but a mountain of work for a tiny alien to do.. .. Anyway.. I will try to do most of it by myself as a good learning experience. With me the more mistakes I make the better I become and the more I learn. I will likely post the work in a thread etc if I run into any issue provided I start the project.. (which I really want to start .. getting board of playing games. Want to work on some content. ) If you are curious A.J.. Entry of the mod into MCM along with a simple key map for an action the mod gives. Instead of using the key "X".. (hint).. the user can choose their key of choice... That is literally it. Simple yes for someone that knows a good exercise for those that don't .. I am sure most here can figure out what I want to do.. please don't mention it.. Don't want to be hounded by members asking when it will be done as I don't know how long it will take for me to do it.
Guest Posted December 5, 2014 Posted December 5, 2014 (old mod... hint, hint) Old mod? which involve key mapping... mmmh... ... ... ... Sprint mod? Instead of using the key "X".. (hint).. the user can choose their key of choice... Oh, X, I got it! it's not Sprint Mod. This is Bullet Time, definetely... Btw did you see that pic full of crawlers I uploaded? I find it incredibly funny
RitualClarity Posted December 5, 2014 Posted December 5, 2014 @A.J I haven't seen any crawlers that you uploaded.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now