Kimimaru Posted August 21, 2009 Author Share Posted August 21, 2009 Hey! I'm creating a timed event right now, and I'm including a player prompt in it. I'm having trouble getting the player prompt to work, though. Can anyone help me out? Here's my code:**Sub TimedEvent(Hours, Minutes, Seconds)**:```Sub TimedEvent(Hours, Minutes, Seconds) If Hours = 12 Then If Minutes = 0 Then If Seconds = 0 Then Call PlayerPrompt(Index, "Do you like this player prompt test?", 0) End If End If End IfEnd Sub```**Sub PlayerPrompt(Index, Prompt, Value)**:```Sub PlayerPrompt(Index, Prompt, Value) If Prompt = 6 Then Select Case Value Case 0 Call PlayerWarp(Index, 1, 6, 7) Call PlayerMsg(Index, "You said you liked the test!", YELLOW) Case 1 Call GlobalMsg("This is case 1?", CYAN) End Select Else Select Case Value Case 0 Call GlobalMsg("You didn't like the test.", RED) Case 1 Call GlobalMsg("This is no case 1?", RED) End Select End IfEnd Sub```I'm doing something wrong here, but the **PlayerPrompt Sub** is pretty confusing. Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
Bobosk Posted August 21, 2009 Share Posted August 21, 2009 timedevents doesn't have an index variable Link to comment Share on other sites More sharing options...
Kimimaru Posted August 21, 2009 Author Share Posted August 21, 2009 Okay, thanks. How can I change my code to make it work with timed events, though? I also believe that I'm doing something wrong in the **PlayerPrompt** command, since it's not working if I try it anywhere else. I get a "type mismatch" error. Link to comment Share on other sites More sharing options...
Godlord Posted August 21, 2009 Share Posted August 21, 2009 > Sub TimedEvent(Hours, Minutes, Seconds)> If Hours = 12 And Minutes = 0 And Seconds = 0 Then> For I = 1 To MAX_PLAYERS> Call Prompt(I, "Do you like this player prompt test?", 0)> Next> End If> End Sub> Sub PlayerPrompt(Index, Prompt, Value)> If Prompt = 6 Then> Select Case Value> Case 0> Call PlayerWarp(Index, 1, 6, 7)> Call PlayerMsg(Index, "You said you liked the test!", YELLOW)> > Case 1> Call GlobalMsg("This is case 1?", CYAN)> End Select> Else> Select Case Value> Case 0> Call GlobalMsg("You didn't like the test.", RED)> > Case 1> Call GlobalMsg("This is no case 1?", RED)> End Select> End If> End Sub> Public MAX_PLAYERS> ' Executes when the server initially loads.> Sub OnServerLoad()> GameName = GetVar("Data.ini", "CONFIG", "GameName")> MAX_MAPS = GetVar("Data.ini", "MAX", "MAX_MAPS")> MAX_PLAYERS = GetVar("Data.ini", "MAX", "MAX_PLAYERS")> MOTD = GetVar("MOTD.ini", "MOTD", "Msg")> End Sub> > ' Executes when the scripts are reloaded.> Sub OnScriptReload()> GameName = GetVar("Data.ini", "CONFIG", "GameName")> MAX_MAPS = GetVar("Data.ini", "MAX", "MAX_MAPS")> MAX_PLAYERS = GetVar("Data.ini", "MAX", "MAX_PLAYERS")> MOTD = GetVar("MOTD.ini", "MOTD", "Msg")> End SubRegards, Godlord. Link to comment Share on other sites More sharing options...
Kimimaru Posted August 21, 2009 Author Share Posted August 21, 2009 Thanks a lot! I knew I needed to use a FOR loop, but I wasn't sure if the MAX_PLAYERS variable was available in SadScript. I also didn't know how to declare public variables. Thanks again! 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