Jump to content

Possible max on elseif?


Interfer0

Recommended Posts

							
if ( chance >= 0 && chance <=2)
ShowMessage play01
                                        

elseif ( chance >= 3 && chance <=9)
ShowMessage play02
                                      

elseif ( chance >= 10  && chance <=40)

ShowMessage play03
                                        

elseif ( chance >= 41 && chance <=163)

ShowMessage play04
                                        

elseif ( chance >= 164 && chance <=652)
				
        ShowMessage play05
                                        

elseif ( chance >= 653 && chance <=2606)
						
ShowMessage play06
                                        
elseif ( chance >= 2607 && chance <=10419)
						
ShowMessage play07
                                        

elseif ( chance >= 10420 && chance <=41670)
						
ShowMessage play08
                                        

elseif ( chance >= 41671 && chance <=166671)
						
ShowMessage play09

elseif ( chance >= 166672 && chance <=666672)
ShowMessage play10

;elseif [ chance >= 666673 && chance <=1000000]
                                   
        ;ShowMessage play11

endif

 

 

Problem is when I take the ; off of the last elseif, and the chance lands between those two.

The last message won't play, and it exits out of the script. The game then disables the script from running.

Even if you load a new save game, the script won't run.

 

I know its easy to work around, but its still good info to know.

Link to comment
Share on other sites

Wow I was way off, when I finally found it I wants to bust my keyboard in two. I hate making stupid mistakes!

 

I'll be in the corner crying.

 

Lets see who else can find it. Its A LOT most obvious on here then in the GECK.

Link to comment
Share on other sites

was it the []?

 

and also I think you could get the same effect without all the "&& chance <= x" by inverting your ifs

go in descending order, like...

if chance >= 666673
ShowMessage play01


elseif chance >= 166672
ShowMessage play02
;etc

 

instead of

if ( chance >= 0 && chance <=2)
ShowMessage play01


elseif ( chance >= 3 && chance <=9)
ShowMessage play02
;etc

Link to comment
Share on other sites

I'm curious, what sort of variable are you using for "chance"? According to the GECK Wiki, "short" variables cannot store values greater than (2^15)-1 (32,767), whereas the maximum value that can be stored in a "float" variable is 3.402823×10^38. If this is accurate, then using a "short" variable for "chance" would surely cause problems.

 

Cipscis

Link to comment
Share on other sites

I belive I am using INT, which gives a max of 2,147,483,647.

If I were using short, I think it would just make it the variable be 32,767 if it went over that.

 

The actual problem was the [] it looks extremely similar to the () in the geck on my screen. They are only off by a few pixels.

Link to comment
Share on other sites

As far as I've always been aware, those two are just aliases of one another - "int" and "short" are both the same type of variable. Like I said before, according to the GECK Wiki they have a range from -32,768 to 32,767.

 

Cipscis

Link to comment
Share on other sites

int is the same as long.

int -2,147,483,648 to 2,147,483,647

float 3.4E +/- 38 (7 digits)

ref an object reference

 

for some reason it doesn't list short on the variables page. It explaines it on the Special Variables page though, because it is more used for time then anything.

Link to comment
Share on other sites

From the GECK Wiki:

Although you can declare a variable to be Short or Long, both produce the same result.

Interestingly, the Category:Variables page and the Declaring Variables page contain different information about the range of "int" variables. The range that I quoted before is from the Declaring Variables page, but the Category:Variables page lists the range that you mentioned. Both of these pages were written the by the same user - Kurt Kuhlmann, who is an employee of Bethesda Softworks, and neither of them have been edited.

 

Looks like this is something that needs to be fixed...

 

Cipscis

Link to comment
Share on other sites

Wow that is weird. I believe Category:Variables page is correct though, because running my script I am able to get into the higher number ranges.

 

I am not on my desktop, so I can't check it, but I wonder if you GECK still is able to use the long variable. It is in the TES4 wiki.

Link to comment
Share on other sites

I just got around to checking it and you're correct, the information on the category page was the correct information. All three keywords - "int", "short" and "long" all have the same range as well. I've corrected the information on the Wiki now.

 

Cipscis

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...