teh jimpie Posted June 5, 2010 Author Share Posted June 5, 2010 compile error: variable not set; "speed = GetVar … "```Public Sub Packet_WhatPokemonEdit(ByVal Index As Long, ByVal PokemonNum As String) 'Packet - Name, Type1, Type2, Hp, Att, SpAtt, Def, SpDef, Speed, MaxHp, MaxAtt, MaxSpAtt, MaxDef, MaxSpDef, MaxSpeed, Evolve, Lvl, To, %Male, %Catch(full), %Catch(half), %Catch(low), %Happy, Exp Dim PokeName As String Dim Type1 As String Dim type2 As String Dim hp As String Dim attack As String Dim spattack As String Dim defence As String Dim spdefence As String Dim speed As String Dim maxhp As String Dim maxattack As String Dim maxspattack As String Dim maxdefence As String Dim maxspdefence As String Dim speed As String Dim evolve As String Dim lvl As String Dim et As String Dim male As String Dim catchfull As String Dim catchhalf As String Dim catchlow As String Dim happiness As String Dim exp As String PokeName = GetVar("Pokemons\" & PokemonNum & ".ini", "POKEMON", "Name") Type1 = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "type1") type2 = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "type2") hp = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "hp") attack = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "attack") spattack = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "spattack") defence = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "defence") spdefence = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "spdefence") speed = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "speed") maxhp = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "max_hp") maxattack = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "max_attack") maxspattack = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "max_spattack") maxdefence = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "max_defence") maxspdefence = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "max_spdefence") maxspeed = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "max_speed") evolve = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "evolve") lvl = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "evolve_lvl") et = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "evolve_to") male = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "male") catchfull = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "catch_full") catchhalf = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "catch_half") catchlow = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "catch_low") happiness = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "happiness") exp = GetVar("Pokemons/" & PokemonNum & ".ini", "POKEMON", "exp") Call SendData("editpokemon" & SEP_CHAR & PokeName & SEP_CHAR & Name & SEP_CHAR & Type1 & SEP_CHAR & type2 & SEP_CHAR & scrollHP & SEP_CHAR & attack & SEP_CHAR & spattack & SEP_CHAR & defence & SEP_CHAR & spdefence & SEP_CHAR & speed & SEP_CHAR & maxhp & SEP_CHAR & maxattack & SEP_CHAR & maxspattack & SEP_CHAR & maxdefence & SEP_CHAR & maxspdefence & SEP_CHAR & maxspeed & SEP_CHAR & evolve & SEP_CHAR & lvl & SEP_CHAR & et & SEP_CHAR & male & SEP_CHAR & Full & SEP_CHAR & catchhalf & SEP_CHAR & catchlow & SEP_CHAR & happiness & SEP_CHAR & exp & END_CHAR)End Sub```I'm not sure what I'm doing wrong.. Maybe "As String"? Can anybody help?thanks Link to comment Share on other sites More sharing options...
Magdreamer Posted June 5, 2010 Share Posted June 5, 2010 I'm not a coder.But why are you storing values like MaxHP as Strings?Use integres. Link to comment Share on other sites More sharing options...
Underflow Posted June 6, 2010 Share Posted June 6, 2010 May be you already declare a variable named speed as private in an other module / sub ? Link to comment Share on other sites More sharing options...
balliztik1 Posted June 6, 2010 Share Posted June 6, 2010 You dimmed speed twice.> Dim speed As String> Dim maxhp As String> Dim maxattack As String> Dim maxspattack As String> Dim maxdefence As String> Dim maxspdefence As String> Dim speed As StringAs an added word of caution, don't use .ini files. If you're going to use .inis, you might as well just use scripting. Learn how to make binary files. It'll be a lot faster and easier to work with. Link to comment Share on other sites More sharing options...
teh jimpie Posted June 6, 2010 Author Share Posted June 6, 2010 thanks ballie :)You mean like the maps, npcs etc. with .dat files?I've already looked up for a tut of it, but I couldnt find it :/ Link to comment Share on other sites More sharing options...
balliztik1 Posted June 6, 2010 Share Posted June 6, 2010 Just copy the code from the SaveNPC sub or something. All you have to change is some variable names and such. Here's a quick and easy way to do what you want with just about any feature in Eclipse:-Copy and paste a sub similar to what you're trying to do.-Replace specific parts with variables that pertain to your new system. This means just renaming things. For instance, change SaveNPC to SavePokemon, and instead of NPCNum, call it PokemonNum, etc.-Run the code. When you receive an error for a particular variable, find its counterpart. For instance, if you change NPC(index).Name to Pokemon(index).Name and get a "function not defined" error, you'll seek out the original NPC() bit.-Find where that variable is set and copy it. For instance, Dim NPC(1 to MAX_NPCS) as NpcRec would become Dim Pokemon(1 to MAX_POKEMON) as PokemonRec.-Continue comparing and copying until you have copied the whole system over for saving, loading, and editing.-When all is done, write the specific logic for the actual feature. Link to comment Share on other sites More sharing options...
teh jimpie Posted June 6, 2010 Author Share Posted June 6, 2010 @Ballie:> Just copy the code from the SaveNPC sub or something. All you have to change is some variable names and such. Here's a quick and easy way to do what you want with just about any feature in Eclipse:> > -Copy and paste a sub similar to what you're trying to do.> -Replace specific parts with variables that pertain to your new system. This means just renaming things. For instance, change SaveNPC to SavePokemon, and instead of NPCNum, call it PokemonNum, etc.> -Run the code. When you receive an error for a particular variable, find its counterpart. For instance, if you change NPC(index).Name to Pokemon(index).Name and get a "function not defined" error, you'll seek out the original NPC() bit.> -Find where that variable is set and copy it. For instance, Dim NPC(1 to MAX_NPCS) as NpcRec would become Dim Pokemon(1 to MAX_POKEMON) as PokemonRec.> -Continue comparing and copying until you have copied the whole system over for saving, loading, and editing.> -When all is done, write the specific logic for the actual feature.Okay, I'll look what I can do. But I think I'll use EO then because its "cleaner". If I have any questions, I'll ask :) Link to comment Share on other sites More sharing options...
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