adamsharp Posted August 9, 2009 Author Share Posted August 9, 2009 urmm im trying to make it so it says my name when i send the Message to the map but it doesnt work please debug my code for me.```Case "/roll" Dim D1 D1 = Rand(1,10) If D1 = 1 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 1 Out Of 10", BLUE)Exit Sub ElseIf D1 = 2 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 2 Out Of 10", BLUE)Exit SubElseIf D1 = 3 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 3 Out Of 10", BLUE)Exit SubElseIf D1 = 4 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 4 Out Of 10", BLUE)Exit SubElseIf D1 = 5 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 5 Out Of 10", BLUE)Exit SubElseIf D1 = 6 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 6 Out Of 10", BLUE)Exit SubElseIf D1 = 7 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 7 Out Of 10", BLUE)Exit SubElseIf D1 = 8 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 8 Out Of 10", BLUE)Exit SubElseIf D1 = 9 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 9 Out Of 10", BLUE)Exit SubElseIf D1 = 10 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 10 Out Of 10", BLUE)Exit Sub End IfExit Sub```Thanks Link to comment Share on other sites More sharing options...
Owen F Posted August 9, 2009 Share Posted August 9, 2009 I'm unsure as to where GetPlayerName has to be in side the string like "player & GetPlayerName &"But try it anyway, :) Link to comment Share on other sites More sharing options...
Bobosk Posted August 9, 2009 Share Posted August 9, 2009 NO Owen, Functions do not belong in the quotations, they belong outside of them, and as for the "Exit Sub" solution in this person's other post, complete bolocks…Hate to tell you adamsharp but you're calling mapmsg incorrectly...```Public Sub MapMsg(ByVal MapNum As Long, ByVal Msg As String, ByVal Color As Byte)```So using index for mapmsg like you are here… is going to cause the script to not operate on the map the user is on...```Case "/roll" Dim D1 D1 = Rand(1,10) If D1 = 1 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 1 Out Of 10", BLUE) ElseIf D1 = 2 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 2 Out Of 10", BLUE)ElseIf D1 = 3 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 3 Out Of 10", BLUE)ElseIf D1 = 4 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 4 Out Of 10", BLUE)ElseIf D1 = 5 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 5 Out Of 10", BLUE)ElseIf D1 = 6 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 6 Out Of 10", BLUE)ElseIf D1 = 7 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 7 Out Of 10", BLUE)ElseIf D1 = 8 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 8 Out Of 10", BLUE)ElseIf D1 = 9 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 9 Out Of 10", BLUE)ElseIf D1 = 10 Then Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 10 Out Of 10", BLUE)End IfExit Sub```Here's a fixed version…```Case "/roll" Dim D1 D1 = Rand(1,10) If D1 = 1 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 1 Out Of 10", BLUE) ElseIf D1 = 2 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 2 Out Of 10", BLUE)ElseIf D1 = 3 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 3 Out Of 10", BLUE)ElseIf D1 = 4 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 4 Out Of 10", BLUE)ElseIf D1 = 5 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 5 Out Of 10", BLUE)ElseIf D1 = 6 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 6 Out Of 10", BLUE)ElseIf D1 = 7 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 7 Out Of 10", BLUE)ElseIf D1 = 8 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 8 Out Of 10", BLUE)ElseIf D1 = 9 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 9 Out Of 10", BLUE)ElseIf D1 = 10 ThenCall MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 10 Out Of 10", BLUE)End IfExit Sub```and really, you can simplify this script alot by just doing this```Case "/roll" Dim D1 D1 = Rand(1,10) Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled " & D1 & " Out Of 10", BLUE)Exit Sub``` Link to comment Share on other sites More sharing options...
adamsharp Posted August 9, 2009 Author Share Posted August 9, 2009 @Bobosk:> NO Owen, Functions do not belong in the quotations, they belong outside of them, and as for the "Exit Sub" solution in this person's other post, complete bolocks…> > Hate to tell you adamsharp but you're calling mapmsg incorrectly...> ```> Public Sub MapMsg(ByVal MapNum As Long, ByVal Msg As String, ByVal Color As Byte)> ```> So using index for mapmsg like you are here… is going to cause the script to not operate on the map the user is on...> ```> Case "/roll"> Dim D1> D1 = Rand(1,10)> If D1 = 1 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 1 Out Of 10", BLUE)> > ElseIf D1 = 2 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 2 Out Of 10", BLUE)> > ElseIf D1 = 3 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 3 Out Of 10", BLUE)> > ElseIf D1 = 4 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 4 Out Of 10", BLUE)> > ElseIf D1 = 5 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 5 Out Of 10", BLUE)> > ElseIf D1 = 6 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 6 Out Of 10", BLUE)> > ElseIf D1 = 7 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 7 Out Of 10", BLUE)> > ElseIf D1 = 8 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 8 Out Of 10", BLUE)> > ElseIf D1 = 9 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 9 Out Of 10", BLUE)> > ElseIf D1 = 10 Then> Call MapMsg(index,"Player" & GetPlayerName(index) & "Just Rolled 10 Out Of 10", BLUE)> End If> Exit Sub> > ```> Here's a fixed version…> ```> Case "/roll"> Dim D1> D1 = Rand(1,10)> If D1 = 1 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 1 Out Of 10", BLUE)> > ElseIf D1 = 2 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 2 Out Of 10", BLUE)> > ElseIf D1 = 3 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 3 Out Of 10", BLUE)> > ElseIf D1 = 4 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 4 Out Of 10", BLUE)> > ElseIf D1 = 5 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 5 Out Of 10", BLUE)> > ElseIf D1 = 6 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 6 Out Of 10", BLUE)> > ElseIf D1 = 7 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 7 Out Of 10", BLUE)> > ElseIf D1 = 8 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 8 Out Of 10", BLUE)> > ElseIf D1 = 9 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 9 Out Of 10", BLUE)> > ElseIf D1 = 10 Then> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled 10 Out Of 10", BLUE)> End If> Exit Sub> ```> and really, you can simplify this script alot by just doing this> ```> Case "/roll"> Dim D1> D1 = Rand(1,10)> Call MapMsg(GetPlayerMap(index),"Player " & GetPlayerName(index) & " Just Rolled " & D1 & " Out Of 10", BLUE)> Exit Sub> ```]Thanks But Dont Hate Me For Getting My FIRST Own Bit Of Scripting Wrong Please. Link to comment Share on other sites More sharing options...
Owen F Posted August 9, 2009 Share Posted August 9, 2009 i did not fix it by just using exit subs.I don't know what your problem is.I said i was unsure.. 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