kris_hole Posted August 27, 2009 Share Posted August 27, 2009 wait so what error is it now? Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 27, 2009 Author Share Posted August 27, 2009 ``` Case "/summonpet" DIM playerx DIM playery DIM playermap DIM npconmap1 DIM npconmap DIM playertarget DIM playermp DIM petnumber DIM petsnumber1 DIM petsnumber DIM petdef DIM petstr DIM petmaxhp DIM pethp DIM petmapnumber playerx = GetPlayerX(index) playery = GetPlayerY(index) playermap = GetPlayerMap(index) npconmap1 = Int(GetMapNpcNumber(GetPlayerMap(index), index)) + 1 npconmap = GetMapNpcNumber(GetPlayerMap(index), index) playertarget = GetPlayerTargetNpc(index) playermp = Int(GetPlayerMP(index) - 20) petnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber") petsnumber1 = Int(GetVar("Data.ini", "PETS", "petsnumber")) + 1 petsnumber = GetVar("Data.ini", "PETS", "petsnumber") petdef = GetNpcDefense(petnumber) petstr = GetNpcStrength(petnumber) petmaxhp = GetNpcMaxHP(index) pethp = GetNpcHP(petnumber) petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber") If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 0 Then If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated")) = 0 Then Call PutVar(GetPlayerName(index) & ".ini", "PET", "petnumber", "petsnumber1") Call PutVar("Data.ini", "PETS", "petsnumbers", "petsnumber1") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", "40") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", "35") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", "10") Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", "npconmap+1") Call SetPlayerMP(index, playermp) Call PlayerMsg(index, "You summoned your pet", GREEN) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1") End If ElseIf Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 1 Then If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated")) = 0 Then Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1") Call PlayerMsg(index, "You summoned your pet", GREEN) Call SetPlayerMP(index, playermp) End If End IfExit Sub```seems like it doesnt work… ( or i'm just stupid again... <.< )the error i get is still:line 92and this.... string: "" error.... Link to comment Share on other sites More sharing options...
kris_hole Posted August 27, 2009 Share Posted August 27, 2009 which lines line 92… cba to count XD Link to comment Share on other sites More sharing options...
Godlord Posted August 27, 2009 Share Posted August 27, 2009 If you post the full Sub Commands using [code[b]=vb][/co[b]de] I can easily find the error.Regards, Godlord. Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 27, 2009 Author Share Posted August 27, 2009 ```' 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 = Global Admin Message", WHITE) Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE) Call PlayerMsg(Index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", 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 Case "/summonpet" DIM playerx DIM playery DIM playermap DIM npconmap1 DIM npconmap DIM playertarget DIM playermp DIM petnumber DIM petsnumber1 DIM petsnumber DIM petdef DIM petstr DIM petmaxhp DIM pethp DIM petmapnumber playerx = GetPlayerX(index) playery = GetPlayerY(index) playermap = GetPlayerMap(index) npconmap1 = Int(GetMapNpcNumber(GetPlayerMap(index), index)) + 1 npconmap = GetMapNpcNumber(GetPlayerMap(index), index) playertarget = GetPlayerTargetNpc(index) playermp = Int(GetPlayerMP(index) - 20) petnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber") petsnumber1 = Int(GetVar("Data.ini", "PETS", "petsnumber")) + 1 petsnumber = GetVar("Data.ini", "PETS", "petsnumber") petdef = GetNpcDefense(petnumber) petstr = GetNpcStrength(petnumber) petmaxhp = GetNpcMaxHP(index) pethp = GetNpcHP(petnumber) petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber") If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 0 Then If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated")) = 0 Then Call PutVar(GetPlayerName(index) & ".ini", "PET", "petnumber", "petsnumber1") Call PutVar("Data.ini", "PETS", "petsnumbers", "petsnumber1") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", "40") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", "35") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", "10") Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", "npconmap+1") Call SetPlayerMP(index, playermp) Call PlayerMsg(index, "You summoned your pet", GREEN) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1") End If ElseIf Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 1 Then If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated")) = 0 Then Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1") Call PlayerMsg(index, "You summoned your pet", GREEN) Call SetPlayerMP(index, playermp) End If End IfExit Sub End Select Call PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)End Sub``` Link to comment Share on other sites More sharing options...
Godlord Posted August 27, 2009 Share Posted August 27, 2009 ```petsnumber1 = Int(GetVar("Data.ini", "PETS", "petsnumber")) + 1```It tries to convert a pure string to an integer.```petnumber = GetVar(GetPlayerName(Index) & ".ini", "PET", "petnumber")```Forgot the Int().```petsnumber = GetVar("Data.ini", "PETS", "petsnumber")```Forgot the Int().```playermp = GetPlayerMP(Index) - 20```No need for Int() here.Regards, Godlord. Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 27, 2009 Author Share Posted August 27, 2009 > It tries to convert a pure string to an integer.could i put str + 1 or something like that? how to fix that problem? Link to comment Share on other sites More sharing options...
kris_hole Posted August 27, 2009 Share Posted August 27, 2009 what program is that ye are all using :P? Link to comment Share on other sites More sharing options...
Godlord Posted August 27, 2009 Share Posted August 27, 2009 @Sealbreaker:> could i put str + 1 or something like that? how to fix that problem?```Call PutVar("Data.ini", "PETS", "petsnumbers", "petsnumber1")```Should be:```Call PutVar("Data.ini", "PETS", "petsnumbers", CStr(petsnumber1))```And I wonder why you even have petsnumber1, so it should actually be:```Call PutVar("Data.ini", "PETS", "petsnumbers", CStr(petsnumber + 1))```@[THE-KRIS:> link=topic=50955.msg532759#msg532759 date=1251385961]> what program is that ye are all using :P?Program? :huh:Regards, Godlord. Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 27, 2009 Author Share Posted August 27, 2009 hm.. stil error…``` Case "/summonpet" DIM playerx DIM playery DIM playermap DIM npconmap1 DIM npconmap DIM playertarget DIM playermp DIM petnumber DIM petsnumber1 DIM petsnumber DIM petdef DIM petstr DIM petmaxhp DIM pethp DIM petmapnumber playerx = GetPlayerX(index) playery = GetPlayerY(index) playermap = GetPlayerMap(index) npconmap1 = Int(GetMapNpcNumber(GetPlayerMap(index), index)) + 1 npconmap = GetMapNpcNumber(GetPlayerMap(index), index) playertarget = GetPlayerTargetNpc(index) playermp = GetPlayerMP(index) - 20 petnumber = Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber")) petsnumber1 = Int(GetVar("Data.ini", "PETS", "petsnumber")) + 1 petsnumber = Int(GetVar("Data.ini", "PETS", "petsnumber")) petdef = GetNpcDefense(petnumber) petstr = GetNpcStrength(petnumber) petmaxhp = GetNpcMaxHP(index) pethp = GetNpcHP(petnumber) petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber") If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 0 Then If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated")) = 0 Then Call PutVar(GetPlayerName(index) & ".ini", "PET", "petnumber", CStr(petsnumber1)) Call PutVar("Data.ini", "PETS", "petsnumbers", CStr(petsnumber1)) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", "40") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", "35") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", "10") Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", "npconmap+1") Call SetPlayerMP(index, playermp) Call PlayerMsg(index, "You summoned your pet", GREEN) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1") End If ElseIf Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 1 Then If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated")) = 0 Then Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, petnumber) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1") Call PlayerMsg(index, "You summoned your pet", GREEN) Call SetPlayerMP(index, playermp) End If End IfExit Sub``` Link to comment Share on other sites More sharing options...
Godlord Posted August 27, 2009 Share Posted August 27, 2009 You still miss a lot of proper typecasting and some things are done in a very wrong way. To be honest, debugging this is a pain in the ass :rolleyes:.Regards, Godlord. Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 27, 2009 Author Share Posted August 27, 2009 i know… ^-^but the learning process is good xDDD ( really =P )anyways... you dont have to debug it.. ^-^i already learned about CStr, Int, End If ( just forgot it. xD ) and more....already cool ^-^and even if i cant script a pet-script ( since i'm not really good at scripting...but trying my best to learn ) its good to know, why it doesnt work and stuff....so...thank you anyways =) :icon_alabanza: Link to comment Share on other sites More sharing options...
kris_hole Posted August 27, 2009 Share Posted August 27, 2009 the, script editor thingy? Link to comment Share on other sites More sharing options...
Godlord Posted August 27, 2009 Share Posted August 27, 2009 ```playerx = GetPlayerX(index)playery = GetPlayerY(index)playermap = GetPlayerMap(index)```Waste.```npconmap1 = Int(GetMapNpcNumber(GetPlayerMap(index), index)) + 1```Same story as above.```npconmap = GetMapNpcNumber(GetPlayerMap(index), index)```The parameters are the Map and the NPC Index not the Map and the Player Index. So the second parameter should be a number between 1 and MAX_NPCS.```playertarget = GetPlayerTargetNpc(index)```Needs to check if there is a target selected and it's kind of a waste.```' Try testing if the target is a player.If GetPlayerTarget(Index) > 0 Then ' Player selected as target. Exit SubEnd If' Try testing if the target is a NPC.If GetPlayerTargetNpc(Index) > 0 Then ' NPC selected as target. Exit SubEnd If' No target.``````playermp = GetPlayerMP(index) - 20```Pretty much a waste.```petnumber = Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petnumber"))```Fine, except it could better use:```"Accounts\" & GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini"```instead.```petsnumber1 = Int(GetVar("Data.ini", "PETS", "petsnumber")) + 1```Waste.```petsnumber = Int(GetVar("Data.ini", "PETS", "petsnumber"))```Not sure for what this is, actually.```petdef = GetNpcDefense(petnumber)petstr = GetNpcStrength(petnumber)petmaxhp = GetNpcMaxHP(index)pethp = GetNpcHP(petnumber)```Waste and I have really no idea what the index is doing at GetNpcMaxHP.```petmapnumber = GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber")```No typecasting, should be typecasted to Int.Use this information already and if you do well your first section might actually become very small but very useful. Oh and perhaps use tabbing.@[THE-KRIS:> link=topic=50955.msg532771#msg532771 date=1251387313]> the, script editor thingy?What are you talking about?Regards, Godlord. Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 27, 2009 Author Share Posted August 27, 2009 i thinkk he means:```hello```=P Link to comment Share on other sites More sharing options...
Godlord Posted August 27, 2009 Share Posted August 27, 2009 @Sealbreaker:> i thinkk he means:> > ```> hello> ```> =PI explained how to use that already and he could just quote it anyway. I requested that to be added so my code gets syntax-highlighted and line counted without having to abuse [col[b]or] and waste my time.Regards, Godlord. Link to comment Share on other sites More sharing options...
kris_hole Posted August 27, 2009 Share Posted August 27, 2009 whats the ducking script editing program your using? is it like notepad++ or eclipse script editor a new version i dont know of, what what? Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 27, 2009 Author Share Posted August 27, 2009 > petsnumber1 = Int(GetVar("Data.ini", "PETS", "petsnumber")) + 1> > Waste.> > petsnumber = Int(GetVar("Data.ini", "PETS", "petsnumber"))> > Not sure for what this is, actually.petsnumber and petsnumber1 are for getting the petsnumber, that is saved in data.ini or make petsnumber+1…. petsnumber is for giving the player a petnumber, that noone else has... like you get npc 200 if you are the first and as the 2nd you would get 201... =P in data.ini petsnumber is = 200... so i can make up to 199 npc's that are for quests ect.. and the rest is for pets... =P but then i realised, that just making 1 npc a pet ( or for other forms.... more ) and saving the stats of the npc's into the playername.ini.... so it can just set the pet's str, def and hp just by reading the var that is in playername.ini... the petstr and stuff are getting setted at using the pet the first time ( if getvar(blablablabala: activatedbefore, 0) then...) =PEDIT: i made it to this: ( still not working...giving me a string: "" error at line 86)``` Case "/summonpet" DIM playerx DIM playery DIM playermap DIM npconmap1 DIM npconmap DIM playermp DIM petdef DIM petstr DIM petmapnumber playerx = GetPlayerX(index) playery = GetPlayerY(index) playermap = GetPlayerMap(index) npconmap1 = Int(GetMapNpcNumber(GetPlayerMap(index), index)) + 1 npconmap = GetMapNpcNumber(GetPlayerMap(index), index) playermp = GetPlayerMP(index) - 20 petdef = GetNpcDefense(petnumber) petstr = GetNpcStrength(petnumber) petmapnumber = Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber")) If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 0 Then If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated")) = 0 Then Call PutVar(GetPlayerName(index) & ".ini", "PET", "petdef", "40") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petstr", "35") Call PutVar(GetPlayerName(index) & ".ini", "PET", "petexp", "10") Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, 200) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petmapnumber", "npconmap+1") Call SetPlayerMP(index, playermp) Call PlayerMsg(index, "You summoned your pet", GREEN) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1") End If ElseIf Int(GetVar(GetPlayerName(index) & ".ini", "PET", "activatedbefore")) = 1 Then If Int(GetVar(GetPlayerName(index) & ".ini", "PET", "petactivated")) = 0 Then Call ScriptSpawnNpc(npconmap1, playermap, playerx, playery, 200) Call PutVar(GetPlayerName(index) & ".ini", "PET", "petactivated", "1") Call PlayerMsg(index, "You summoned your pet", GREEN) Call SetPlayerMP(index, playermp) End If End IfExit Sub``` Link to comment Share on other sites More sharing options...
Godlord Posted August 27, 2009 Share Posted August 27, 2009 ``` Case "/summonpet" If GetVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "activated")) = vbNullString Then Call PutVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "STR", "40") Call PutVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "DEF", "35") Call PutVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "XP", "10") Call PutVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "petmapnumber", CStr(npconmap + 1)) Call PutVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "activated", "0") End If If GetVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "activated")) <> "1" Then Call PlayerMsg(Index, "You already have a pet summoned.", BRIGHTRED) Exit Sub End If If GetPlayerMP(Index) < 20 Then Call PlayerMsg(Index, "You don't have enough mana to summon a pet.", BRIGHTRED) Exit Sub End If Call PutVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "npcnum", "0") For NpcNum = 1 To 15 If GetMapNpcNumber(GetPlayerMap(Index), NpcNum) = 0 Then Call PutVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "npcnum", CStr(NpcNum)) Exit For End If Next If GetVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "npcnum") = "0" Then Call PlayerMsg(Index, "You can't summon the pet. The max. NPC limit for this map has been reached.", BRIGHTRED) Exit Sub End If Call SetPlayerMP(Index, GetPlayerMP(Index) - 20) Call ScriptSpawnNpc(Int(GetVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "npcnum")), GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index), 200) Call PlayerMsg(index, "You summoned your pet", GREEN) Call PutVar("Accounts\" & "GetPlayerLogin(Index) & "\Char" & GetPlayerCharNum(Index) & ".ini", "PET", "activated", "1") Exit Sub```I'm leaving this here.Regards, Godlord. Link to comment Share on other sites More sharing options...
Sealbreaker Posted August 28, 2009 Author Share Posted August 28, 2009 thank you… =)i'm goin to read every sc tutorial and learn... maybe i'll finish this....laaaater ^-^i already said thx.. but..... THX ! ;) :icon_alabanza: 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