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

Crap… New error with custom menus....


Akselj
 Share

Recommended Posts

Hi guys!
I had a topic here before about custom menus, but still I can't make 'em work… This time on "AkselJ's custom menu problems": MenuScripts Ifs.

Doh. Can't get menuscripts to work. The custom menu shows, but when I click "Yes" or "No" button, nothing happens... I don't like custom menus...
Here's my code:

```
Sub MenuScripts(Index, Clicked_Index, Menu_Type)
Dim MenuTitle
Dim FieldMessage

MenuTitle = getplayermenuclicktitle(Index)
FieldMessage = getplayermenuclickmsg(Index)

Select Case Menu_Type
Case 1
If Clicked_Index = 1 Then
Call SetPlayerFaction(Index, 1)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "2")
End If
If Clicked_Index = 2
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 3
Call SetPlayerFaction(Index, 2)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "2")
End If
If Clicked_Index = 4
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 5
Call SetPlayerFaction(Index, 3)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "3")
End If
If Clicked_Index = 6
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 7
Call SetPlayerFaction(Index, 4)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "4")
End If
If Clicked_Index = 8
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
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

```
I just started using custom menus, and I can't make them work…. Any help would be appreciated.

Thanks,
AkselJ
Link to comment
Share on other sites

do you have the function for SetPlayerFaction?
do you have the "charextras" folder in your scripts folder?

Maybe its because you arent defining the menu title
If MenuTitle = "name of the menu" Then

might be needed, never tried making a custom menu without that line
Link to comment
Share on other sites

Sure…. Here:
```
' 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

' 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

Sub MenuScripts(Index, Clicked_Index, Menu_Type)
Dim MenuTitle
Dim FieldMessage

MenuTitle = getplayermenuclicktitle(Index)
FieldMessage = getplayermenuclickmsg(Index)

Select Case Menu_Type
Case 1
If Clicked_Index = 1 Then
Call SetPlayerFaction(Index, 1)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "2")
End If
If Clicked_Index = 2
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 3
Call SetPlayerFaction(Index, 2)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "2")
End If
If Clicked_Index = 4
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 5
Call SetPlayerFaction(Index, 3)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "3")
End If
If Clicked_Index = 6
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 7
Call SetPlayerFaction(Index, 4)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "4")
End If
If Clicked_Index = 8
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
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 into the game.
Sub JoinGame(Index)
If GetPlayerAccess(Index) = 0 Then
Call GlobalMsg(GetPlayerName(Index) & " has joined " & GameName & "!", GREY)
Call GlobalMsg(GetPlayerName(Index) & " is a level " & GetPlayerLevel(index) & " " & GetPlayerClassName(Index) & ".", GREY)
Else
Call GlobalMsg("Administrator " & GetPlayerName(Index) & " has joined " & GameName & "!", YELLOW)
Call GlobalMsg(GetPlayerName(Index) & " is a level " & GetPlayerLevel(index) & " " & GetPlayerClassName(Index) & ".", YELLOW)
End If

Call PlayerMsg(Index, "Welcome to " & GameName & "!", WHITE)

If LenB(MOTD) <> 0 Then
Call PlayerMsg(Index, "MOTD: " & MOTD, BRIGHTCYAN)
End If

Call SendWhosOnline(Index)
If GetVar("var.ini", GetPlayerName(index), "startup") = "" Then

weapon = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Weapon"))
armor = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Armor"))
shield = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Shield"))
helmet = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Helmet"))
wepdur = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Wepdur"))
armdur = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Armdur"))
shldur = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Shldur"))
hlmdur = Int(GetVar("classes\class" & GetPlayerClass(index) & ".ini", "StartUp", "Hlmdur"))

If weapon <> 0 Then
Call Give_Item(index, weapon, wepdur)
End If
If armor <> 0 Then
Call Give_Item(index, armor, armdur)
End If
If shield <> 0 Then
Call Give_Item(index, shield, shldur)
End If
If helmet <> 0 Then
Call Give_Item(index, helmet, hlmdur)
End If

Call PutVar("var.ini", GetPlayerName(index), "startup", "yes")
End If

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 > 2500 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 > 2500 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 > 2500 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 > 2500 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 Baron_Uber_Skills(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
If GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "exist") = "" Then
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "name", "name_goes_here")
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_1", "text1_goes_here")
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_2", "text2_goes_here")
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_3", "text3_goes_here")
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_4", "text4_goes_here")
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_5", "text5_goes_here")
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_6", "text6_goes_here")
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_7", "text7_goes_here")
Call PutVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "exist", 1)
ElseIf GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "exist") = 1 Then
Call CustomMenuShow(index, "chatbox_" & GetPlayerMap(Index), "\GUI\CUSTOM\chatbox_1.bmp", 1)
Call CustomMenuLabel(index, 1, GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "name") & " :", 110, 50, 10, 0, 0, 400, 20)
Call CustomMenuLabel(index, 2, GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_1"), 20, 100, 10, 0, 0, 400, 20)
Call CustomMenuLabel(index, 3, GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_2"), 20, 120, 10, 0, 0, 400, 20)
Call CustomMenuLabel(index, 4, GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_3"), 20, 140, 10, 0, 0, 400, 20)
Call CustomMenuLabel(index, 5, GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_4"), 20, 160, 10, 0, 0, 400, 20)
Call CustomMenuLabel(index, 6, GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_5"), 20, 180, 10, 0, 0, 400, 20)
Call CustomMenuLabel(index, 7, GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_6"), 20, 200, 10, 0, 0, 400, 20)
Call CustomMenuLabel(index, 8, GetVar("Scripts\normal_chatbox" & GetPlayerMap(Index) & ".ini", "CHATBOX", "text_7"), 20, 220, 10, 0, 0, 400, 20)
End If
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)

  Dim bounty
  Dim reward
  bounty = GetVar("bounty.ini", & GetPlayerName(Attacker),"Bounty")
  reward = GetVar("bounty.ini", & GetPlayerName(Victim),"Bounty")
  Call GiveCurreny(Attacker,4,reward)
  Call GlobalMsg( GetPlayerName(Victim) & " has been killed by " & GetPlayerName(Attacker),12)
  Call PutVar("bounty.ini","" & GetPlayerName(Victim), "Bounty", "0")

  '''''''''''''''''''''''''''''''''
  '''''''''''''''''''''''''''''''''
  Dim vlvl
  Dim newbounty
  vlvl=GetPlayerLevel(Victim)
  newbounty=GetVar("bounty.ini", & GetPlayerName(Attacker),"Bounty")

  If vlvl>1999 Then
      newbounty=newbounty+5000
  End If
  If vlvl>1499 Then
      newbounty=newbounty+5000
  End If
  If vlvl>999 Then
      newbounty=newbounty+5000
  End If
  If Vlvl>749 Then
      newbounty=newbounty+2500
  End If
  If vlvl>499 Then
      newbounty=newbounty+2500
  End If
  If vlvl>249 Then
      newbounty=newbounty+1500
  End If
  If vlvl>99 Then
      newbounty=newbounty+500
  End If
  If vlvl>49 Then
      newbounty=newbounty+500
  End If

  Call PutVar("bounty.ini", & GetPlayerName(Attacker),"Bounty", & newbounty)
  Call GlobalMsg(GetPlayerName(Attacker) & " has" & newbounty & " bounty.",12)

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.
Sub ScriptedSpell(Index, Script)
Select Case Script
Case 0 'Change to your case
        if 0 + getplayertarget(index) > 0 then
            If GetPlayerMP(index) > 20 Then
                  Call SetPlayerMP(Index, Int(GetPlayerMP(Index) - 20))
  Call Putvar("scripts\Charextras\" & GetPlayerName(target) & ".ini", "Sprite", "Normal sprite:", GetPlayerSprite(target))
                  Call SetPlayerSprite(GetPlayerTarget(index), 2) 'change numberofsprite to the number of the sprite you want player to be transformed to
  Call SetTimer("tmrtest " & target & "," & 1, 60000) '60000 is for 60 sec, numbers is in 1/1000 sec
                  Call Putvar("scripts\Charextras\" & GetPlayerName(target) & ".ini", "Status", "Transformed", "True")
  Call SendPlayerData(index)
    Else
                  Call BattleMsg(index, "Not enough MP!", RED, 0)
            End if
        Else
            Call BattleMsg(Index, "You have no target", RED, 0)
        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 CustomMenuShow(index, "The Red Alliance", "\GUI\CUSTOM\Red.jpg", 1)
        Call CustomMenuLabel(index, 1, "Will you join the Red Alliance?", 150, 50, 10, 0, 0, 400, 20)
Call CustomMenuPicture(index, 1, "\GUI\CUSTOM\yes.jpg",  100, 100)
Call CustomMenuPicture(index, 2, "\GUI\CUSTOM\no.jpg",  300, 100)
Exit Sub
      Case 1
        Call CustomMenuShow(index, "The Blue Alliance", "\GUI\CUSTOM\blue.jpg", 1)
        Call CustomMenuLabel(index, 3, "Will you join the Blue Alliance?", 150, 50, 10, 0, 0, 400, 20)
Call CustomMenuPicture(index, 5, "\GUI\CUSTOM\yes.jpg",  100, 100)
Call CustomMenuPicture(index, 6, "\GUI\CUSTOM\no.jpg",  300, 100)
Exit Sub
      Case 2
        Call CustomMenuShow(index, "The Yellow Alliance", "\GUI\CUSTOM\yellow.jpg", 1)
        Call CustomMenuLabel(index, 3, "Will you join the Yellow Alliance?", 150, 50, 10, 0, 0, 400, 20)
Call CustomMenuPicture(index, 5, "\GUI\CUSTOM\yes.jpg",  100, 100)
Call CustomMenuPicture(index, 6, "\GUI\CUSTOM\no.jpg",  300, 100)
Exit Sub
      Case 3
        Call CustomMenuShow(index, "The Green Alliance", "\GUI\CUSTOM\green.jpg", 1)
        Call CustomMenuLabel(index, 4, "Will you join the Green Alliance?", 150, 50, 10, 0, 0, 400, 20)
Call CustomMenuPicture(index, 7, "\GUI\CUSTOM\yes.jpg",  100, 100)
Call CustomMenuPicture(index, 8, "\GUI\CUSTOM\no.jpg",  300, 100)
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)
Dim TextSay
Dim PlayerID
Dim MapNum

' Get the command and arguments from the cache.
TextSay = Trim(GetVar("Scripts\Command.ini", "TEMP", "Text" & Index))

' Split the command into an array. All arguments are seperated by spaces.
TextSay = Split(TextSay)

Select Case TextSay(0)
Case "/testscripts"
Call TestMain(Index)
Exit Sub

Case "/help"
Call PlayerMsg(Index, "Social Commands:", WHITE)
Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE)
Call PlayerMsg(Index, "-msghere = Emote Message", WHITE)
Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE)
Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE)
Exit Sub

Case "/calladmins"
If GetPlayerAccess(Index) = 0 Then
Call AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN)
Else
Call PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN)
End If
Exit Sub

Case "/admin"
If GetPlayerAccess(Index) > 0 Then
Call PlayerMsg(Index, "Social Commands:", WHITE)
Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE)
Call PlayerMsg(Index, "-msghere = Emote Message", WHITE)
Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE)
Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE)
Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE)
Call PlayerMsg(Index, "Available Admin Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", WHITE)
Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE)
End If
Exit Sub

Case "/warpmeto"
If GetPlayerAccess(Index) > 0 Then
PlayerID = FindPlayer(TextSay(1))

If PlayerID > 0 Then
Call PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID))
Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN)
Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
End If
End If
Exit Sub

Case "/warptome"
If GetPlayerAccess(Index) > 0 Then
PlayerID = FindPlayer(TextSay(1))

If PlayerID > 0 Then
Call PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN)
Else
Call PlayerMsg(Index, "Player is not online.", WHITE)
End If
End If
Exit Sub

Case "/warpto"
If GetPlayerAccess(Index) > 0 Then
MapNum = TextSay(1)

If MapNum > 0 And MapNum <= MAX_MAPS Then
Call PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index))
Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE)
Else
Call PlayerMsg(Index, "Invalid map number.", BRIGHTRED)
End If
End If
Exit Sub
End Select

Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)
End Sub

' Executes on death, dropping all of the players items.
Sub DropItems(Index)
' Remove this to enable.
Exit Sub

If GetPlayerWeaponSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerWeaponSlot(Index), 0)
End If

If GetPlayerArmorSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerArmorSlot(Index), 0)
End If

If GetPlayerHelmetSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerHelmetSlot(Index), 0)
End If

If GetPlayerShieldSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerShieldSlot(Index), 0)
End If

If GetPlayerLegsSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerLegsSlot(Index), 0)
End If

If GetPlayerRingSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerRingSlot(Index), 0)
End If

If GetPlayerNecklaceSlot(Index) > 0 Then
    Call PlayerMapDropItem(Index, GetPlayerNecklaceSlot(Index), 0)
End If
End Sub

' Executes whenever somebody dies outside of an arena.
Sub OnDeath(Index)
Dim MapNum
Dim ClassID
Dim X
Dim Y

If GetMapBootMap(Index) > 0 Then
Call PlayerWarp(Index, GetMapBootMap(Index), GetMapBootX(Index), GetMapBootY(Index))
Else
ClassID = GetPlayerClass(Index)

MapNum = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "Map")

X = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "x")
Y = GetVar("Classes\Class" & ClassID & ".ini", "CLASS", "y")

Call PlayerWarp(Index, 1, 0, 0)
End If
End Sub

' Executes whenever a scripted item is used or double clicked.
Sub ScriptedItem(Index, Script)
Select Case Script
Case 0
Call PlayerMsg(Index, "This scripted item has no apparent use.", WHITE)
Exit Sub

Case Else
Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE)
Exit Sub
End Select
End Sub

' Map Attributes

Sub SetBlank(Map, X, Y)
Call SetAttribute(Map, X, Y, 0, 0, 0, 0, "", "", "")
End Sub

Sub SetBlock(Map, X, Y)
Call SetAttribute(Map, X, Y, 1, 0, 0, 0, "", "", "")
End Sub

Sub SetWarp(Map, X, Y, WarpMap, WarpX, WarpY)
Call SetAttribute(Map, X, Y, 2, WarpMap, WarpX, WarpY, "", "", "")
End Sub

Sub SetItem(Map, X, Y, ItemID, ItemValue)
Call SetAttribute(Map, X, Y, 3, ItemID, ItemValue, 0, "", "", "")
End Sub

Sub SetNPCAvoid(Map, X, Y)
Call SetAttribute(Map, X, Y, 4, 0, 0, 0, "", "", "")
End Sub

Sub SetKeY(Map, X, Y, KeyID, KeyTake)
Call SetAttribute(Map, X, Y, 5, KeyID, KeyTake, 0, "", "", "")
End Sub

Sub SetKeYOpen(Map, X, Y, KeyX, KeyY, Message)
Call SetAttribute(Map, X, Y, 6, KeyX, KeyY, 0, Message, "", "")
End Sub

Sub SetHeal(Map, X, Y)
Call SetAttribute(Map, X, Y, 7, 0, 0, 0, "", "", "")
End Sub

Sub SetKill(Map, X, Y)
Call SetAttribute(Map, X, Y, 8, 0, 0, 0, "", "", "")
End Sub

Sub SetShop(Map, X, Y, ShopID)
Call SetAttribute(Map, X, Y, 9, ShopID, 0, 0, "", "", "")
End Sub

Sub SetClassBlock(Map, X, Y, Allow1, Allow2, Allow3)
Call SetAttribute(Map, X, Y, 10, Allow, Allow2, Allow3, "", "", "")
End Sub

Sub SetArena(Map, X, Y, MapID, NewX, NewY)
Call SetAttribute(Map, X, Y, 11, MapID, NewX, NewY, "", "", "")
End Sub

Sub SetSound(Map, X, Y, FileName)
Call SetAttribute(Map, X, Y, 12, 0, 0, 0, FileName, "", "")
End Sub

Sub SetSpriteChange(Map, X, Y, SpriteID, ItemID, Cost)
Call SetAttribute(Map, X, Y, 13, SpriteID, ItemID, Cost, "", "", "")
End Sub

Sub SetSign(Map, X, Y, Line1, Line2, Line3)
Call SetAttribute(Map, X, Y, 14, 0, 0, 0, Line1, Line2, Line3)
End Sub

Sub SetDoor(Map, X, Y)
Call SetAttribute(Map, X, Y, 15, 0, 0, 0, "", "", "")
End Sub

Sub SetNotice(Map, X, Y, Title, Text, FileName)
Call SetAttribute(Map, X, Y, 16, 0, 0, 0, Title, Text, FileName)
End Sub

Sub SetScripted(Map, X, Y, Script)
Call SetAttribute(Map, X, Y, 18, Script, 0, 0, "", "", "")
End Sub

Sub SetBank(Map, X, Y)
Call SetAttribute(Map, X, Y, 23, 0, 0, 0, "", "", "")
End Sub

'********************************
Function F_Freeslots(index)     
'********************************

Dim slot
Dim count

slot=1
count=0
  Do While slot < 25 
      If getplayerinvitemnum(index, slot) = 0 Then
      count = Int(count) + 1
      End If
  slot=Int(slot) + 1
  Loop
F_Freeslots=Int(count)
End Function

'********************************
Sub Give_Item(index, number, durability)
'********************************

Dim slot

slot = 1
  Do While slot < 25
      If Getplayerinvitemnum( index, Int( slot ) ) = 0 Then
        Call SetPlayerInvItemNum(index, Int( slot ), Int( number ) )
        Call SetPlayerInvItemDur(index, Int( slot ), Int( durability ) )
        Call SetPlayerInvItemValue(index, Int( slot ), Int(0) )
        Call SendInventoryUpdate(index, Int(slot) )
        slot = 25
      End If
  slot = slot + 1
  Loop
End Sub

'********************************
Sub Give_Currency(index, number, quantity)
'********************************

Dim slot
Dim initial
Dim final
Dim given

slot=1
given=0

  Do While slot < 25
      If Getplayerinvitemnum(index,Int(slot))=Int(number) Then
        initial = Getplayerinvitemvalue( index, Int( slot ) )
        final = Int( initial ) + Int( quantity )
        Call setplayerinvitemvalue( index, Int( slot ), Int( final ) )
        Call SendInventoryUpdate(index, Int(slot) )
        slot = 25
        given = 1
      End If
  slot = slot + 1
  Loop

  If given=1 Then
      slot=25
  Else
      slot=1
  End If

  Do While slot < 25
      If Getplayerinvitemnum(index,Int(slot)) = 0 Then
        Call SetPlayerInvItemNum(index, Int( slot ), Int( number ) )
        Call SetPlayerInvItemValue(index, Int( slot ), Int( quantity ) )
        Call SetPlayerInvItemDur(index, Int( slot ), 0 )
        Call SendInventoryUpdate(index, Int(slot) )
        slot = 25
      End If
  slot = slot + 1
  Loop

End Sub

'********************************
Function F_Check_Take(index, number, value)
'********************************

Dim slot

slot = 1
F_Check_Take =0
  Do While slot < 25 
      If Getplayerinvitemnum( index, Int( slot ) ) = Int( number ) Then
        If GetPlayerInvItemValue(index, Int( slot ) ) >= Int(value) Then       
        F_Check_Take=1           
        End If
      End If
  slot = slot + 1
  Loop
End Function

'********************************
Sub Take_Item(index, number, value)
'********************************

Dim slot
Dim taken
Dim initial
Dim final

slot=1
taken=0
  Do While Int(slot) < 25     
      If Int(taken)=0 Then     
        If Getplayerinvitemnum(index,Int(slot)) = Int(number) Then
            If Int(getplayerinvitemvalue(index, Int(slot))) >= Int(value) Then
            initial = Int(getplayerinvitemvalue(index, Int(slot) ) )
            final = Int(initial) - Int(value)           
              If Int(final) <= 0 Then             
              Call setplayerinvitemnum(index, Int(slot), Int(0) )
              Call setplayerinvitemvalue(index, Int(slot), Int(0) )
              Call setplayerinvitemdur(index, Int(slot), Int(0) )
              Call SendInventoryUpdate(index, Int(slot))
              taken=1             
              Else           
              Call setplayerinvitemvalue(index, Int(slot), Int(final) )
              Call SendInventoryUpdate(index, Int(slot) )
              taken=1           
              End If
            End If       
        End If
      End If     
  slot = slot + 1
  Loop
End Sub

'********************************
Sub Baron_Stam_regain(index)
'********************************

Dim skill_type
Dim skill_action
Dim stam_total
Dim player_lvl

skill_type=Trim( GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type") )

  If Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type), "has_data") ) < 1 Then
  Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "Exp", Int(0) )
  Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(0))
  Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(10))
  Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "has_data", Int(1))
  Call battlemsg(index, "You should return here if you wish to rest", 14, 1)
  End If

player_lvl=Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level")
skill_action=Trim(GetVar("scripts\skills\" & skill_type & ".ini", "INDEX","action"))
stam_total=5 + Int(player_lvl)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(stam_total))
Call battlemsg(index, "You feel refreshed and ready to " & skill_action & " again.", 14, 1)
End Sub

'********************************
Sub Baron_Uber_skills(index)
'********************************
'Do not modify this script in any way.
'It is provided as is in all goodwill.
'There is CONSIDERABLE time spent here.
On Error Resume next
Dim skill_type
Dim skill_number
Dim take_total
Dim give_total
Dim count
Dim take_count
Dim take_num
Dim take_val
Dim take_msg
Dim empty_space
Dim take_check
Dim needed_item
Dim player_weapon
Dim skill_action
Dim currency_check
Dim recipe_count
Dim recipe_total
Dim min_lvl
Dim player_lvl
Dim player_stam
Dim recipe_stam
Dim give_val
Dim give_num
Dim give_dur
Dim give_msg
Dim high_randomiser
Dim success_chance
Dim low_chance
Dim high_chance
Dim give_exp
Dim new_exp
Dim lvl_exp
Dim next_lvl

If Int(GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","has_data")) < 0 Then
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type", "")
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","number", 0)
Call Putvar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","has_data", 1)
Call Playermsg(index, "Made skill template for map", 14)
Call Playermsg(index, "Credits go to Baron - http://barony.deviantart.com/", 14)
End If

RECIPE_COUNT = Int(1)
skill_type=Trim( GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","type") )
recipe_total=Int(GetVar("scripts\skills\" & skill_type & ".ini","INDEX" ,"total_recipes"))

'RECIPES ALWAYS HAVE SKILL 1 SELECTED IN MAPEXTRAS AND TOTAL RECIPES IN SKILLS SET TO HIGHEST
'NON RECIPES HAVE ANY SKILL SELECTED IN MAPEXTRAS AND TOTAL RECIPES IN SKILLS SET TO 1

Do While Int(RECIPE_COUNT) <= Int(recipe_total)

  If trim(skill_type) <> "" Then

  skill_number = Int(GetVar("scripts\mapextras\" & GetPlayerMap(index) & ".ini", "SKILL","number"))

  If Int(recipe_count) > 1 Then
  skill_number = Int(recipe_count)
  End If

  needed_item=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"item_num_needed"))
  player_weapon=Int( Getplayerinvitemnum(index, Int(getplayerweaponslot(index)) ) )
  skill_action=Trim(GetVar("scripts\skills\" & skill_type & ".ini", "INDEX","action"))

      If Int(needed_item) = Int(player_weapon) Then

      min_lvl = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"min_level"))

      If Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type), "has_data") ) < 1 Then
      Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "Exp", Int(0) )
      Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(0))
      Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(10))
      Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "has_data", Int(1))
      Call playermsg(index, "You attempt to " & skill_action & " for the first time!", 14)
      End If

      player_lvl = Int(Getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level"))

        If Int(min_lvl) <= Int(player_lvl) Then

        player_stam=Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina"))
        recipe_stam=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"stam_taken"))

        If Int(player_stam) >= Int(recipe_stam) Then

        take_total = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"take_total"))
        give_total = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number),"give_total")) 
          count = Int ( 1 )
          take_count = Int ( 0 )
          empty_space=F_Freeslots(index)

              If Int(give_total) <= Int(empty_space) Then

            Do While count <= Int(take_total)
            take_num=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_num"))
            take_val=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_val")) 

            take_check=F_Check_Take(index,take_num,take_val)
            take_count=take_count + Int(take_check) 
            count=count+1
            Loop

              If Int(take_count) = Int(take_total) Then       

              count = Int ( 1 )     

                  Do While Int(count) <= Int(take_total)
                  take_num=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_num"))
                  take_val=Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_val")) 
                    take_msg=Trim(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_take_Msg"))           
                  Call battlemsg(index, trim(take_msg), 15, 1) 
                  Call Take_Item(index, Int(take_num), Int(take_val) )       
                  count=count+1
                  Loop

                  count = Int ( 1 )
                  new_exp = 0

                  Do While Int(count) <= Int(give_total)
                  give_val = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_val"))
                  give_msg = Trim(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_msg"))

                  success_chance = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_base_chance"))
                  low_chance= Int(player_lvl) - Int(min_lvl) + 1
                  high_chance = Int(player_lvl) - Int(min_lvl) + Int(success_chance)
                  high_randomiser = Int((high_chance + 1) * Rnd)

                  If Int(high_randomiser) <= Int(low_chance) Then                 

                    If Int(give_val) > 0 Then
                    give_num = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_num"))
                    Call Give_Currency(index, Int(give_num), Int(give_val) )
                    Call battlemsg(index, Trim(give_msg),10, 1)
                    'TO HAVE THE SCRIPT AUTO CREATE ALL ITEMS IT CAN ONCE EACH, REMOVE LINE BELOW
                    RECIPE_COUNT= Int(recipe_total)
                    Else
                    give_num = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_num"))
                    give_dur = Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_give_dur"))
                    Call Give_Item(index, give_num, give_dur)
                    Call battlemsg(index, Trim(give_msg),10, 1)
                    'TO HAVE THE SCRIPT AUTO CREATE ALL ITEMS IT CAN ONCE EACH, REMOVE LINE BELOW
                    RECIPE_COUNT= Int(recipe_total)
                    End If

                    give_exp = 0 + Int(GetVar("scripts\skills\" & skill_type & ".ini", Int(skill_number), Int(count) & "_EXP"))
                    new_exp = 0 + Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp")) + Int(give_exp)
                      Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp", Int(new_exp))
                  End If

                  If new_exp=0 Then
                  new_exp=Int(getvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp"))
                  End If

                  count=count+1
                  Loop

                  next_level = Int(player_lvl) + Int(1)
                  lvl_exp = Int(Getvar("experience.ini", "EXPERIENCE", "Exp" & Int(next_level) ) )
                  Call battlemsg(index,new_exp & " / " & lvl_exp & " For " & next_level & " " & trim(skill_type), 6, 0)

                  If Int(new_exp) >= Int(lvl_exp) and Int(player_lvl) < 100 Then
                  new_exp= 0 + Int(new_exp) - Int(lvl_exp)                 
                  Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "exp", Int(new_exp))
                  Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "level", Int(next_level))
                  Call battlemsg(index, "Congratulations, you are now level " & Int(next_level) & " in " & trim(skill_type) & "!", 13, 1)
                  End If

                  player_stam = Int(player_stam) - Int(recipe_stam)
                  Call putvar("scripts\charextras\" & GetPlayerName(index) & ".ini", Trim(Skill_type) , "stamina", Int(player_stam))

                  If Int(recipe_total) = 1 Then
                  RECIPE_COUNT= Int(recipe_total)
                  End If                         

                Else               
                    If Int(recipe_count) + 1 > Int(recipe_total) and Int(recipe_total) > Int(1) Then
                  Call battlemsg(index, "You have no components to " & skill_action, 12, 1)
                  End If   
              End If       

            Else     
            Call battlemsg(index, "You need more inventory room to continue " & skill_type & ".", 15, 1)           
            End If

          Else
          Call battlemsg(index, "You are too tired to " & skill_action & ".", 12, 1)
          End If

          Else
          Call battlemsg(index, "You get nothing.", 15, 1)         
          End If

      End If
        'This continues off end of item script. Used when empty slot. Elseif errors usually.
      If Int(needed_item) <> Int(player_weapon) and Int(recipe_count) = 1 Then
        Call battlemsg(index, "You need to get the right tool/component to " & skill_action & " here.", 15, 1)     
      End If

    Else
    'Not working. Cant figure out why. Is non essential for the script to work.
    Call Playermsg(index, "You still need to define a skill for this map", 14)
  End If

RECIPE_COUNT = Int(recipe_count)+1

Loop

End Sub

Sub TakeItem(index, item, value)
If value = "all" Then
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
Call SetPlayerInvItemNum(index, SLOT, 0)
Call SetPlayerInvItemValue(index, SLOT, 0)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub
Else
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
Call SetPlayerInvItemNum(index, SLOT, 0)
Call SetPlayerInvItemValue(index, SLOT, GetPlayerInvItemValue(index, SLOT) - value)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub
End If

Sub GiveItem(index, item, value)
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = 0 Then
Call SetPlayerInvItemNum(index, SLOT, item)
Call SetPlayerInvItemValue(index, SLOT, value)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub

'********************************
Sub quest_Take_Item(index, number, value)
'********************************

Dim slot
Dim initial
Dim final
Dim taken

slot=1
  Do While Int(slot) < 25
      If taken <> 1 Then           
        If Getplayerinvitemnum(index,Int(slot)) = Int(number) Then
            If Int(getplayerinvitemvalue(index, Int(slot))) >= Int(value) Then
            initial = Int(getplayerinvitemvalue(index, Int(slot) ) )
            final = Int(initial) - Int(value)           
              If Int(final) <= 0 Then             
              Call setplayerinvitemnum(index, Int(slot), Int(0) )
              Call setplayerinvitemvalue(index, Int(slot), Int(0) )
              Call setplayerinvitemdur(index, Int(slot), Int(0) )
              Call SendInventoryUpdate(index, Int(slot))
              taken=1             
              Else           
              Call setplayerinvitemvalue(index, Int(slot), Int(final) )
              Call SendInventoryUpdate(index, Int(slot) )
              taken=1           
              End If
            End If       
        End If
      End If     
  slot = slot + 1
  Loop
End Sub

```
Link to comment
Share on other sites

Okay, first is in the MenuScripts sub; I'm not sure if you've already fixed this one:```
        If Clicked_Index = 2
            Call PlayerWarp(Index, 63, 15, 15)
            Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
        End If
        If Clicked_Index = 3
            Call SetPlayerFaction(Index, 2)
            Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "2")
        End If
        If Clicked_Index = 4
            Call PlayerWarp(Index, 63, 15, 15)
            Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
        End If
        If Clicked_Index = 5
            Call SetPlayerFaction(Index, 3)
            Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "3")
        End If
        If Clicked_Index = 6
            Call PlayerWarp(Index, 63, 15, 15)
            Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
        End If
        If Clicked_Index = 7
            Call SetPlayerFaction(Index, 4)
            Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "4")
        End If
        If Clicked_Index = 8
            Call PlayerWarp(Index, 63, 15, 15)
            Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
        End If

```Each If statement here needs a Then at the end of the line.

The next is in OnPVPDeath, there's a bunch of GetVar and PutVar statements with & floating around in them for no reason, and those need to be removed.  Ex:
bounty = GetVar("bounty.ini", & GetPlayerName(Attacker),"Bounty")
reward = GetVar("bounty.ini", & GetPlayerName(Victim),"Bounty")
should be
bounty = GetVar("bounty.ini", GetPlayerName(Attacker),"Bounty")
reward = GetVar("bounty.ini", GetPlayerName(Victim),"Bounty")
And so on for the rest of the sub. 

The next is in TakeItem, there's a few places where End Sub is used in place of Exit Sub.  Fixed version of the sub:
```
Sub TakeItem(index, item, value)
If value = "all" Then
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
Call SetPlayerInvItemNum(index, SLOT, 0)
Call SetPlayerInvItemValue(index, SLOT, 0)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
Exit Sub
Else
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
Call SetPlayerInvItemNum(index, SLOT, 0)
Call SetPlayerInvItemValue(index, SLOT, GetPlayerInvItemValue(index, SLOT) - value)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
Exit Sub
End If
End Sub

```
That should be all of the syntax errors in your main.txt.
Link to comment
Share on other sites

First error: Fixed.
Second: I was aware of that, thought I fixed it. (Gh0st made it, but he used "&" every time he was putting in another get or variable command in a GetVar)
Third: I never thought the TakeItem would have errors… You just found out why TakeItem commands won't work for me!
Link to comment
Share on other sites

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...