• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Cyndy, May, Hero (Conquest), or Wes - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Error] Pokemon Essentials v18 Pokedex not woking

I've done so, but I still receive the error. Weirdly, it only happens when I open the regional dex; the national dex works perfectly fine.
My code is completely different now, I need to see your code.
Can you post the code of the script PScreen_PokedexMain (or, if you're using a Github release, the script 017_UI/003_PScreen_PokedexMain.rb)?
And also, can you post a screenshot of the error?
 
My code is completely different now, I need to see your code.
Can you post the code of the script PScreen_PokedexMain (or, if you're using a Github release, the script 017_UI/003_PScreen_PokedexMain.rb)?
And also, can you post a screenshot of the error?
Sorry for the delay.

Here is the code:

Here is the error:
[PokeCommunity.com] Pokemon Essentials v18 Pokedex not woking
 
Sorry for the delay.

Here is the code:

Here is the error:
View attachment 175642
For some reason, you have a Pokémon that is not correctly added to your database.
At line 278, replace:
Code:
        color  = speciesData[fspecies][SpeciesColor] || 0
with:
Code:
        begin 
        color  = speciesData[fspecies][SpeciesColor] || 0
        except 
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}", 
        form, nationalSpecies, fspecies)
        end
This should generate an error with more information.
 
For some reason, you have a Pokémon that is not correctly added to your database.
At line 278, replace:
Code:
        color  = speciesData[fspecies][SpeciesColor] || 0
with:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        except
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}",
        form, nationalSpecies, fspecies)
        end
This should generate an error with more information.
It seems like I'm getting a different error with the added code.
[PokeCommunity.com] Pokemon Essentials v18 Pokedex not woking

Here is the added code to the pokemon.txt file:

 
For some reason, you have a Pokémon that is not correctly added to your database.
At line 278, replace:
Code:
        color  = speciesData[fspecies][SpeciesColor] || 0
with:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        except
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}",
        form, nationalSpecies, fspecies)
        end
This should generate an error with more information.
So I did a little more testing. I've replaced all of the Pokemon data with the default files, started a new game and replaced "except" with "rescue." I still receive the same error as before without the added code, and this is what I get with the added code:

[PokeCommunity.com] Pokemon Essentials v18 Pokedex not woking

Not really too sure what could be causing this with the default files on a new game.
 
So I did a little more testing. I've replaced all of the Pokemon data with the default files, started a new game and replaced "except" with "rescue." I still receive the same error as before without the added code, and this is what I get with the added code:
Yeah sorry, I'm sometimes confused between Ruby for Pokémon and Python for my job lol.

Not really too sure what could be causing this with the default files on a new game.
I think I have an idea. Find the line:
Code:
    speciesData = pbLoadSpeciesData
Under this line, paste:
Code:
    raise _INTL("speciesData.length = {1}", speciesData.length)
And tell me what this new error says.
 
What??? It's not what I expected!
Have you compiled anything? Or added something to the Pokédex?

If not, remove the line:
Code:
    raise _INTL("speciesData.length = {1}", speciesData.length)
Also, replace the code:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        rescue
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}",
        form, nationalSpecies, fspecies)
        end
with:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        rescue
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies])
        end
and show me the error.
 
Last edited:
What??? It's not what I expected!
Have you compiled anything? Or added something to the Pokédex?

If not, remove the line:
Code:
    raise _INTL("speciesData.length = {1}", speciesData.length)
Also, replace the code:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        rescue
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}",
        form, nationalSpecies, fspecies)
        end
with:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        rescue
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies])
        end
and show me the error.
No, nothing was added. I added the species alone, but I also had not tested the Dex before adding the new species. Like I said previously, I tried removing all of my custom stuff, but even then I get the same error. The settings are also completely base. I have also never touched PokeDexMain.

Here is the error:
[PokeCommunity.com] Pokemon Essentials v18 Pokedex not woking

It doesn't seem to grab a value from 'speciesData[fspecies].'

Also need to reiterate that the National dex is working completely fine, only the regional dexes crash, if that helps any.
 
No, nothing was added. I added the species alone, but I also had not tested the Dex before adding the new species. Like I said previously, I tried removing all of my custom stuff, but even then I get the same error. The settings are also completely base. I have also never touched PokeDexMain.

Here is the error:
View attachment 175693

It doesn't seem to grab a value from 'speciesData[fspecies].'

Also need to reiterate that the National dex is working completely fine, only the regional dexes crash, if that helps any.

speciesData[fspecies] is nil, which means that fspecies is not in the list of Pokémons. But I see that fspecies is 0 here, while it was 1 in your other posts, and 0 is not a valid index.

Install this script:
It's my debugging tools (and yes, I released it just for you). Copy/paste it in a script above "Main".

Then, under the line:
Code:
           speciesData = pbLoadSpeciesData
add this line:
Code:
           scLog(speciesData)
Then, you will have the same error, but you will have a new file in your game folder, called "errorlog.txt". Attach this file to your next post.
 
speciesData[fspecies] is nil, which means that fspecies is not in the list of Pokémons. But I see that fspecies is 0 here, while it was 1 in your other posts, and 0 is not a valid index.

Install this script:
It's my debugging tools (and yes, I released it just for you). Copy/paste it in a script above "Main".

Then, under the line:
Code:
           speciesData = pbLoadSpeciesData
add this line:
Code:
           scLog(speciesData)
Then, you will have the same error, but you will have a new file in your game folder, called "errorlog.txt". Attach this file to your next post.
 

Attachments

  • errorlog.txt
    210.6 KB · Views: 2
@funnycatswag

Your speciesData is fine, it's contiguous, it starts at index 1.
I don't understand how fspecies can be 0.

Do you have this bug in a specific regional dex? Or in all of them?

I realise I forgot to make you check something. Find the code:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        rescue
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies])
        end
and replace with:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        rescue
        s = _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}, regionalSpecies has length {5}, i={6}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies], regionalSpecies.length, i)
        scLog(s, "================================")
        scLog(regionalSpecies)
        raise s
        end
And send me the errorlog.txt file.
 
@funnycatswag

Your speciesData is fine, it's contiguous, it starts at index 1.
I don't understand how fspecies can be 0.

Do you have this bug in a specific regional dex? Or in all of them?

I realise I forgot to make you check something. Find the code:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        rescue
        raise _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies])
        end
and replace with:
Code:
        begin
        color  = speciesData[fspecies][SpeciesColor] || 0
        rescue
        s = _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}, regionalSpecies has length {5}, i={6}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies], regionalSpecies.length, i)
        scLog(s, "================================")
        scLog(regionalSpecies)
        raise s
        end
And send me the errorlog.txt file.
I hadn't tested it before but, but I've tested it and it seems like Kanto is the only dex that is giving the error. Johto and National work perfectly fine.

Here is the screenshot of the error:
[PokeCommunity.com] Pokemon Essentials v18 Pokedex not woking

Here is the errorlog:
 

Attachments

  • errorlog.txt
    854.7 KB · Views: 1
I hadn't tested it before but, but I've tested it and it seems like Kanto is the only dex that is giving the error. Johto and National work perfectly fine.

Here is the screenshot of the error:
View attachment 175735

Here is the errorlog:
Sorry again, but I need to check two things.

First, clear the errorlog.txt.

Secondly, I made a typo in the code I gave you.
Replace:
Code:
        s = _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}, regionalSpecies has length {5}, i={6}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies], regionalSpecies.length, i)
with
Code:
        s = _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}, regionalSpecies has length {6}, i={7}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies], regionalSpecies.length, i)
The difference is in the end of the first line; I need to know what value of i causes the error.

Thirdly, open another regional dex. You should not have an error, but the code will still write something in the errorlog.txt file. I need to see what's logged in both cases.

Then, send me the errorlog.
 
Sorry again, but I need to check two things.

First, clear the errorlog.txt.

Secondly, I made a typo in the code I gave you.
Replace:
Code:
        s = _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}, regionalSpecies has length {5}, i={6}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies], regionalSpecies.length, i)
with
Code:
        s = _INTL("Missing Pokémon: form {1} of species {2}, ID is {3}; speciesData has length {4} and value is {5}, regionalSpecies has length {6}, i={7}",
        form, nationalSpecies, fspecies, speciesData.length, speciesData[fspecies], regionalSpecies.length, i)
The difference is in the end of the first line; I need to know what value of i causes the error.

Thirdly, open another regional dex. You should not have an error, but the code will still write something in the errorlog.txt file. I need to see what's logged in both cases.

Then, send me the errorlog.
New error message:
[PokeCommunity.com] Pokemon Essentials v18 Pokedex not woking

I'm attaching 2 errorlog files. errorlog_kanto is the fresh log when the error occurs when opening the Kanto dex. errorlog_johto is the fresh log when opening the Johto dex, when no error occurs.
 

Attachments

  • errorlog_kanto.txt
    214.7 KB · Views: 1
  • errorlog_johto.txt
    210.6 KB · Views: 1
New error message:
View attachment 175738

I'm attaching 2 errorlog files. errorlog_kanto is the fresh log when the error occurs when opening the Kanto dex. errorlog_johto is the fresh log when opening the Johto dex, when no error occurs.
I messed up but I'll give you my conclusion by comparing with my own regional Pokédexes.

If you observe the errorlog_kanto, you will see this at the end of the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 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 899 ; 0 ; 901 ; 902 ; 903 ]

I assume that you added the last Pokémons? Maybe #899 or #901-#903.
All the 0's you see are not normal. To understand what's happening, let's check how you edit the reigonal dex.

Let's see the function def pbRegionalDexEditorMain that you use to add a Pokémon.
Check the following lines:
Code:
      else   # Cancel
        cmd2 = pbMessage(_INTL("Save changes?"),
           [_INTL("Yes"),_INTL("No"),_INTL("Cancel")],3)
        if cmd2==0
          # Save new dexes here
          tosave = []
          for i in 0...regionallist.length
            tosave[i] = []
            for j in 0...regionallist[i].length
              tosave[i][regionallist[i][j]] = j if regionallist[i][j]
            end
          end
          save_data(tosave,"Data/regional_dexes.dat")
          $PokemonTemp.regionalDexes = nil
          pbSavePokemonData
          pbMessage(_INTL("Data saved."))
          break
        elsif cmd2==1
          break
        end
      end

In this code, "tosave" is supposed to be the content of the regional Pokédex. It takes the form of an array:
Code:
tosave[ <regional Pokédex index> ][ <Pokémon number in the national dex> ] = <Pokémon number in the regional dex> if the associated Pokémon is in this regional Pokédex.
However, as not all Pokémons are in a given regional Pokédex, this fills the array with empty places. For example, if Pokémon #252 is not in this regional Pokédex, then
Code:
tosave[ <regional Pokédex index >][ 252 ]
will be empty.
BUT, the array "knows" that it must have a certain length. So, the array will have empty slots.

Now observe the following code, that "loads" the data contained in "tosave":
Code:
def pbAllRegionalSpecies(region)
  ret = [0]
  return ret if region<0
  dexList = pbLoadRegionalDexes[region]
  return ret if !dexList || dexList.length==0
  for i in 0...dexList.length
    ret[dexList[i]] = i if dexList[i] && dexList[i] > 0
  end
  ret.map! { |e| e ? e : 0 }   # Replace nils with 0s
  return ret
end
For some reason, the function adds many 0's to the result. Why does this happen to you and not to me? If you read the code just above, you'll see:
Code:
  for i in 0...dexList.length
    ret[dexList[i]] = i if dexList[i] && dexList[i] > 0
  end
This is meant to remove the empty slots of the "tosave" variable from above, and return just a list of the national indices of the Pokémons, in the order that they appear in the regional Pokédex (it kinda "inverts" the array "tosave"). And then, after this loop, you see this line:
Code:
  ret.map! { |e| e ? e : 0 }   # Replace nils with 0s
This replaces the empty slots by 0's.

Now, why do you have empty slots? Because the regional numbers of your Pokémons are not contiguous. You have a jump from from 14 to 16, then from 251 to 899, and from 899 to 901. Can you check this?
 
I messed up but I'll give you my conclusion by comparing with my own regional Pokédexes.

If you observe the errorlog_kanto, you will see this at the end of the file:
Code:
[ 0 ; 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; 10 ; 11 ; 12 ; 13 ; 14 ; 0 ; 16 ; 17 ; 18 ; 19 ; 20 ; 21 ; 22 ; 23 ; 24 ; 25 ; 26 ; 27 ; 28 ; 29 ; 30 ; 31 ; 32 ; 33 ; 34 ; 35 ; 36 ; 37 ; 38 ; 39 ; 40 ; 41 ; 42 ; 43 ; 44 ; 45 ; 46 ; 47 ; 48 ; 49 ; 50 ; 51 ; 52 ; 53 ; 54 ; 55 ; 56 ; 57 ; 58 ; 59 ; 60 ; 61 ; 62 ; 63 ; 64 ; 65 ; 66 ; 67 ; 68 ; 69 ; 70 ; 71 ; 72 ; 73 ; 74 ; 75 ; 76 ; 77 ; 78 ; 79 ; 80 ; 81 ; 82 ; 83 ; 84 ; 85 ; 86 ; 87 ; 88 ; 89 ; 90 ; 91 ; 92 ; 93 ; 94 ; 95 ; 96 ; 97 ; 98 ; 99 ; 100 ; 101 ; 102 ; 103 ; 104 ; 105 ; 106 ; 107 ; 108 ; 109 ; 110 ; 111 ; 112 ; 113 ; 114 ; 115 ; 116 ; 117 ; 118 ; 119 ; 120 ; 121 ; 122 ; 123 ; 124 ; 125 ; 126 ; 127 ; 128 ; 129 ; 130 ; 131 ; 132 ; 133 ; 134 ; 135 ; 136 ; 137 ; 138 ; 139 ; 140 ; 141 ; 142 ; 143 ; 144 ; 145 ; 146 ; 147 ; 148 ; 149 ; 150 ; 151 ; 152 ; 153 ; 154 ; 155 ; 156 ; 157 ; 158 ; 159 ; 160 ; 161 ; 162 ; 163 ; 164 ; 165 ; 166 ; 167 ; 168 ; 169 ; 170 ; 171 ; 172 ; 173 ; 174 ; 175 ; 176 ; 177 ; 178 ; 179 ; 180 ; 181 ; 182 ; 183 ; 184 ; 185 ; 186 ; 187 ; 188 ; 189 ; 190 ; 191 ; 192 ; 193 ; 194 ; 195 ; 196 ; 197 ; 198 ; 199 ; 200 ; 201 ; 202 ; 203 ; 204 ; 205 ; 206 ; 207 ; 208 ; 209 ; 210 ; 211 ; 212 ; 213 ; 214 ; 215 ; 216 ; 217 ; 218 ; 219 ; 220 ; 221 ; 222 ; 223 ; 224 ; 225 ; 226 ; 227 ; 228 ; 229 ; 230 ; 231 ; 232 ; 233 ; 234 ; 235 ; 236 ; 237 ; 238 ; 239 ; 240 ; 241 ; 242 ; 243 ; 244 ; 245 ; 246 ; 247 ; 248 ; 249 ; 250 ; 251 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 ; 0 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899 or #901-#903.
All the 0's you see are not normal. To understand what's happening, let's check how you edit the reigonal dex.

Let's see the function def pbRegionalDexEditorMain that you use to add a Pokémon.
Check the following lines:
Code:
      else   # Cancel
        cmd2 = pbMessage(_INTL("Save changes?"),
           [_INTL("Yes"),_INTL("No"),_INTL("Cancel")],3)
        if cmd2==0
          # Save new dexes here
          tosave = []
          for i in 0...regionallist.length
            tosave[i] = []
            for j in 0...regionallist[i].length
              tosave[i][regionallist[i][j]] = j if regionallist[i][j]
            end
          end
          save_data(tosave,"Data/regional_dexes.dat")
          $PokemonTemp.regionalDexes = nil
          pbSavePokemonData
          pbMessage(_INTL("Data saved."))
          break
        elsif cmd2==1
          break
        end
      end

In this code, "tosave" is supposed to be the content of the regional Pokédex. It takes the form of an array:
Code:
tosave[ <regional Pokédex index> ][ <Pokémon number in the national dex> ] = <Pokémon number in the regional dex> if the associated Pokémon is in this regional Pokédex.
However, as not all Pokémons are in a given regional Pokédex, this fills the array with empty places. For example, if Pokémon #252 is not in this regional Pokédex, then
Code:
tosave[ <regional Pokédex index >][ 252 ]
will be empty.
BUT, the array "knows" that it must have a certain length. So, the array will have empty slots.

Now observe the following code, that "loads" the data contained in "tosave":
Code:
def pbAllRegionalSpecies(region)
  ret = [0]
  return ret if region<0
  dexList = pbLoadRegionalDexes[region]
  return ret if !dexList || dexList.length==0
  for i in 0...dexList.length
    ret[dexList[i]] = i if dexList[i] && dexList[i] > 0
  end
  ret.map! { |e| e ? e : 0 }   # Replace nils with 0s
  return ret
end
For some reason, the function adds many 0's to the result. Why does this happen to you and not to me? If you read the code just above, you'll see:
Code:
  for i in 0...dexList.length
    ret[dexList[i]] = i if dexList[i] && dexList[i] > 0
  end
This is meant to remove the empty slots of the "tosave" variable from above, and return just a list of the national indices of the Pokémons, in the order that they appear in the regional Pokédex (it kinda "inverts" the array "tosave"). And then, after this loop, you see this line:
Code:
  ret.map! { |e| e ? e : 0 }   # Replace nils with 0s
This replaces the empty slots by 0's.

Now, why do you have empty slots? Because the regional numbers of your Pokémons are not contiguous. You have a jump from from 14 to 16, then from 251 to 899, and from 899 to 901. Can you check this?
Okay, I think I've figured it out.

I checked my regional dex editor, and #15 was showing as Beedrill. I deleted the entry and had to manually replaced him. I got the same error afterward, however.

I then noticed that everything after Celebi was unlisted, so I'm assuming nil. I cleared everything that came after Celebi, #899, #901-903 and now there is no error.

I appreciate your help, and sorry to drag you back to this thread.

I hope you have a great day.
 
Back
Top