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

Invalid outside procedure


willunited
 Share

Recommended Posts

Im trying to do this in ModConstans:

' Map constants

Public Const MAX_MAPS As Long = 100

Select Case Options.resolution

Case 800

Public Const MAX_MAPX As Byte = (800 / 32 + 1)

Case 1024

Public Const MAX_MAPX As Byte = (1024 / 32 + 1)

Case 1366

Public Const MAX_MAPX As Byte = (1366 / 32 + 1)

Case Else

Public Const MAX_MAPX As Byte = (800 / 32 + 1)

End Select

Public Const MAX_MAPY As Byte = 18

Public Const MAP_MORAL_NONE As Byte = 0

Public Const MAP_MORAL_SAFE As Byte = 1

But i get this error:

Invalid Outside blocking.
Link to comment
Share on other sites

I don't think you can use any type of conditional statements in the declaration section of modules. The values will have to be edited during run time. This means that constants for MAX_MapX and MAX_MapY cannot be used, you will have to make a public variable.
Link to comment
Share on other sites

  • 3 weeks later...
If this is Server-Side which I assume it is. It should be.

In modGlobals add:

```

Public MAX_MAPX As Byte

```

Place this in frmServer Form_Load.

```

If Not Options.Resolution < 800 And Not Options.Resolution > 1366 Then MAX_MAPX = (Options.Resolution / 32 + 1) Else MAX_MAPX = (800 / 32 + 1)

```

If you have an array that requires MAX_MAPX in the declaration then take it out. As in change

```

YOURARRAY(1 to MAX_MAPX) as Long

```

To

```

YOURARRAY() as Long

```

EDIT:

And change what I had you put in Form_Load to this.

```

If Not Options.Resolution < 800 And Not Options.Resolution > 1366 Then MAX_MAPX = (Options.Resolution / 32 + 1) Else MAX_MAPX = (800 / 32 + 1)

If MAX_MAPX > 0 Then Redim YOURARRAY(1 to MAX_MAPX)

```
Link to comment
Share on other sites

You can not do any kind of active programming outside of a function or sub. The only things that can be outside of a function or sub are the declarations of Global and module variables and constants, Enums, User defined types, and references to DLLs.

… I think that covers most of them.
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...