viciousdead Posted April 27, 2010 Author Share Posted April 27, 2010 Ok, I got the script to load correctly, but now I'm having problems with God's New Inventory script..```'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Module: Main.txt '' Author: Stephan J.R. van Schaik '' Date: August 30th, 2009. '' Version: 1.0.0 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Constants & Globals' Color ConstantsPublic Const BLACK = 0Public Const BLUE = 1Public Const GREEN = 2Public Const CYAN = 3Public Const RED = 4Public Const MAGENTA = 5Public Const BROWN = 6Public Const GREY = 7Public Const DARKGREY = 8Public Const BRIGHTBLUE = 9Public Const BRIGHTGREEN = 10Public Const BRIGHTCYAN = 11Public Const BRIGHTRED = 12Public Const PINK = 13Public Const YELLOW = 14Public Const WHITE = 15' Admin ConstantsPublic Const ADMIN_PLAYER = 0Public Const ADMIN_MONITOR = 1Public Const ADMIN_MAPPER = 2Public Const ADMIN_DEVELOPER = 3Public Const ADMIN_CREATOR = 4Public Const ADMIN_OWNER = 5' Alignment constantsPublic Const LEFT = 0Public Const RIGHT = 1Public Const CENTER = 2' Stat constantsPublic Const STAT_STRENGHT = 0Public Const STAT_DEFENCE = 1Public Const STAT_MAGIC = 2Public Const STAT_SPEED = 3' Key constantsPublic Const KEY_PAGEUP = 1Public Const KEY_PAGEDOWN = 4Public Const KEY_DELETE = 2Public Const KEY_END = 3' Element type constantsPublic Const ELEMENT_PICTURE = 1Public Const ELEMENT_FIELD = 2Public Const ELEMENT_LABEL = 3' Tile type constantsPublic Const TILE_TYPE_WALKABLE = 0Public Const TILE_TYPE_BLOCKED = 1Public Const TILE_TYPE_WARP = 2Public Const TILE_TYPE_ITEM = 3Public Const TILE_TYPE_NPCAVOID = 4Public Const TILE_TYPE_KEY = 5Public Const TILE_TYPE_KEYOPEN = 6Public Const TILE_TYPE_HEAL = 7Public Const TILE_TYPE_KILL = 8Public Const TILE_TYPE_SHOP = 9Public Const TILE_TYPE_CBLOCK = 10Public Const TILE_TYPE_ARENA = 11Public Const TILE_TYPE_SOUND = 12Public Const TILE_TYPE_SPRITE_CHANGE = 13Public Const TILE_TYPE_SIGN = 14Public Const TILE_TYPE_DOOR = 15Public Const TILE_TYPE_NOTICE = 16Public Const TILE_TYPE_CHEST = 17Public Const TILE_TYPE_CLASS_CHANGE = 18Public Const TILE_TYPE_SCRIPTED = 19'Public Const TILE_TYPE_NPC_SPAWN = 20Public Const TILE_TYPE_HOUSE = 21'Public Const TILE_TYPE_CANON = 22Public Const TILE_TYPE_BANK = 23'Public Const TILE_TYPE_SKILL = 24Public Const TILE_TYPE_GUILDBLOCK = 25Public Const TILE_TYPE_HOOKSHOT = 26Public Const TILE_TYPE_WALKTHRU = 27Public Const TILE_TYPE_ROOF = 28Public Const TILE_TYPE_ROOFBLOCK = 29Public Const TILE_TYPE_ONCLICK = 30Public Const TILE_TYPE_LOWER_STAT = 31' MAX constants.Public Const MAX_INVSLOTS = 24' Data.ini (config) settings.Public GameNamePublic WebSitePublic PortPublic HPRegenPublic HPTimerPublic MPRegenPublic MPTimerPublic SPRegenPublic SPTimerPublic NPCRegenPublic ScrollingPublic ScrollXPublic ScrollYPublic ScriptingPublic ScriptErrorsPublic PaperDollPublic SaveTimePublic SpriteSizePublic CustomPublic PKMinLvlPublic LevelPublic EmailPublic VerifyAccPublic ClassesPublic Stat1Public Stat2Public Stat3Public Stat4Public SPAttackPublic SPRunning' Data.ini (max) settings.Public MAX_PLAYERSPublic MAX_ITEMSPublic MAX_NPCSPublic MAX_SHOPSPublic MAX_SPELLSPublic MAX_MAPSPublic MAX_MAP_ITEMSPublic MAX_GUILDSPublic MAX_GUILD_MEMBERSPublic MAX_EMOTICONSPublic MAX_ELEMENTSPublic MAX_LEVELPublic MAX_PARTY_MEMBERSPublic MAX_SCRIPTSPELLSPublic MAX_MAP_XPublic MAX_MAP_YPublic MAX_STAT' MOTDPublic MOTD' Events' Initialisation & Reloading#include #include #include ' Interactivity#include #include #include #include #include #include ' Joining & Leaving#include #include #include ' Death#include #include #include #include #include ' Attacks#include #include #include ' Scripted#include #include #include #include ' Leveling#include #include ' Misc#include #include #include ' Modules#include #include #include #include #include #include ' Functions' General#include #include '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Module: Inventory.ess '' Author: Stephan J.R. van Schaik '' Date: September 6th, 2009. '' Version: 1.2.0 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: AddPlayerInvItem '' Brief: adds an item to the inventory. '' Parameters: '' Index: the index number of the player. '' Item: the item to add. '' Durability: the durability of the item to add. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Function AddPlayerInvItem(Index, Item, Durability) Dim Amount Amount = 0 For Slot = 1 To MAX_INVSLOTS If GetPlayerInvItemNum(Index, Slot) = 0 Then Call SetPlayerInvItemNum(Index, Slot, Item) Call SetPlayerInvItemValue(Index, Slot, 0) Call SetPlayerInvItemDur(Index, Slot, Durability) Call SendInventoryUpdate(Index, Slot) AddPlayerInvItem = True Exit Function End If Next AddPlayerInvItem = FalseEnd Function'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: AddPlayerInvStackableItem '' Brief: adds a stackable item to the inventory. '' Parameters: '' Index: the index number of the player. '' Item: the item to add. '' Amount: the amount to add. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Function AddPlayerInvStackableItem(Index, Item, Amount) Dim Amount Amount = 0 For Slot = 1 To MAX_INVSLOTS If GetPlayerInvItemNum(Index, Slot) = Item Then Call SetPlayerInvItemNum(Index, Slot, Item) Call SetPlayerInvItemValue(Index, Slot, 0) Call SetPlayerInvItemDur(Index, Slot, 0) Call SendInventoryUpdate(Index, Slot) AddPlayerInvStackableItem = True Exit Function End If Next For Slot = 1 To MAX_INVSLOTS If GetPlayerInvItemNum(Index, Slot) = 0 Then Call SetPlayerInvItemNum(Index, Slot, Item) Call SetPlayerInvItemValue(Index, Slot, Amount) Call SetPlayerInvItemDur(Index, Slot, 0) Call SendInventoryUpdate(Index, Slot) AddPlayerInvStackableItem = True Exit Function End If Next AddPlayerInvStackableItem = FalseEnd Function'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: CountPlayerInvItem '' Brief: counts an item in the inventory. '' Parameters: '' Index: the index number of the player. '' Item: the item to count. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Function CountPlayerInvItem(Index, Item) Dim Amount Amount = 0 For Slot = 1 To MAX_INVSLOTS If GetPlayerInvItemNum(Index, Slot) = Item Then If GetPlayerInvItemValue(Index, Slot) = 0 Then Amount = Amount + 1 Else Amount = Amount + GetPlayerInvItemValue(Index, Slot) End If End If Next CountPlayerInvItem = AmountEnd Function'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: RemovePlayerInvItem '' Brief: removes an item from the inventory. '' Parameters: '' Index: the index number of the player. '' Item: the item to remove. '' Amount: the amount to remove. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Sub RemovePlayerInvItem(Index, Item, Amount) For Slot = 1 To MAX_INVSLOTS If GetPlayerInvItemNum(Index, Slot) = Item Then If GetPlayerInvItemValue(Index, Slot) = 0 Then Amount = Amount - 1 Call SetPlayerInvItemNum(Index, Slot, 0) Call SetPlayerInvItemValue(Index, Slot, 0) Call SetPlayerInvItemDur(Index, Slot, 0) Call SendInventoryUpdate(Index, Slot) ElseIf Amount >= GetPlayerInvItemValue(Index, Slot) Then Amount = Amount - GetPlayerInvItemValue(Index, Slot) Call SetPlayerInvItemNum(Index, Slot, 0) Call SetPlayerInvItemValue(Index, Slot, 0) Call SetPlayerInvItemDur(Index, Slot, 0) Call SendInventoryUpdate(Index, Slot) Else Call SetPlayerInvItemValue(Index, Slot, GetPlayerInvItemValue(Index, Slot) - Amount) Call SendInventoryUpdate(Index, Slot) Amount = 0 End If If Amount <= 0 Then Exit Sub End If End If NextEnd Sub'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: GetPlayerInvSlots '' Brief: gets the free inventory slots. '' Parameters: '' Index: the index number of the player. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Function GetPlayerInvSlots(Index) Dim Amount Amount = 0 For Slot = 1 To MAX_INVSLOTS If GetPlayerInvItemNum(Index, Slot) = 0 Then Amount = Amount + 1 End If Next GetPlayerInvSlots = AmountEnd Function'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: ClearPlayerInv '' Brief: clears the inventory of a player. '' Parameters: '' Index: the index number of the player. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Sub ClearPlayerInv(Index) Dim Amount Amount = 0 For Slot = 1 To MAX_INVSLOTS Call SetPlayerInvItemNum(Index, Slot, 0) Call SetPlayerInvItemValue(Index, Slot, 0) Call SetPlayerInvItemDur(Index, Slot, 0) Next Call SendInventory(Index)End Sub' For testing the script.#include ```Anyone know why the scripts arn't working? Link to comment Share on other sites More sharing options...
SawQuart Posted April 27, 2010 Share Posted April 27, 2010 More details please? Link to comment Share on other sites More sharing options...
viciousdead Posted April 27, 2010 Author Share Posted April 27, 2010 @נÅøgâ„“Ñâ€Ã‘‚ÃĄâ€:> More details please?Here is my Scripted Item.ESS:```'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Module: ScriptedItem.ess '' Author: Stephan J.R. van Schaik '' Date: August 30th, 2009. '' Version: 1.0.0 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: ScriptedItem '' Brief: executes when somebody uses an item. '' Parameters: '' Index: the index of the player. '' Script: the script to execute. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Sub ScriptedItem(Index, Script, Slot) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted item has no apparent use.", WHITE) Exit Sub Case 1 If CanTake(Index, 22, 1) Then Call TakeItem(Index, 22, 1) Call PlayerWarp(Index, 11, 9, 5) Call PlayerMsg(Index, "You have been warped to Rex.", BRIGHTRED) Exit Sub Case 2 Dim PlayerEXP If CanTake(Index, 23, 1) Then Call TakeItem(Index, 23, 1) Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call PlayerMsg(Index, "You have been gained a level, by drinking the Kuro Potion", YELLOW) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Exit Sub Case 3 If CanTake(Index, 25, 1) Then Call TakeItem(Index, 25, 1) z = Rand(1, 300) If z <= 100 And z >= 50 Then Call GiveItem(Index, 7, 10000) Call PlayerMsg(Index, "You won Basic Sword.", WHITE) End If If z <= 49 And z >= 11 Then Call GiveItem(Index, 15, 10000) Call PlayerMsg(Index, "You won Steel Sword.", WHITE) End If If z < 10 Then Call GiveItem(Index, 54, 10000) Call GlobalMsg(GetPlayerName(Index) & " has won Soltion, congratulations!", YELLOW) End If If z >= 101 Then Call PlayerMsg(Index, "Sorry, you won nothing..", BRIGHTRED) End If Exit Sub Case 4 If CanTake(Index, 32, 1) Then Call TakeItem(Index, 32, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 100) Call PlayerMsg(Index, "You have gained 100 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 5 If CanTake(Index, 33, 1) Then Call TakeItem(Index, 33, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000) Call PlayerMsg(Index, "You have gained 1000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 6 If CanTake(Index, 34, 1) Then Call TakeItem(Index, 34, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 10000) Call PlayerMsg(Index, "You have gained 10000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 7 If CanTake(Index, 35, 1) Then Call TakeItem(Index, 35, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 100000) Call PlayerMsg(Index, "You have gained 100000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 8 If CanTake(Index, 37, 1) Then Call TakeItem(Index, 37, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000000) Call PlayerMsg(Index, "You have gained 1000000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case Else Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub```I changed my main again to see if I could fix it..```'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Module: Main.txt '' Author: Stephan J.R. van Schaik '' Date: August 30th, 2009. '' Version: 1.0.0 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Constants & Globals' Color ConstantsPublic Const BLACK = 0Public Const BLUE = 1Public Const GREEN = 2Public Const CYAN = 3Public Const RED = 4Public Const MAGENTA = 5Public Const BROWN = 6Public Const GREY = 7Public Const DARKGREY = 8Public Const BRIGHTBLUE = 9Public Const BRIGHTGREEN = 10Public Const BRIGHTCYAN = 11Public Const BRIGHTRED = 12Public Const PINK = 13Public Const YELLOW = 14Public Const WHITE = 15' Admin ConstantsPublic Const ADMIN_PLAYER = 0Public Const ADMIN_MONITOR = 1Public Const ADMIN_MAPPER = 2Public Const ADMIN_DEVELOPER = 3Public Const ADMIN_CREATOR = 4Public Const ADMIN_OWNER = 5' Alignment constantsPublic Const LEFT = 0Public Const RIGHT = 1Public Const CENTER = 2' Stat constantsPublic Const STAT_STRENGHT = 0Public Const STAT_DEFENCE = 1Public Const STAT_MAGIC = 2Public Const STAT_SPEED = 3' Key constantsPublic Const KEY_PAGEUP = 1Public Const KEY_PAGEDOWN = 4Public Const KEY_DELETE = 2Public Const KEY_END = 3' Element type constantsPublic Const ELEMENT_PICTURE = 1Public Const ELEMENT_FIELD = 2Public Const ELEMENT_LABEL = 3' Tile type constantsPublic Const TILE_TYPE_WALKABLE = 0Public Const TILE_TYPE_BLOCKED = 1Public Const TILE_TYPE_WARP = 2Public Const TILE_TYPE_ITEM = 3Public Const TILE_TYPE_NPCAVOID = 4Public Const TILE_TYPE_KEY = 5Public Const TILE_TYPE_KEYOPEN = 6Public Const TILE_TYPE_HEAL = 7Public Const TILE_TYPE_KILL = 8Public Const TILE_TYPE_SHOP = 9Public Const TILE_TYPE_CBLOCK = 10Public Const TILE_TYPE_ARENA = 11Public Const TILE_TYPE_SOUND = 12Public Const TILE_TYPE_SPRITE_CHANGE = 13Public Const TILE_TYPE_SIGN = 14Public Const TILE_TYPE_DOOR = 15Public Const TILE_TYPE_NOTICE = 16Public Const TILE_TYPE_CHEST = 17Public Const TILE_TYPE_CLASS_CHANGE = 18Public Const TILE_TYPE_SCRIPTED = 19'Public Const TILE_TYPE_NPC_SPAWN = 20Public Const TILE_TYPE_HOUSE = 21'Public Const TILE_TYPE_CANON = 22Public Const TILE_TYPE_BANK = 23'Public Const TILE_TYPE_SKILL = 24Public Const TILE_TYPE_GUILDBLOCK = 25Public Const TILE_TYPE_HOOKSHOT = 26Public Const TILE_TYPE_WALKTHRU = 27Public Const TILE_TYPE_ROOF = 28Public Const TILE_TYPE_ROOFBLOCK = 29Public Const TILE_TYPE_ONCLICK = 30Public Const TILE_TYPE_LOWER_STAT = 31' MAX constants.Public Const MAX_INVSLOTS = 24' Data.ini (config) settings.Public GameNamePublic WebSitePublic PortPublic HPRegenPublic HPTimerPublic MPRegenPublic MPTimerPublic SPRegenPublic SPTimerPublic NPCRegenPublic ScrollingPublic ScrollXPublic ScrollYPublic ScriptingPublic ScriptErrorsPublic PaperDollPublic SaveTimePublic SpriteSizePublic CustomPublic PKMinLvlPublic LevelPublic EmailPublic VerifyAccPublic ClassesPublic Stat1Public Stat2Public Stat3Public Stat4Public SPAttackPublic SPRunning' Data.ini (max) settings.Public MAX_PLAYERSPublic MAX_ITEMSPublic MAX_NPCSPublic MAX_SHOPSPublic MAX_SPELLSPublic MAX_MAPSPublic MAX_MAP_ITEMSPublic MAX_GUILDSPublic MAX_GUILD_MEMBERSPublic MAX_EMOTICONSPublic MAX_ELEMENTSPublic MAX_LEVELPublic MAX_PARTY_MEMBERSPublic MAX_SCRIPTSPELLSPublic MAX_MAP_XPublic MAX_MAP_YPublic MAX_STAT' MOTDPublic MOTD' Events' Initialisation & Reloading#include #include #include ' Interactivity#include #include #include #include #include #include ' Joining & Leaving#include #include #include ' Death#include #include #include #include #include ' Attacks#include #include #include ' Scripted#include #include #include #include ' Leveling#include #include ' Misc#include #include #include ' Modules#include #include #include #include #include #include ' Functions' General#include #include '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Module: BCInventory.ess '' Author: Stephan J.R. van Schaik ([email protected]) '' Date: September 6th, 2009. '' Version: 1.2.0 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Function GetFreeSlots(Index) GetFreeSlots = GetPlayerInvSlots(Index)End FunctionSub GiveItem(Index, Number, Durability) Call AddPlayerInvItem(Index, Number, Durability)End SubSub GiveCurrency(Index, Number, Amount) Call AddPlayerInvStackableItem(Index, Number, Amount)End SubFunction CanTake(Index, Number, Amount) If CountPlayerInvItem(Index, Number) >= Amount Then CanTake = True Else CanTake = False End IfEnd FunctionSub TakeItem(Index, Number, Amount) Call RemovePlayerInvItem(Index, Number, Amount)End Sub' For testing the script.#include ```The error I'm getting now is TYPE: Expected Statement CODE: Case 2… On the ScriptedItem.. Link to comment Share on other sites More sharing options...
Alatar Posted April 27, 2010 Share Posted April 27, 2010 Change it to this:```'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Module: ScriptedItem.ess '' Author: Stephan J.R. van Schaik '' Date: August 30th, 2009. '' Version: 1.0.0 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: ScriptedItem '' Brief: executes when somebody uses an item. '' Parameters: '' Index: the index of the player. '' Script: the script to execute. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Sub ScriptedItem(Index, Script, Slot) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted item has no apparent use.", WHITE) Exit Sub Case 1 If CanTake(Index, 22, 1) Then Call TakeItem(Index, 22, 1) Call PlayerWarp(Index, 11, 9, 5) Call PlayerMsg(Index, "You have been warped to Rex.", BRIGHTRED) Exit Sub Case 2 'Dim PlayerEXP If CanTake(Index, 23, 1) Then Call TakeItem(Index, 23, 1) Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call PlayerMsg(Index, "You have been gained a level, by drinking the Kuro Potion", YELLOW) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Exit Sub Case 3 If CanTake(Index, 25, 1) Then Call TakeItem(Index, 25, 1) z = Rand(1, 300) If z <= 100 And z >= 50 Then Call GiveItem(Index, 7, 10000) Call PlayerMsg(Index, "You won Basic Sword.", WHITE) End If If z <= 49 And z >= 11 Then Call GiveItem(Index, 15, 10000) Call PlayerMsg(Index, "You won Steel Sword.", WHITE) End If If z < 10 Then Call GiveItem(Index, 54, 10000) Call GlobalMsg(GetPlayerName(Index) & " has won Soltion, congratulations!", YELLOW) End If If z >= 101 Then Call PlayerMsg(Index, "Sorry, you won nothing..", BRIGHTRED) End If Exit Sub Case 4 If CanTake(Index, 32, 1) Then Call TakeItem(Index, 32, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 100) Call PlayerMsg(Index, "You have gained 100 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 5 If CanTake(Index, 33, 1) Then Call TakeItem(Index, 33, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000) Call PlayerMsg(Index, "You have gained 1000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 6 If CanTake(Index, 34, 1) Then Call TakeItem(Index, 34, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 10000) Call PlayerMsg(Index, "You have gained 10000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 7 If CanTake(Index, 35, 1) Then Call TakeItem(Index, 35, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 100000) Call PlayerMsg(Index, "You have gained 100000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 8 If CanTake(Index, 37, 1) Then Call TakeItem(Index, 37, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000000) Call PlayerMsg(Index, "You have gained 1000000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case Else Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub``` Link to comment Share on other sites More sharing options...
viciousdead Posted April 27, 2010 Author Share Posted April 27, 2010 @Alatar:> Change it to this:> ```> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''> ' Module: ScriptedItem.ess '> ' Author: Stephan J.R. van Schaik '> ' Date: August 30th, 2009. '> ' Version: 1.0.0 '> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''> > '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''> ' Function: ScriptedItem '> ' Brief: executes when somebody uses an item. '> ' Parameters: '> ' Index: the index of the player. '> ' Script: the script to execute. '> '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''> Sub ScriptedItem(Index, Script, Slot)> Select Case Script> Case 0> Call PlayerMsg(Index, "This scripted item has no apparent use.", WHITE)> Exit Sub> > Case 1> If CanTake(Index, 22, 1) Then> Call TakeItem(Index, 22, 1)> Call PlayerWarp(Index, 11, 9, 5)> Call PlayerMsg(Index, "You have been warped to Rex.", BRIGHTRED)> Exit Sub> > Case 2> 'Dim PlayerEXP> If CanTake(Index, 23, 1) Then> Call TakeItem(Index, 23, 1)> Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)> Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3)> Call PlayerMsg(Index, "You have been gained a level, by drinking the Kuro Potion", YELLOW)> Call SetPlayerHP(Index, GetPlayerMaxHP(Index))> Call SetPlayerMP(Index, GetPlayerMaxMP(Index))> Call SetPlayerSP(Index, GetPlayerMaxSP(Index))> Call SendPlayerData(Index)> Call SendStats(Index)> Call SendHP(Index)> Call SendMP(Index)> Call SendSP(Index)> Call SendPTS(Index)> Exit Sub> > Case 3> If CanTake(Index, 25, 1) Then> Call TakeItem(Index, 25, 1)> z = Rand(1, 300)> If z <= 100 And z >= 50 Then> Call GiveItem(Index, 7, 10000)> Call PlayerMsg(Index, "You won Basic Sword.", WHITE)> End If> If z <= 49 And z >= 11 Then> Call GiveItem(Index, 15, 10000)> Call PlayerMsg(Index, "You won Steel Sword.", WHITE)> End If> If z < 10 Then> Call GiveItem(Index, 54, 10000)> Call GlobalMsg(GetPlayerName(Index) & " has won Soltion, congratulations!", YELLOW)> End If> If z >= 101 Then> Call PlayerMsg(Index, "Sorry, you won nothing..", BRIGHTRED)> End If> Exit Sub> > Case 4> If CanTake(Index, 32, 1) Then> Call TakeItem(Index, 32, 1)> Call SetPlayerExp(Index, GetPlayerExp(Index) + 100)> Call PlayerMsg(Index, "You have gained 100 experiance.", YELLOW)> If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then> Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)> Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3)> Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp)> Call SetPlayerHP(Index, GetPlayerMaxHP(Index))> Call SetPlayerMP(Index, GetPlayerMaxMP(Index))> Call SetPlayerSP(Index, GetPlayerMaxSP(Index))> Call SendPlayerData(Index)> Call SendStats(Index)> Call SendHP(Index)> Call SendMP(Index)> Call SendSP(Index)> Call SendPTS(Index)> Else> End If> Exit Sub > > Case 5> If CanTake(Index, 33, 1) Then> Call TakeItem(Index, 33, 1)> Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000)> Call PlayerMsg(Index, "You have gained 1000 experiance.", YELLOW)> If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then> Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)> Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3)> Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp)> Call SetPlayerHP(Index, GetPlayerMaxHP(Index))> Call SetPlayerMP(Index, GetPlayerMaxMP(Index))> Call SetPlayerSP(Index, GetPlayerMaxSP(Index))> Call SendPlayerData(Index)> Call SendStats(Index)> Call SendHP(Index)> Call SendMP(Index)> Call SendSP(Index)> Call SendPTS(Index)> Else> End If> Exit Sub > > Case 6> If CanTake(Index, 34, 1) Then> Call TakeItem(Index, 34, 1)> Call SetPlayerExp(Index, GetPlayerExp(Index) + 10000)> Call PlayerMsg(Index, "You have gained 10000 experiance.", YELLOW)> If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then> Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)> Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3)> Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp)> Call SetPlayerHP(Index, GetPlayerMaxHP(Index))> Call SetPlayerMP(Index, GetPlayerMaxMP(Index))> Call SetPlayerSP(Index, GetPlayerMaxSP(Index))> Call SendPlayerData(Index)> Call SendStats(Index)> Call SendHP(Index)> Call SendMP(Index)> Call SendSP(Index)> Call SendPTS(Index)> Else> End If> Exit Sub > > Case 7> If CanTake(Index, 35, 1) Then> Call TakeItem(Index, 35, 1)> Call SetPlayerExp(Index, GetPlayerExp(Index) + 100000)> Call PlayerMsg(Index, "You have gained 100000 experiance.", YELLOW)> If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then> Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)> Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3)> Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp)> Call SetPlayerHP(Index, GetPlayerMaxHP(Index))> Call SetPlayerMP(Index, GetPlayerMaxMP(Index))> Call SetPlayerSP(Index, GetPlayerMaxSP(Index))> Call SendPlayerData(Index)> Call SendStats(Index)> Call SendHP(Index)> Call SendMP(Index)> Call SendSP(Index)> Call SendPTS(Index)> Else> End If> Exit Sub > > Case 8> If CanTake(Index, 37, 1) Then> Call TakeItem(Index, 37, 1)> Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000000)> Call PlayerMsg(Index, "You have gained 1000000 experiance.", YELLOW)> If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then> Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1)> Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3)> Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp)> Call SetPlayerHP(Index, GetPlayerMaxHP(Index))> Call SetPlayerMP(Index, GetPlayerMaxMP(Index))> Call SetPlayerSP(Index, GetPlayerMaxSP(Index))> Call SendPlayerData(Index)> Call SendStats(Index)> Call SendHP(Index)> Call SendMP(Index)> Call SendSP(Index)> Call SendPTS(Index)> Else> End If> 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> ```Ugh, got the same error.. :icon_crap: Link to comment Share on other sites More sharing options...
Alatar Posted April 27, 2010 Share Posted April 27, 2010 Hmm, weird. I think that it could be the Case Else, that you have in another line the "problem.", WHITE)", just put it all in one line.Like:```Case Else Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub``` Link to comment Share on other sites More sharing options...
viciousdead Posted April 27, 2010 Author Share Posted April 27, 2010 ```'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Module: ScriptedItem.ess '' Author: Stephan J.R. van Schaik '' Date: August 30th, 2009. '' Version: 1.0.0 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: ScriptedItem '' Brief: executes when somebody uses an item. '' Parameters: '' Index: the index of the player. '' Script: the script to execute. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Sub ScriptedItem(Index, Script, Slot) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted item has no apparent use.", WHITE) Exit Sub Case 1 If CanTake(Index, 22, 1) Then Call TakeItem(Index, 22, 1) Call PlayerWarp(Index, 11, 9, 5) Call PlayerMsg(Index, "You have been warped to Rex.", BRIGHTRED) Exit Sub Case 2 'Dim PlayerEXP If CanTake(Index, 23, 1) Then Call TakeItem(Index, 23, 1) Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call PlayerMsg(Index, "You have been gained a level, by drinking the Kuro Potion", YELLOW) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Exit Sub Case 3 If CanTake(Index, 25, 1) Then Call TakeItem(Index, 25, 1) z = Rand(1, 300) If z <= 100 And z >= 50 Then Call GiveItem(Index, 7, 10000) Call PlayerMsg(Index, "You won Basic Sword.", WHITE) End If If z <= 49 And z >= 11 Then Call GiveItem(Index, 15, 10000) Call PlayerMsg(Index, "You won Steel Sword.", WHITE) End If If z < 10 Then Call GiveItem(Index, 54, 10000) Call GlobalMsg(GetPlayerName(Index) & " has won Soltion, congratulations!", YELLOW) End If If z >= 101 Then Call PlayerMsg(Index, "Sorry, you won nothing..", BRIGHTRED) End If Exit Sub Case 4 If CanTake(Index, 32, 1) Then Call TakeItem(Index, 32, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 100) Call PlayerMsg(Index, "You have gained 100 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 5 If CanTake(Index, 33, 1) Then Call TakeItem(Index, 33, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000) Call PlayerMsg(Index, "You have gained 1000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 6 If CanTake(Index, 34, 1) Then Call TakeItem(Index, 34, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 10000) Call PlayerMsg(Index, "You have gained 10000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 7 If CanTake(Index, 35, 1) Then Call TakeItem(Index, 35, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 100000) Call PlayerMsg(Index, "You have gained 100000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit Sub Case 8 If CanTake(Index, 37, 1) Then Call TakeItem(Index, 37, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000000) Call PlayerMsg(Index, "You have gained 1000000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) Else End If Exit SubCase Else Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub```Still not working.. :lipsrsealed:Same error as before, this started happening when I changed god's inventory script.. Link to comment Share on other sites More sharing options...
Alatar Posted April 27, 2010 Share Posted April 27, 2010 Weird, it's still showing in Case 2? Link to comment Share on other sites More sharing options...
viciousdead Posted April 27, 2010 Author Share Posted April 27, 2010 @Alatar:> Weird, it's still showing in Case 2?I've tryed to remove Case 2 then it moves on to Case 3… Link to comment Share on other sites More sharing options...
xelander Posted April 27, 2010 Share Posted April 27, 2010 How about taking the original and stay with that? >_> Link to comment Share on other sites More sharing options...
balliztik1 Posted April 27, 2010 Share Posted April 27, 2010 Ehh, you have unended if-statements in all of those cases. It has nothing to do with Godlord's scripts. The "expected statement" error you were getting was from the lack of a closing "if" in case 1, and should you have fixed it, there were also errors in all the cases afterward, too. Here's a fix with all ifs added.```'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Module: ScriptedItem.ess '' Author: Stephan J.R. van Schaik '' Date: August 30th, 2009. '' Version: 1.0.0 '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Function: ScriptedItem '' Brief: executes when somebody uses an item. '' Parameters: '' Index: the index of the player. '' Script: the script to execute. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Sub ScriptedItem(Index, Script, Slot) Select Case Script Case 0 Call PlayerMsg(Index, "This scripted item has no apparent use.", WHITE) Exit Sub Case 1 If CanTake(Index, 22, 1) Then Call TakeItem(Index, 22, 1) Call PlayerWarp(Index, 11, 9, 5) Call PlayerMsg(Index, "You have been warped to Rex.", BRIGHTRED) End If Exit Sub Case 2 'Dim PlayerEXP If CanTake(Index, 23, 1) Then Call TakeItem(Index, 23, 1) Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call PlayerMsg(Index, "You have been gained a level, by drinking the Kuro Potion", YELLOW) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) End If Exit Sub Case 3 If CanTake(Index, 25, 1) Then Call TakeItem(Index, 25, 1) z = Rand(1, 300) If z <= 100 And z >= 50 Then Call GiveItem(Index, 7, 10000) Call PlayerMsg(Index, "You won Basic Sword.", WHITE) End If If z <= 49 And z >= 11 Then Call GiveItem(Index, 15, 10000) Call PlayerMsg(Index, "You won Steel Sword.", WHITE) End If If z < 10 Then Call GiveItem(Index, 54, 10000) Call GlobalMsg(GetPlayerName(Index) & " has won Soltion, congratulations!", YELLOW) End If If z >= 101 Then Call PlayerMsg(Index, "Sorry, you won nothing..", BRIGHTRED) End If End If Exit Sub Case 4 If CanTake(Index, 32, 1) Then Call TakeItem(Index, 32, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 100) Call PlayerMsg(Index, "You have gained 100 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) End If End If Exit Sub Case 5 If CanTake(Index, 33, 1) Then Call TakeItem(Index, 33, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000) Call PlayerMsg(Index, "You have gained 1000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) End If End If Exit Sub Case 6 If CanTake(Index, 34, 1) Then Call TakeItem(Index, 34, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 10000) Call PlayerMsg(Index, "You have gained 10000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) End If End If Exit Sub Case 7 If CanTake(Index, 35, 1) Then Call TakeItem(Index, 35, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 100000) Call PlayerMsg(Index, "You have gained 100000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) End If End If Exit Sub Case 8 If CanTake(Index, 37, 1) Then Call TakeItem(Index, 37, 1) Call SetPlayerExp(Index, GetPlayerExp(Index) + 1000000) Call PlayerMsg(Index, "You have gained 1000000 experiance.", YELLOW) If GetPlayerExp(Index) = GetPlayerNextLevel(Index) Then Call SetPlayerLevel(Index, GetPlayerLevel(Index) + 1) Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 3) Call SetPlayerExp(Index, GetPlayerExp(Index) - PlayerExp) Call SetPlayerHP(Index, GetPlayerMaxHP(Index)) Call SetPlayerMP(Index, GetPlayerMaxMP(Index)) Call SetPlayerSP(Index, GetPlayerMaxSP(Index)) Call SendPlayerData(Index) Call SendStats(Index) Call SendHP(Index) Call SendMP(Index) Call SendSP(Index) Call SendPTS(Index) End If End If Exit SubCase Else Call PlayerMsg(Index, "No item script found. Please contact an admin to solve this problem.", WHITE) Exit Sub End SelectEnd Sub```For future reference, tab your code properly. This would've been a simple visual recognition to solve the problem with clean code standards. Trust me, it's worth the extra time. 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