Diskmaster Posted July 11, 2009 Author Share Posted July 11, 2009 Can a Sub call on another Sub?EX: Call Sub abcdefgIn a sub? Link to comment Share on other sites More sharing options...
Dastyruck Posted July 11, 2009 Share Posted July 11, 2009 Sure!Say if you have sub Blah;```Sub Blah(Index, Blah)If Blah <> 1 ThenCall PlayerMsg(Index, "Blah!", Black)End If```You may call it in say a scripted tile case;```Case 0Call Blah(Index, 1)Exit Sub```Works just like that! Link to comment Share on other sites More sharing options...
Diskmaster Posted July 12, 2009 Author Share Posted July 12, 2009 No like a subSub coolio(Index, Cool)Call Playermsg(Index, "-_-", RED)Exit SubAnd then, in a completely different sub, u call for sub coolio Link to comment Share on other sites More sharing options...
Owen F Posted July 12, 2009 Share Posted July 12, 2009 ```Call ``` Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 13, 2009 Share Posted July 13, 2009 Yea, that's what Reply#1 did for you.First he made a new sub called "Blah", which took in the player's index, and a variable called "Blah".Then, in the second code, he had Case 0 call that sub.If you wanted to call this sub:```Sub coolio(Index, Cool)Call Playermsg(Index, "-_-", RED)Exit Sub```Then you would use this code:```Call coolio(Index, 5)```Assuming you wanted to pass the number "5" in-place for whatever variable "cool" is.See, when you use even, "Call PlayerMsg", you're calling a sub named "PlayerMsg", if you look in the source, you'd see this:```Public Sub PlayerMsg(ByVal Index As Long, ByVal Msg As String, ByVal Color As Byte) Call SendDataTo(Index, "PLAYERMSG" & SEP_CHAR & Msg & SEP_CHAR & Color & END_CHAR)End Sub```So "PlayerMsg" is the sub, and you call it by saying "Call PlayerMsg", just as you would call any of your subs in the main.txt, in Reply#1's case, he was calling a sub he just made called "Blah(index, blah)" Link to comment Share on other sites More sharing options...
Diskmaster Posted July 13, 2009 Author Share Posted July 13, 2009 OOOOOOOOOOOOOh, It all makes sense now! Ty guys 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