Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Anonymous

Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by Anonymous

  1. ``` Sub LeftGame(index) Call RemoveTimer("WHATEVER_THE_SUB_NAME_IS " & "WHATEVER_PARAMETERS_THE_SUB_HAS") End Sub ``` http://www.touchofdeathforums.com/smf/index.php/topic,16378.0.html
  2. ``` Case 2 x = GetPlayerX(index) y = GetPlayerY(index) Select Case GetPlayerDir(index) Case 0 y = y - 2 Case 1 y = y + 2 Case 2 x = x - 2 Case 3 x = x + 2 End Select If x >= 0 And x = 0 And y
  3. *cringe* All apologies for the long post. Syntactically correct here. If that doesn't fix the problem, it's something else. ``` ' Eclipse Evolution 2.7 Scripting File ' Global Variables Public GameName Public MAX_MAPS Public MOTD ' Color Constants Public Const BLACK = 0 Public Const BLUE = 1 Public Const GREEN = 2 Public Const CYAN = 3 Public Const RED = 4 Public Const MAGENTA = 5 Public Const BROWN = 6 Public Const GREY = 7 Public Const DARKGREY = 8 Public Const BRIGHTBLUE = 9 Public Const BRIGHTGREEN = 10 Public Const BRIGHTCYAN = 11 Public Const BRIGHTRED = 12 Public Const PINK = 13 Public Const YELLOW = 14 Public Const WHITE = 15 ' Admin Constants Public Const ADMIN_MONITER = 1 Public Const ADMIN_MAPPER = 2 Public Const ADMIN_DEVELOPER = 3 Public Const ADMIN_CREATOR = 4 ' Executes when the server initially loads. Sub OnServerLoad() GameName = GetVar("Data.ini", "CONFIG", "GameName") MAX_MAPS = GetVar("Data.ini", "MAX", "MAX_MAPS") MOTD = GetVar("MOTD.ini", "MOTD", "Msg") End Sub Sub JoinGame(Index) If Trim(MOTD) "" Then Call PlayerMsg(index, "MOTD: " & MOTD, 11) Call HighScore(Index) End If If GetPlayerAccess(index) = 4 Then Call GlobalMsg(GetPlayerName(index) & " (Administrator) has joined " & GameName & "!", 12) End If If GetPlayerAccess(index) = 3 Then Call GlobalMsg(GetPlayerName(index) & " (Developer) has joined " & GameName & "!", 12) End If If GetPlayerAccess(index) = 2 Then Call GlobalMsg(GetPlayerName(index) & " (Mapper) has joined " & GameName & "!", 12) End If If GetPlayerAccess(index) = 1 Then Call GlobalMsg(GetPlayerName(index) & " (Moderator) has joined " & GameName & "!", 12) End If If GetPlayerAccess(index) = 0 Then Call GlobalMsg(GetPlayerName(index) & " has joined " & GameName & "!", 12) End If Call PlayerMsg(Index, "Welcome to " & GameName & "!", WHITE) Call SendWhosOnline(Index) End Sub ' Executes when the scripts are reloaded. Sub OnScriptReload() GameName = GetVar("Data.ini", "CONFIG", "GameName") MAX_MAPS = GetVar("Data.ini", "MAX", "MAX_MAPS") MOTD = GetVar("MOTD.ini", "MOTD", "Msg") End Sub ' Executes the MOTD is changed by the client. Sub ChangeMOTD() MOTD = GetVar("MOTD.ini", "MOTD", "Msg") End Sub ' Executes when a new character is created. Sub OnNewChar(Index, CharNum) End Sub ' Executes every second, based on the server time. Sub TimedEvent(Hours, Minutes, Seconds) If Minutes = 0 Then If Seconds = 0 Then Call AdminMsg("Don't forget to vote for Eclipse.", YELLOW) End If End If End Sub ' Executes when a player presses the CONTROL key. Sub OnAttack(Index, Damage) Dim Target If Int(Damage) > 0 Then If Int(GetPlayerTarget(Index)) > 0 Then Target = GetPlayerTarget(Index) Call DamagePlayer(Index, Target, Damage) Else Target = GetPlayerTargetNPC(Index) Call DamageNPC(Index, Target, Damage) End If End If End Sub Sub OnArrowHit(Index, Damage) Dim Target If Int(Damage) > 0 Then If Int(GetPlayerTarget(Index)) > 0 Then Target = GetPlayerTarget(Index) Call DamagePlayer(Index, Target, Damage) Else Target = GetPlayerTargetNPC(Index) Call DamageNPC(Index, Target, Damage) End If End If End Sub Sub PlayerHit(Index, NPCNum, Damage) If Damage > 0 Then Call NPCAttack(NPCNum, Index, Damage) End If End Sub ' Executes when a hotkey is pressed client-side. Sub HotScript(Index, KeyID) Select Case KeyID ' Executes when any player presses the PageUp key. Case 1 ' Executes when any player presses the Delete key. Case 2 ' Executes when players press the End key. Case 3 ' Executes when players press the PageDown key. Case 4 End Select End Sub ' Executes when something on a custom menu is clicked. Sub MenuScripts(Index, Clicked_Index, Menu_Type) Dim MenuTitle Dim FieldMessage MenuTitle = getplayermenuclicktitle(Index) FieldMessage = getplayermenuclickmsg(Index) Select Case Menu_Type Case 1 Call PlayerMsg(Index, "Clicked picture number " & Clicked_Index & " on the menu named " & MenuTitle, YELLOW) Case 2 Call PlayerMsg(Index, "Clicked field number " & Clicked_Index & " on the menu named " & MenuTitle & ". The field text was " & FieldMessage, YELLOW) Case 3 Call PlayerMsg(Index, "Clicked label number " & Clicked_Index & " on the menu named " & MenuTitle, YELLOW) End Select End Sub ' Executes when a player logs out of the game. Sub LeftGame(Index) If GetPlayerAccess(Index) = 0 Then Call GlobalMsg(GetPlayerName(Index) & " has left " & GameName & "!", GREY) Else Call GlobalMsg("Administrator " & GetPlayerName(Index) & " has left " & GameName & "!", YELLOW) End If End Sub ' Executes when a players experience exceeds the next level requirement. Sub PlayerLevelUp(Index) Dim TotalExp Do While GetPlayerExp(Index) >= GetPlayerNextLevel(Index) TotalExp = GetPlayerExp(Index) - GetPlayerNextLevel(Index) Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 1) Call SetPlayerExp(Index, TotalExp) Loop Call BattleMsg(Index, "You have " & GetPlayerPOINTS(Index) & " stat points.", BRIGHTBLUE, 0) End Sub ' Executes when a player uses one of the points given on an attribute to level up. Sub UsingStatPoints(Index, PointType) Select Case PointType Case 0 If GetPlayerSTR(Index) + 1 > 1000 Then Call BattleMsg(Index, "You have maxed your strength!", BRIGHTRED, 0) Exit Sub End If Call SetPlayerSTR(Index, GetPlayerSTR(Index) + 1) Call BattleMsg(Index, "You have gained more strength!", WHITE, 0) Case 1 If GetPlayerDEF(Index) + 1 > 1000 Then Call BattleMsg(Index, "You have maxed your defence!", BRIGHTRED, 0) Exit Sub End If Call SetPlayerDEF(Index, GetPlayerDEF(Index) + 1) Call BattleMsg(Index, "You have gained more defense!", WHITE, 0) Case 2 If GetPlayerMAGI(Index) + 1 > 1000 Then Call BattleMsg(Index, "You have maxed your magic!", BRIGHTRED, 0) Exit Sub End If Call SetPlayerMAGI(Index, GetPlayerMAGI(Index) + 1) Call BattleMsg(Index, "You have gained more magic!", WHITE, 0) Case 3 If GetPlayerSPEED(Index) + 1 > 1000 Then Call BattleMsg(Index, "You have maxed your speed!", BRIGHTRED, 0) Exit Sub End If Call SetPlayerSPEED(Index, GetPlayerSPEED(Index) + 1) Call BattleMsg(Index, "You have gained more speed!", WHITE, 0) End Select ' Remove one point after the sub in question is done Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) - 1) End Sub ' Executes when a player steps onto a scripted tile. Sub ScriptedTile(Index, Script) Select Case Script Case 0 Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "DEATH", "playerdie_map", GetPlayerMap(index)) Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "DEATH", "playerdie_x", GetPlayerX(index)) Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "DEATH", "playerdie_y", GetPlayerY(index)) Exit Sub Case 1 Call Uber_Scripted_Tiles(index) Exit Sub Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End Select End Sub ' Executes when a player clicks on an OnClick tile. Sub OnClick(Index, Script) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted tile has no apparent use.", WHITE) Exit Sub Case Else Call PlayerMsg(Index, "No tile script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End Select End Sub ' Out-dated: Executes when a player chooses yes or no on a player prompt. Sub PlayerPrompt(Index, Prompt, Value) If Prompt = 6 Then Select Case Value Case 0 Call GlobalMsg("Hi This is a Yes answer!", CYAN) Case 1 Call GlobalMsg("This is case 1?", CYAN) End Select Else Select Case Value Case 0 Call GlobalMsg("Hi This is a No answer!", RED) Case 1 Call GlobalMsg("This is no case 1?", RED) End Select End If End Sub ' Out-dated: Executes query box responses. Sub QueryBox(Index, Prompt) Value = GetVar("responses.ini", "Responses", CStr(Index)) End Sub ' Executes every time a player drops an item. Sub OnItemDrop(Index, Map, ItemNum, ItemVal, ItemDur, ItemIndex, InvSlot) End Sub ' Executes each time a player changes map. Sub OnMapLoad(Index, OldMap, NewMap) End Sub ' Executes whenever an NPC is killed. ' Note: Death occurs as normal externally to this script. Sub OnNPCDeath(Index, Map, NPCNum, NPCIndex) Call BattleMsg(Index, "You killed a " & getnpcname(NPCNum) & ".", BRIGHTRED, 0) End Sub ' Executes when a player is killed by another. ' Note: Death occurs as normal externally to this script. Sub OnPVPDeath(Attacker, Victim) Call GlobalMsg(GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker), BRIGHTRED) End Sub ' Executes when a player dies in an arena by another player. Sub OnArenaDeath(Attacker, Victim) Dim Map Dim X Dim Y Dim Data1 Dim Data2 Dim Data3 Map = GetPlayerMap(Victim) X = GetPlayerX(Victim) Y = GetPlayerY(Victim) Call GlobalMsg(GetPlayerName(Victim) & " has been defeated in the arena by " & GetPlayerName(Attacker), BRIGHTRED) Call SetPlayerHP(Victim, GetPlayerMaXHP(Victim)) Call SetPlayerMP(Victim, GetPlayerMaXMP(Victim)) Call sendHp(Victim) Call sendMP(Victim) Data1 = GetTileData1(Map, X, Y) Data2 = GetTileData2(Map, X, Y) Data3 = GetTileData3(Map, X, Y) Call PlayerWarp(Victim, Data1, Data2, Data3) End Sub ' Executes whenever a player casts a scripted spell. '*******Level Up Spell********* Sub ScriptedSpell(index, Script) Select Case Script Case 0 Dim mpneeded 'Declare the MP variable mpneeded = 5 'The amount of MP needed If GetPlayerMP(index) >= mpneeded Then 'Check if the player has the required amount of MP Call SetPlayerLevel(index, GetPlayerLevel(Index) +1) 'Increase the player's level by one Call SetPlayerMP( Index, GetPlayerMP( Index) - mpneeded) 'Substract the MP thats needed Call SendStats( Index) 'Updates the player's stats Call playerMsg(Index, "You granted a level!", WHITE) End If Case Else Call PlayerMsg(Index, "No spell script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End Select End Sub ' Executes whenever a scripted NPC does an action. Sub ScriptedNPC(Index, Script) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted NPC has no apparent use.", WHITE) Exit Sub Case Else Call PlayerMsg(Index, "No NPC script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End Select End Sub ' Executed whenever a slash command is sent to the server. '******************************** Sub Commands(index) '******************************** On Error Resume Next Dim i Dim TextSay Dim n Dim m Dim C Dim test Dim mapnum Dim x Dim y Dim tile Dim map m = GetVar("Data.ini", "MAX", "MAX_MAPS") TextSay = GetVar("Scripts\Command.ini", "TEMP", "Text" & index) i = 1 C = 0 ' If LCase(Mid(TextSay, 1, 5)) = "/wish" Then If Len(TextSay) > 6 Then TextSay = Mid(TextSay, 6, Len(TextSay) - 5) Do While C = 0 If GetVar("wishes.ini", "WISH", "Wish" & i) "" Then i = i + 1 Else Call PutVar("wishes.ini", "WISH", "Wish" & i, Trim(TextSay)) Call PlayerMsg(index, "Thank You For Wishing!", 10) C = 1 End If Loop End If Exit Sub End If ' If LCase(Mid(TextSay, 1, 9)) = "/warpmeto" Then If Len(TextSay) > 10 Then TextSay = Mid(TextSay, 10, Len(TextSay) - 9) ' Prevent hacking If GetPlayerAccess(index) < 2 Then Call PlayerMsg(index, "You need be of a higher access to use this command!", 12) Exit Sub End If ' The player n = FindPlayer(TextSay) If n index Then If n > 0 Then Call PlayerWarp(index, GetPlayerMap(n), GetPlayerX(n), GetPlayerY(n)) Call PlayerMsg(n, GetPlayerName(index) & " has warped to you.", 14) Call PlayerMsg(index, "You have been warped to " & GetPlayerName(n) & ".", 10) Call AddLog(GetPlayerName(index) & " has warped to " & GetPlayerName(n) & ", map #" & GetPlayerMap(n) & ".", ADMIN_LOG) Else Call PlayerMsg(index, "Player is not online.", 12) End If Else Call PlayerMsg(index, "You cannot warp to yourself!", 12) End If End If Exit Sub End If ' If LCase(Mid(TextSay, 1, 10)) = "/setportal" Then n = Mid(TextSay, 11, Len(TextSay) - 10) If GetPlayerAccess(index) >= 1 Then Call PlayerMsg(index, "You have created a portal opening at this spot! You may now return to this spot at any time by typing /portal " & n, 10) Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "map" & n, GetPlayerMap(index)) Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "x" & n, GetPlayerX(index)) Call PutVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "y" & n, GetPlayerY(index)) Else Call PlayerMsg(index, "You do not have that ability.", 12) End If Exit Sub End If ' If LCase(Mid(TextSay, 1, 7)) = "/portal" Then n = Mid(TextSay, 8, Len(TextSay) - 7) mapnum = GetVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "map" & n) y = GetVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "y" & n) x = GetVar("scripts\charextras\" & trim(GetPlayerName(index)) & ".ini", "PORTALS", "x" & n) If GetPlayerAccess(index) >= 1 Then Call PlayerWarp(index, mapnum, x, y) Else Call PlayerMsg(index, "You do not have that ability.", 12) End If Exit Sub End If ' If LCase(Mid(TextSay, 1, 9)) = "/warptome" Then If Len(TextSay) > 10 Then If GetPlayerAccess(index) < 2 Then Call PlayerMsg(index, "You need be of a higher access to use this command!", 12) Exit Sub End If n = Mid(TextSay, 10, Len(TextSay) - 9) n = FindPlayer(n) If n index Then If n > 0 Then Call PlayerWarp(n, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index)) Call PlayerMsg(n, "You have been summoned by " & GetPlayerName(index) & ".", 14) Call PlayerMsg(index, GetPlayerName(n) & " has been summoned.", 10) Call AddLog(GetPlayerName(index) & " has warped " & GetPlayerName(n) & " to self, map #" & GetPlayerMap(index) & ".", ADMIN_LOG) Else Call PlayerMsg(index, "Player is not online.", 12) End If Else Call PlayerMsg(index, "You cannot warp yourself to yourself!", 12) End If End If Exit Sub End If ' If LCase(Mid(TextSay, 1, 7)) = "/warpto" Then If Len(TextSay) > 8 Then TextSay = Mid(TextSay, 8, Len(TextSay) - 7) n = TextSay If n > 0 And n
  4. Trim() removes spaces from the beginning and end. Trim(" this text ") becomes simply "this text" As a side note, the third parameter of Mid() is optional. Mid(TextSay, 7) returns the rest of the text after the 7th character.
×
×
  • Create New...