Dastyruck Posted December 15, 2008 Author Share Posted December 15, 2008 I need help with this sub I just wrote… I am currently testing the way it gets data from the ini file.It is not working, so I assume it is some error made by me with checking the .ini file.I want it to check inside the folder named houses for the ini file which is the number that is put in when I call the sub. I dont think it is finding it right now, any help?```Sub GenerateHouse(index, number)Dim mapaDim mapbDim typeDim extramapa = GetVar("houses\"number".ini","A","Number")mapb = GetVar("houses\"number".ini","B","Number")type = GetVar("houses\"number".ini","A","Type")extra = GetVar("houses\"number".ini","B","Extra")If type = 1 ThenCall SetTile(mapa,5,5,15,3,1,1)Else If type = 2 ThenCall SetTile(mapa,5,5,16,3,1,1)ElseCall SetTile(mapa,5,5,17,3,1,1) End IfIf extra = 1 ThenCall SetTile(mapb,5,5,15,3,1,1)Else If extra = 2 ThenCall SetTile(mapb,5,5,16,3,1,1)ElseCall SetTile(mapb,5,5,17,3,1,1) End IfEnd Sub``` Link to comment Share on other sites More sharing options...
AdrianC Posted December 15, 2008 Share Posted December 15, 2008 First thing I noticed is you need to havemapa = GetVar("houses\"&number&".ini","A","Number") Link to comment Share on other sites More sharing options...
Dastyruck Posted December 15, 2008 Author Share Posted December 15, 2008 Tried but didnt work… Link to comment Share on other sites More sharing options...
AdrianC Posted December 15, 2008 Share Posted December 15, 2008 Well, thats deff a problem, make sure you changed it for all of those.Next, I guess you shouldn't use Else Ifs as they may cause problems. Just use regular ifs. Link to comment Share on other sites More sharing options...
balliztik1 Posted December 15, 2008 Share Posted December 15, 2008 ElseIf is one word. Link to comment Share on other sites More sharing options...
Dastyruck Posted December 15, 2008 Author Share Posted December 15, 2008 Still not working… hrmmm Link to comment Share on other sites More sharing options...
Akselj Posted December 15, 2008 Share Posted December 15, 2008 ```mapa = GetVar("houses\"number.ini","A","Number")mapb = GetVar("houses\"number.ini","B","Number")type = GetVar("houses\"number.ini","A","Type")extra = GetVar("houses\"number.ini","B","Extra")```Try this. Link to comment Share on other sites More sharing options...
Dastyruck Posted December 15, 2008 Author Share Posted December 15, 2008 Still not working… Link to comment Share on other sites More sharing options...
Akselj Posted December 15, 2008 Share Posted December 15, 2008 ```mapa = GetVar("houses\number.ini","A","Number")mapb = GetVar("houses\number.ini","B","Number")type = GetVar("houses\number.ini","A","Type")extra = GetVar("houses\number.ini","B","Extra")```What about this? Link to comment Share on other sites More sharing options...
AdrianC Posted December 15, 2008 Share Posted December 15, 2008 I think he wants number to be a variable. Link to comment Share on other sites More sharing options...
Zeno Posted December 15, 2008 Share Posted December 15, 2008 You're right, Adrian, because Number is already a variable. It would be the second one in Call GenerateHouse(Index, #)Try this:```Sub GenerateHouse(index, number)Dim mapaDim mapbDim typeDim extra' To connect a string (like "houses\") and a variable (like Number), use &mapa = GetVar("houses\" & Number & ".ini","A","Number")mapb = GetVar("houses\" & Number & ".ini","B","Number")type = GetVar("houses\" & Number & ".ini","A","Type")extra = GetVar("houses\" & Number & ".ini","B","Extra")If type = 1 Then Call SetTile(mapa,5,5,15,3,1,1)Else If type = 2 Then Call SetTile(mapa,5,5,16,3,1,1) Else Call SetTile(mapa,5,5,17,3,1,1)' You forgot to close this if. End IfEnd IfIf extra = 1 Then Call SetTile(mapb,5,5,15,3,1,1)Else If extra = 2 Then Call SetTile(mapb,5,5,16,3,1,1) Else Call SetTile(mapb,5,5,17,3,1,1)' Here again. End ifs End IfEnd IfEnd Sub```That should work. Link to comment Share on other sites More sharing options...
AdrianC Posted December 15, 2008 Share Posted December 15, 2008 Thats pretty much what I told him. 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