Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Help please…


Dastyruck
 Share

Recommended Posts

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 mapa
Dim mapb
Dim type
Dim extra

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)
End If

If 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)
End If

End Sub
```
Link to comment
Share on other sites

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 mapa
Dim mapb
Dim type
Dim 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 If
End If

If 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 If
End If

End Sub
```

That should work.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...