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

Calling subs ehm..


DIProgan
 Share

Recommended Posts

I gotta be doing something weird. I can't call certain subs or functions I create. In this case the sub Ehm wont run while the rest of the tile script will. What's wrong?

```
Function GetPlayersOnline()
For I = 1 To GetMaxPlayers()
If IsPlaying(I) And IsConnected(I) Then
Online = Online + 1
End If
Next
GetPlayersOnline = Online
End Function

' Executes when a player steps onto a scripted tile.
Sub ScriptedTile(Index, Script)

Select Case Script

Case 1
Online = GetPlayersOnline()
Dim X(15)
Dim Y(15)
For R = 1 To Online
X(R) = GetPlayerX(R)
Y(R) = GetPlayerY(R)
Call PlayerMsg(index, "Player" & R & " Xposition: " & X(R), GREEN)
Call PlayerMsg(index, "Player" & R & " Yposition: " & Y(R), RED)
Next
Call Ehm()
Case Else
Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub

Sub Ehm()
Call PlayerMsg(index, "Inside the Ehm sub", GREEN)
End Sub
```
I could do the same unsuccesfully with a Function instead of sub but I guess functions need a return value to function?
Link to comment
Share on other sites

@[BS:

> westin444 link=topic=56117.msg594060#msg594060 date=1262355907]
> For subs you could just say:
> Call ScriptedTile(arguments)
>
> for functions you:
>
> online=getplayersonline()

Seem to be missing the point. I cant create new subs when I want them. Calling Ehm doesnt work or at least the playermsg doesnt.
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...