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

There's anything wrong with this?


VitinhooxD
 Share

Recommended Posts

Hello Eclipse.I'm Stuck with a sub of my game someone can help me?Here is it
Please read over the script
```
Sub MakeRecipe(index , job , recipe)
Dim x
Dim takecount
Dim item
Dim num
Dim give
Dim value
Dim chance
Dim exp
Dim giveexp
Dim lvl
Dim needtool
Dim weapon

weapon = Int(GetPlayerInvItemNum(index , Int(GetPlayerWeaponSlot(index))))
'I tested if Int and it doesn't worked
chance = GetVar("Skills\" & job & ".ini" , ""& recipe , "Chance")
lvl = GetPlayer2ndJobLvl(index)
exp = Int(GetVar("Accounts\" & GetPlayerName(index) & ".ini" , "SecondJob" , "Exp"))
'I tested if Int and it doesn't worked
giveexp = GetVar("Skills\" & job & ".ini" , ""& recipe , "GivenExp")
x = Int(1)
'I tested if Int and it doesn't worked
takecount = GetVar("Skills\" & job & ".ini" , ""& recipe , "TakeCount")
'I tested if Int and it doesn't worked
needtool = GetVar("Skills\" & job & ".ini" , ""& recipe , "NeedTool")
If GetPlayer2ndJobLvl(index) < Int(GetVar("Skills\" & job & ".ini" , ""& recipe , "LvlNeed")) Then
Call CustomMenuClose(index)
Call BattleMsg(index , "You need to be in level " & Int(GetVar("Skills\" & job & ".ini" , ""& recipe , "LvlNeed")) & " in  " & job & " to make " & recipe & " here!" , 12 , 0)
Exit Sub
End If
  If Int(weapon) <> Int(needtool) Then
Call CustomMenuClose(index)
Call BattleMsg(index , "You need to get the right tool to make " & recipe & " here!" , 12 , 0)
Exit Sub
  End If

          If PercentRand(index , Chance) = false Then
Call CustomMenuClose(Index)
Call BattleMsg(index , "You failed to make a " & recipe & " please try again!" , 12 , 0)
Exit Sub
          End If
'i tested all the vars that are below this text with int and doesn't worked 
give = GetVar("Skills\" & job & ".ini" , ""& recipe , "GiveItem")
value =  GetVar("Skills\" & job & ".ini" , ""& recipe , "GiveValue")
Do While Int(x) <= Int(takecount)
item = GetVar("Skills\" & job & ".ini" , ""& recipe , "Item" & Int(x))
num =  GetVar("Skills\" & job & ".ini" , ""& recipe , "Value"& Int(x))
'I have those functions
      If F_Check_Take(index , item , num) Then
          If PercentRand(index , Chance) = true Then
Call Take_Item(index , item , num)
      Else
Call AlertJob(index)
Exit Sub
      End If
          End If
x = x + 1
Loop

Call Give_Currency(index , give , value)
    If Int(exp) = "" Then
Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "SecondJob" , "Exp" , ""& giveexp)
    Else
exp = Int(exp) + giveexp
Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "SecondJob" , "Exp" , ""& exp)
    End If
    If Int(exp) >= Int(GetVar("Skills\jobexp.ini" , "Exp" , ""& GetPlayer2ndJobLvl(index))) Then
    Call PutVar("Accounts\" & GetPlayerName(index) & ".ini" , "SecondJob" , "Level" , ""& lvl + 1)
    End If
Call CustomMenuClose(index)
Call CustomMenuShow(index , "Congratulations" , "/GUI/CUSTOM/Confirm.gif" , 1)
Call CustomMenuLabel(index , 140 , "You made a " & recipe & " and now have " & exp & " in " & job & " ! " , 0 , 50 , 12 , 0 , 2 , 400 , 200)

End Sub

'This script is not for personal use
'You musn't use this script in your game
'2009 Sunshine development studios.All rights reserved
```
Thanks for reading
Link to comment
Share on other sites

Have you debugged with player messages? often times, that's one of the more usefull tools for debugging..

Though i(And the syntax checkers i use) don't see anything wrong with it. although, i do have a few questions. You have Godlord's inventory scripts? If so then, why use F_Check_Take(which i believe is Baron's?)..?

Also i'm guessing that you have created a function for "GetPlayer2ndJobLvl(index)"?
Link to comment
Share on other sites

You should definetly debug with playermsg's… especially after declaring a variable, just to make sure it's getting the correct ones... aswell as "Test - 'First If' -"(Example) after checks and such.. Just a suggestion.

Also, when using multiple subs in another sub, you might want to check and debug the ones you're calling, as it might not be a problem with the original sub at all, but the subs it calls.
Link to comment
Share on other sites

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...