apf42589 Posted November 13, 2008 Author Share Posted November 13, 2008 How do you connect 2 cases together?i have the same script just on different cases…Case 1dim weapon Weapon = GetPlayerWeaponSlot(index) If weapon = 0 Then Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) ElseIf GetPlayerInvItemNum(index, weapon) = 33 Then Call GoWoodcutting(index, 1, 10, "Logs") Else Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) End If End SelectEnd Sub Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) Case Elseand when i put a the same script on the case under it the second case dont work only the first one.... Thank You, APF Link to comment Share on other sites More sharing options...
dg1423 Posted November 13, 2008 Share Posted November 13, 2008 Case 1dim weapon Weapon = GetPlayerWeaponSlot(index) If weapon = 0 Then Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) ElseIf GetPlayerInvItemNum(index, weapon) = 33 Then Call GoWoodcutting(index, 1, 10, "Logs") Else Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) End If Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) End SelectEnd Sub^ Use that, it's cuz you had End Select and End Sub at the end of the Case.End Select goes at the end of ALL the cases, not each one. And End Sub goes at the bottom of the Sub. Link to comment Share on other sites More sharing options...
apf42589 Posted November 13, 2008 Author Share Posted November 13, 2008 @dg1423:> ^ Use that, it's cuz you had End Select and End Sub at the end of the Case.> > End Select goes at the end of ALL the cases, not each one. And End Sub goes at the bottom of the Sub.so i can do this? Case 0dim weapon Weapon = GetPlayerWeaponSlot(index) If weapon = 0 Then Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) ElseIf GetPlayerInvItemNum(index, weapon) = 33 Then Call GoWoodcutting(index, 1, 10, "Logs") Else Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) End If Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE)End SubCase 1 dim weapon Weapon = GetPlayerWeaponSlot(index) If weapon = 0 Then Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) ElseIf GetPlayerInvItemNum(index, weapon) = 33 Then Call GoWoodcutting(index, 1, 10, "Logs") Else Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15) End If End SelectEnd Sub Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) End SelectEnd Subscripiting is confusing @.@ Link to comment Share on other sites More sharing options...
AdrianC Posted November 13, 2008 Share Posted November 13, 2008 Umm no… I guess I don't have anything to do, I'll rewrite it.> Case 0> dim weapon> Weapon = GetPlayerWeaponSlot(index)> If weapon = 0 Then> Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15)> ElseIf GetPlayerInvItemNum(index, weapon) = 33 Then> Call GoWoodcutting(index, 1, 10, "Logs")> Else> Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15)> End If> > Case 1> Weapon = GetPlayerWeaponSlot(index)> If weapon = 0 Then> Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15)> ElseIf GetPlayerInvItemNum(index, weapon) = 33 Then> Call GoWoodcutting(index, 1, 10, "Logs")> Else> Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15)> End If> > End Select> End SubDidn't I already tell some1 today (you?) that you can't declare the same variable twice?Anyway, I only checked your script structure, not the commands. I asume you have a GoWoodcutting sub. Link to comment Share on other sites More sharing options...
apf42589 Posted November 13, 2008 Author Share Posted November 13, 2008 @AdrianC:> Umm no… I guess I don't have anything to do, I'll rewrite it.> > Didn't I already tell some1 today (you?) that you can't declare the same variable twice?> > Anyway, I only checked your script structure, not the commands. I asume you have a GoWoodcutting sub.=\ yea sorry new to scripting xD… but ty very much ill try it now, and yea i have that sub. Link to comment Share on other sites More sharing options...
AdrianC Posted November 13, 2008 Share Posted November 13, 2008 No problem. Link to comment Share on other sites More sharing options...
apf42589 Posted November 13, 2008 Author Share Posted November 13, 2008 YES, omg i love you =D Link to comment Share on other sites More sharing options...
AdrianC Posted November 13, 2008 Share Posted November 13, 2008 lol, alright Link to comment Share on other sites More sharing options...
DarkMazer Posted November 16, 2008 Share Posted November 16, 2008 Well, since they're exactly the same thing, you could do this:> **Case 0, 1**> dim weapon> Weapon = GetPlayerWeaponSlot(index)> If weapon = 0 Then> Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15)> ElseIf GetPlayerInvItemNum(index, weapon) = 33 Then> Call GoWoodcutting(index, 1, 10, "Logs")> Else> Call PlayerMsg(index, "You don't have a Axe to chop this tree.", 15)> End If> > End Select> End SubI don't think a whole lot of people know about that. If you simply separate two cases with a comma, it'll work for both cases. I don't see why you need it here, but there are certainly situations where that's helpful. Link to comment Share on other sites More sharing options...
AdrianC Posted November 16, 2008 Share Posted November 16, 2008 He wanted to learn how to use two different cases. It just happened that he used the same code for both. I can't see why you would ever make two cases which are exactly the same. Link to comment Share on other sites More sharing options...
DarkMazer Posted November 16, 2008 Share Posted November 16, 2008 @AdrianC:> He wanted to learn how to use two different cases. It just happened that he used the same code for both. I can't see why you would ever make two cases which are exactly the same.The only use I've thought of for making two cases the same is weighted probabilities (like if you want something to happen 3/8 of the time, another thing to happen 1/8 of the time and a third thing to happen 4/8 of the time), but I'm sure there's other uses for it, too. Link to comment Share on other sites More sharing options...
AdrianC Posted November 16, 2008 Share Posted November 16, 2008 If they are exactly the same, no matter what probability, the same thing happens every single time. Link to comment Share on other sites More sharing options...
apf42589 Posted November 16, 2008 Author Share Posted November 16, 2008 @AdrianC:> If they are exactly the same, no matter what probability, the same thing happens every single time.yea and i was editing the 2nd case for fishing, i wouldnt use the same code. Before only case 0 worked and case 1 didnt so i wanted to see how to "connect" them properly >.>APF Link to comment Share on other sites More sharing options...
AdrianC Posted November 16, 2008 Share Posted November 16, 2008 Yeah, I know.I have an idea as to what it could be used. If a = 1 or 2 do this. Its useless to do that for the big Cases but if you have a separate select, it would work. 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