VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 Hello Eclipse!I'm having trouble with this script:```Sub SetPlayer1stJob(index , profession)Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "Jobs" , "FirstJob" , ""& profession)Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level" , "0")Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , "0")Call PlayerMsg(index , "You now can do " & profession & " ! " ,12)End Sub```It should put what there is write here : Call SetPlayer1stJob(index , **profession** ) in a ini file , but it put "" … Could someone help me? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 28, 2009 Share Posted July 28, 2009 Are you putting what you want in the call, in quotes?e.g. Call SetPlayer1stJob(Index, "Archer") Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 no i'll try this , thanks Admiral!EDIT: the first sub worked but now this one is not working:```Sub JobMode1(index , job , mode)Dim needtoolDim giveDim givevalueDim giveexpDim needtoupDim lvlDim expDim skillactionDim succedDim chanceDim rndDim succedmsgsuccedmsg = GetVar("Skills\" & job & ".ini" , ""& mode , "SuccedMsg")chance = GetVar("Skills\" & job & ".ini" , ""& mode , "Chance")skillaction = GetVar("Skills\" & job & ".ini" , "Info" , "SkillAction")succed = GetVar("Skills\" & job & ".ini" , "Info" , "Succed")lvl = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level")needtoup = GetVar("jobexp.ini" , "Exp" , ""& lvl)exp = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp")needtool = GetVar("Skills\" & job & ".ini" , ""& mode , "NeedTool")give = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveNum")givevalue = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveValue")giveexp = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveExp")If GetPlayer1stJob(index) = Int(job) Then If GetPlayerInvItemNum(index , GetPlayerWeaponSlot(index)) = needtool Thenrnd = Rand(Chance , 1)Select Case rndCase 1Call BattleMsg(index , " & succedmsg & " , GREEN , 1 ) Call Give_Currency(index , ""& give , ""& givevalue ) If exp = "" ThenCall PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& giveexp)Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 )Elseexp = Int(exp) + giveexpCall PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& exp)Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 ) If Int(exp) >= Int(needtoup) ThenCall PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level" , Int(lvl) + 1) Call BattleMsg(index , "You are in level " & lvl & " in " & job & " ! " , 2 , 1 ) End If End IfCase Else'nothing lolEnd Select Else Call BattleMsg(index , "You need te right tool to " & skillaction & " here , please search/buy it!" , 12 , 0) End IfElseCall BattleMsg(index , "You need to do " & job & " to " & skillaction & " here ! " , 12 ,1 )End IfEnd Sub```Whats wrong? Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 28, 2009 Share Posted July 28, 2009 Whenever you get a value from an INI that needs to be a number, GetVar will still return a string; which means if you want to use it with anything number-related, you'll have to Int() it.e.g.giveexp = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveExp")Would be:giveexp = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "GiveExp")) Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 Great but now the error is Type mismatch "string" on line 19gere is the sub```Sub JobMode1(index , job , mode)Dim needtoolDim giveDim givevalueDim giveexpDim needtoupDim lvlDim expDim skillactionDim succedDim chanceDim rndDim succedmsgsuccedmsg = GetVar("Skills\" & job & ".ini" , ""& mode , "SuccedMsg")chance = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "Chance"))skillaction = GetVar("Skills\" & job & ".ini" , "Info" , "SkillAction")succed = GetVar("Skills\" & job & ".ini" , "Info" , "Succed")lvl = Int(GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level"))needtoup = Int(GetVar("jobexp.ini" , "Exp" , ""& lvl))exp = Int(GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp"))needtool = Int( GetVar("Skills\" & job & ".ini" , ""& mode , "NeedTool"))give = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "GiveNum"))givevalue = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "GiveValue"))giveexp = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "GiveExp"))If GetPlayer1stJob(index) = Int(job) Then If GetPlayerInvItemNum(index , GetPlayerWeaponSlot(index)) = needtool Thenrnd = Rand(Chance , 1)Select Case rndCase 1Call BattleMsg(index , " & succedmsg & " , GREEN , 1 ) Call Give_Currency(index , ""& give , ""& givevalue ) If exp = "" ThenCall PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& giveexp)Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 )Elseexp = Int(exp) + giveexpCall PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& exp)Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 ) If Int(exp) >= Int(needtoup) ThenCall PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level" , Int(lvl) + 1) Call BattleMsg(index , "You are in level " & lvl & " in " & job & " ! " , 2 , 1 ) End If End IfCase Else'nothing lolEnd Select Else Call BattleMsg(index , "You need te right tool to " & skillaction & " here , please search/buy it!" , 12 , 0) End IfElseCall BattleMsg(index , "You need to do " & job & " to " & skillaction & " here ! " , 12 ,1 )End IfEnd Sub```+X Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 28, 2009 Share Posted July 28, 2009 Try changing:lvl = Int(GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level"))tolvl = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level")Just that one, don't un-int the others. Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 sorry same error =( Link to comment Share on other sites More sharing options...
Admiral Refuge Posted July 28, 2009 Share Posted July 28, 2009 Okay, time to debug.Replace the sub with this, run it, and let me know if the Call PlayerMsg gets to 2 or 3 in your chatbox:```Sub JobMode1(index , job , mode)Dim needtoolDim giveDim givevalueDim giveexpDim needtoupDim lvlDim expDim skillactionDim succedDim chanceDim rndDim succedmsg Call PlayerMsg(Index, "1", WHITE)succedmsg = GetVar("Skills\" & job & ".ini" , ""& mode , "SuccedMsg")chance = GetVar("Skills\" & job & ".ini" , ""& mode , "Chance")skillaction = GetVar("Skills\" & job & ".ini" , "Info" , "SkillAction")succed = GetVar("Skills\" & job & ".ini" , "Info" , "Succed")lvl = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level")needtoup = GetVar("jobexp.ini" , "Exp" , ""& lvl)exp = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp")needtool = GetVar("Skills\" & job & ".ini" , ""& mode , "NeedTool")give = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveNum")givevalue = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveValue")giveexp = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveExp") Call PlayerMsg(Index, "2", WHITE)If GetPlayer1stJob(index) = Int(job) ThenCall PlayerMsg(Index, "2", WHITE) If GetPlayerInvItemNum(index , GetPlayerWeaponSlot(index)) = Int(needtool) Then rnd = Rand(Chance , 1) Select Case rnd Case 1 Call BattleMsg(index , " & succedmsg & " , GREEN , 1 ) Call Give_Currency(index , ""& give , ""& givevalue ) If exp = "" Then Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& giveexp) Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 ) Else exp = Int(exp) + giveexp Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& exp) Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 ) If Int(exp) >= Int(needtoup) Then Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level" , Int(lvl) + 1) Call BattleMsg(index , "You are in level " & lvl & " in " & job & " ! " , 2 , 1 ) End If End If End Select Else Call BattleMsg(index , "You need te right tool to " & skillaction & " here , please search/buy it!" , 12 , 0) End IfElseCall PlayerMsg(Index, "3", WHITE) Call BattleMsg(index , "You need to do " & job & " to " & skillaction & " here ! " , 12 ,1 )End IfEnd Sub```EDIT: Wait, we have Emblem and Bobosk looking at this topic; let's see if one of them reply. Link to comment Share on other sites More sharing options...
emblem Posted July 28, 2009 Share Posted July 28, 2009 @Admiral:> EDIT: Wait, we have Emblem and Bobosk looking at this topic; let's see if one of them reply.Nope, nothing.Can't see anything wrong unless I were to run the script myself. Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 great technique…I recieved 1 and 2 , there a error in Int(job)PS: you putted two "2" i changed the last to 3 Link to comment Share on other sites More sharing options...
emblem Posted July 28, 2009 Share Posted July 28, 2009 What exactly is the value of "Job".Because if it's a string, you can't Int() it.(A string being anything that's not a number xD)**Edit:**Try this: (Trim just removes spaces from the start/end of a string)```If GetPlayer1stJob(index) = Trim(Job) Then``` Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 Yeah , i'll try that thanks!EDIT: Made some fix but now the error is Subscript out of range line 29```Sub JobMode1(index , job , mode)Dim needtoolDim giveDim givevalueDim giveexpDim needtoupDim lvlDim expDim skillactionDim succedDim chanceDim randDim succedmsg Call PlayerMsg(Index, "1", WHITE)succedmsg = GetVar("Skills\" & job & ".ini" , ""& mode , "SuccedMsg")chance = GetVar("Skills\" & job & ".ini" , ""& mode , "Chance")skillaction = GetVar("Skills\" & job & ".ini" , "Info" , "SkillAction")succed = GetVar("Skills\" & job & ".ini" , "Info" , "Succed")lvl = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level")needtoup = GetVar("jobexp.ini" , "Exp" , ""& lvl)exp = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp")needtool = GetVar("Skills\" & job & ".ini" , ""& mode , "NeedTool")give = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveNum")givevalue = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveValue")giveexp = GetVar("Skills\" & job & ".ini" , ""& mode , "GiveExp") Call PlayerMsg(Index, "2", WHITE)If GetPlayer1stJob(index) = Trim(job) ThenCall PlayerMsg(Index, "3", WHITE) If GetPlayerInvItemNum(index , GetPlayerWeaponSlot(index)) = needtool Then rand = Rand(Chance , 1) Select Case rand Case 1 Call BattleMsg(index , " & succedmsg & " , GREEN , 1 ) Call Give_Currency(index , ""& give , ""& givevalue ) If exp = "" Then Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& giveexp) Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 ) Else exp = exp + giveexp Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& exp) Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 ) If exp >= needtoup Then Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level" , Int(lvl) + 1) Call BattleMsg(index , "You are in level " & lvl & " in " & job & " ! " , 2 , 1 ) End If End If End Select Else Call BattleMsg(index , "You need te right tool to " & skillaction & " here , please search/buy it!" , 12 , 0) End IfElseCall PlayerMsg(Index, "4", WHITE) Call BattleMsg(index , "You need to do " & job & " to " & skillaction & " here ! " , 12 ,1 )End IfEnd Sub``` Link to comment Share on other sites More sharing options...
emblem Posted July 28, 2009 Share Posted July 28, 2009 Do you have a weapon equipped while testing this script? Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 yeahEDIT: current sub```Sub JobMode1(index , job , mode)Dim needtoolDim giveDim givevalueDim giveexpDim needtoupDim lvlDim expDim skillactionDim succedDim chanceDim randDim succedmsg Call PlayerMsg(Index, "1", WHITE)succedmsg = GetVar("Skills\" & job & ".ini" , ""& mode , "SuccedMsg")chance = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "Chance"))skillaction = GetVar("Skills\" & job & ".ini" , "Info" , "SkillAction")succed = GetVar("Skills\" & job & ".ini" , "Info" , "Succed")lvl = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level")needtoup = Int(GetVar("jobexp.ini" , "Exp" , ""& lvl))exp = GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp")needtool = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "NeedTool"))give = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "GiveNum"))givevalue = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "GiveValue"))giveexp = Int(GetVar("Skills\" & job & ".ini" , ""& mode , "GiveExp")) Call PlayerMsg(Index, "2", WHITE)If GetPlayer1stJob(index) = job ThenCall PlayerMsg(Index, "3", WHITE) If GetPlayerInvItemNum(index , GetPlayerWeaponSlot(index)) = needtool Then rand = Rand(Chance , 1) Select Case rand Case 1 Call BattleMsg(index , " & succedmsg & " , GREEN , 1 ) Call Give_Currency(index , ""& give , ""& givevalue ) If exp = "" Then Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& giveexp) Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 ) Else exp = exp + giveexp Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Exp" , ""& exp) Call BattleMsg(index , "You gained " & giveexp & " in " & job & " ! " , 2 , 1 ) If exp >= needtoup Then Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "FirstJob" , "Level" , Int(lvl) + 1) Call BattleMsg(index , "You are in level " & lvl & " in " & job & " ! " , 2 , 1 ) End If End If End Select Else Call BattleMsg(index , "You need te right tool to " & skillaction & " here , please search/buy it!" , 12 , 0) End IfElseCall PlayerMsg(Index, "4", WHITE) Call BattleMsg(index , "You need to do " & job & " to " & skillaction & " here ! " , 12 ,1 )End IfEnd Sub```Current error type mysmatch line 20 Link to comment Share on other sites More sharing options...
emblem Posted July 28, 2009 Share Posted July 28, 2009 Try changing the this:```rand = Rand(Chance , 1)```to this:```rand = Rand(1, Chance)```And this```Call BattleMsg(index , " & succedmsg & " , GREEN , 1 )```to this:```Call BattleMsg(index , succedmsg , GREEN , 1 )```and this:```Call Give_Currency(index , ""& give , ""& givevalue )```to this:```Call Give_Currency(index , int(give) , int(givevalue))``` Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 same error =( Link to comment Share on other sites More sharing options...
emblem Posted July 28, 2009 Share Posted July 28, 2009 I'm not even sure what line 20 is, because the line numbering is odd :/ Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 28, 2009 Author Share Posted July 28, 2009 yeah , the error could be more specific =( Link to comment Share on other sites More sharing options...
emblem Posted July 28, 2009 Share Posted July 28, 2009 Type mismatch means that somewhere your using a string where there's suppose to be a number, or vice versa :/ Link to comment Share on other sites More sharing options...
Bobosk Posted July 28, 2009 Share Posted July 28, 2009 ```needtoup = Int(GetVar("jobexp.ini" , "Exp" , ""& lvl))```that's your current line 20… >.> Link to comment Share on other sites More sharing options...
VitinhooxD Posted July 30, 2009 Author Share Posted July 30, 2009 ok i 'll try un-int this line , thanks Bobosk 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