DIProgan Posted January 1, 2010 Author Share Posted January 1, 2010 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 = OnlineEnd 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 SelectEnd SubSub 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 More sharing options...
westin444 Posted January 1, 2010 Share Posted January 1, 2010 For subs you could just say:Call ScriptedTile(arguments)for functions you:online=getplayersonline() Link to comment Share on other sites More sharing options...
DIProgan Posted January 1, 2010 Author Share Posted January 1, 2010 @[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 More sharing options...
Ruins of Hell Posted January 1, 2010 Share Posted January 1, 2010 You must pass index to the sub, I didn't because my Function didn't need this.Sub Ehm(index) Call PlayerMsg(index, "Inside the Ehm sub", GREEN)End Sub Link to comment Share on other sites More sharing options...
cloudwolf00 Posted January 1, 2010 Share Posted January 1, 2010 HelloEDIT: I see you got it working.Yours sincerelycloudwolf00 Link to comment Share on other sites More sharing options...
DIProgan Posted January 1, 2010 Author Share Posted January 1, 2010 @Soul:> You must pass index to the sub, I didn't because my Function didn't need this.> > Sub Ehm(index)> Call PlayerMsg(index, "Inside the Ehm sub", GREEN)> End SubThanks, solved it 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