Crafting Skill Script

*Created by Taz.*

```
Using "RC_Core.rcm"
; testingrc1 1.26
; Date/Time: 6:34:25 PM on 4/5/2010
; By Naddaz on TAZCO

;Will be used to craft bows and anything else like rings, neckless ect...
;added making handles and arrow shafts

Function Main()
Player = Actor()
Target = ContextActor()

	Craftinglvl% = AbilityLevel(Player, "Crafting")
	Craftingxp% = Split(ActorGlobal(Player, 2), 5, "|") ;stored crafting xp
	ChatBox% = OpenDialog(Player, Target, "Crafting")
    WoodCuttingLvl% = Attribute(Player, "WoodCutting") ;Used for xp gain

DialogOutPut(Player, ChatBox, "What Would you Like to make?", 255, 145, 23)
Craftingoption% = DialogInput(Player, ChatBox, "Bowes,Handles & Arrow Shafts,Rings Reserved not used,neck Reserved not used")

        If (HasItem(Player, "Crafting Knife"))
        ;Do nothing
        Else
         DialogOutpUt(Player, ChatBox, "You need a Crafting Knife to be able to craft.", 230, 145, 23)
        DialogInput(Player, ChatBox, "Close")
        CloseDialog(Player, ChatBox)
        Return
         EndIf

 If (CraftingOption = 1) ;make bows only oak bows added for testing.

     DialogOutPut(Player, ChatBox, "Which type of bow would you like to craft?", 255, 145, 23)
    Bowoption% = DialogInput(Player, ChatBox, "Oak Bow,DogWood Bow,Maple Bow,Elm Bow,Ash Bow,None")

    If (BowOption = 1)
;make oak bow
         ;cost 1 oak logs = 1 oak bow
        XpAmount% = WoodCuttingLvl + Craftinglvl * Rand(2, 4) + Rand(5, 9) ;xp given to player for crafting

         logamount% = HasItem(Player, "Oak Logs") ;check if player has item mats
            If (Logamount >= 1)

                    PBar% = CreateProgressBar(Player, 55, 5, 255, 0.40, 0.82, 0.2, 0.04, 7, 7, "Making 1 Oak Bow") ; crafting bar
                    Ticks% = 7 ;amount of for ticks also change the max and valve number in the PBar above.
                    ;stop to do the progress bar count down
                Repeat
                    Ticks% = Ticks - 1				;take 1 tick per half a sec
                    DoEvents(500)
                    UpdateProgressBar(Player, PBar, Ticks)   ;update progress bar
                Until(Ticks = 0) 				;end repeat if ticks = 0

                ;Continue with Crafting
                DeleteProgressBar(Player, PBar)
                GiveItem(Player, "Oak Logs", - 1) ; Take log from player
                DoEvents(1000)
                GiveItem(Player, "Oak Bow") ;Give player a bow
                OutPut(Player, "You have have made 1 Oak bow", 255, 145, 23)
                        ;get Crafting xp, add new xp and check if player has a Crafting level
                        MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
                        RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
                        MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
                        AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
                        CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
                        HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
                        MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
                        PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
                        SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
                        WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
                        DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
                        DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
                        ;extra skills for easy adding later.
                        NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|")
                        NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
                        NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
                        NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")

                      CraftingXpToGive% = CraftingXp + XpAmount ;amount xp to give player.

                              ;Send to levelup if Herbing level should be given.
             If (CraftingXpToGive >= Craftinglvl * 750) ;if player has amount of xp need to level send them to level up
                ThreadExecute("LevelUp", "Main", Player, Target, 11)	;parameter for Crafting = 11
                CraftingXpToGive% = 0 ;give 0 xp after level up
              EndIf

                   SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new melee xp amount

                CloseDialog(Player, ChatBox)

            Else
            DialogOutPut(Player, ChatBox, "You do not have any oak logs.", 255, 145, 23)
            DoEvents(700)
            CloseDialog(Player, ChatBox)
            Return
            EndIf

     ElseIf (BowOption = 2)
;make Dogwood bow
        ;cost 2 Dogwood logs = 1 dogwood bow
        XpAmount% = WoodCuttingLvl + Craftinglvl * Rand(2, 4) + Rand(10, 16) ;xp given to player for crafting
        CraftingTotXp% = Craftingxp + XpAmount
        logamount% = HasItem(Player, "DogWood Logs") ;check if player has item mats
            If (Logamount >= 2)

                    PBar% = CreateProgressBar(Player, 55, 5, 255, 0.40, 0.82, 0.2, 0.04, 14, 14, "Making 1 DoogWood Bow") ; crafting bar
                    Ticks% = 14 ;amount of for ticks also change the max and valve number in the PBar above.
                    ;stop to do the progress bar count down
                Repeat
                    Ticks% = Ticks - 1				;take 1 tick per half a sec
                    DoEvents(500)
                    UpdateProgressBar(Player, PBar, Ticks)   ;update progress bar
                Until(Ticks = 0) 				;end repeat if ticks = 0

                ;Continue with Crafting
                DeleteProgressBar(Player, PBar)
                GiveItem(Player, "DogWood Logs", - 2) ; Take log from player
                DoEvents(1000)
                GiveItem(Player, "DogWood Bow") ;Give player a bow
                OutPut(Player, "You have have made 1 DogWood bow", 255, 145, 23)
                        ;get Crafting xp, add new xp and check if player has a Crafting level
                        MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
                        RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
                        MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
                        AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
                        CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
                        HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
                        MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
                        PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
                        SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
                        WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
                        DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
                        DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
                        ;extra skills for easy adding later.
                        NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|")
                        NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
                        NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
                        NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")

                      CraftingXpToGive% = CraftingXp + XpAmount ;amount xp to give player.

                              ;Send to levelup if Herbing level should be given.
             If (CraftingXpToGive >= Craftinglvl * 750) ;if player has amount of xp need to level send them to level up
                ThreadExecute("LevelUp", "Main", Player, Target, 11)	;parameter for Crafting = 11
                CraftingXpToGive% = 0 ;give 0 xp after level up
              EndIf

                   SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new melee xp amount

                CloseDialog(Player, ChatBox)

            Else
            DialogOutPut(Player, ChatBox, "You do not have any DogWood logs.", 255, 145, 23)
            DoEvents(700)
            CloseDialog(Player, ChatBox)
            Return
            EndIf

     ElseIf (BowOption = 3)
;make Maple bow
         ;cost 2 Maple logs = 1 Maple bow
        XpAmount% = WoodCuttingLvl + Craftinglvl * Rand(2, 4) + Rand(20, 28) ;xp given to player for crafting
        CraftingTotXp% = Craftingxp + XpAmount
        logamount% = HasItem(Player, "Maple Logs") ;check if player has item mats
            If (Logamount >= 2)

                    PBar% = CreateProgressBar(Player, 55, 5, 255, 0.40, 0.82, 0.2, 0.04, 21, 21, "Making 1 Maple Bow") ; crafting bar
                    Ticks% = 21 ;amount of for ticks also change the max and valve number in the PBar above.
                    ;stop to do the progress bar count down
                Repeat
                    Ticks% = Ticks - 1				;take 1 tick per half a sec
                    DoEvents(500)
                    UpdateProgressBar(Player, PBar, Ticks)   ;update progress bar
                Until(Ticks = 0) 				;end repeat if ticks = 0

                ;Continue with Crafting
                DeleteProgressBar(Player, PBar)
                GiveItem(Player, "Maple Logs", - 2) ; Take log from player
                DoEvents(1000)
                GiveItem(Player, "Maple Bow") ;Give player a bow
                OutPut(Player, "You have have made 1 Maple bow", 255, 145, 23)
                        ;get Crafting xp, add new xp and check if player has a Crafting level
                        MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
                        RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
                        MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
                        AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
                        CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
                        HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
                        MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
                        PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
                        SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
                        WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
                        DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
                        DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
                        ;extra skills for easy adding later.
                        NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|")
                        NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
                        NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
                        NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")

                      CraftingXpToGive% = CraftingXp + XpAmount ;amount xp to give player.

                              ;Send to levelup if Herbing level should be given.
             If (CraftingXpToGive >= Craftinglvl * 750) ;if player has amount of xp need to level send them to level up
                ThreadExecute("LevelUp", "Main", Player, Target, 11)	;parameter for Crafting = 11
                CraftingXpToGive% = 0 ;give 0 xp after level up
              EndIf

                   SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new melee xp amount

                CloseDialog(Player, ChatBox)

            Else
            DialogOutPut(Player, ChatBox, "You do not have any Maple logs.", 255, 145, 23)
            DoEvents(700)
            CloseDialog(Player, ChatBox)
            Return
            EndIf
         ElseIf (BowOption = 4)
;make elm bow
         ;cost 3 Elm logs = 1 Elm bow
        XpAmount% = WoodCuttingLvl + Craftinglvl * Rand(3, 5) + Rand(36, 42) ;xp given to player for crafting
        CraftingTotXp% = Craftingxp + XpAmount
        logamount% = HasItem(Player, "Elm Logs") ;check if player has item mats
            If (Logamount >= 3)

                    PBar% = CreateProgressBar(Player, 55, 5, 255, 0.40, 0.82, 0.2, 0.04, 29, 29, "Making 1 Elm Bow") ; crafting bar
                    Ticks% = 29 ;amount of for ticks also change the max and valve number in the PBar above.
                    ;stop to do the progress bar count down
                Repeat
                    Ticks% = Ticks - 1				;take 1 tick per half a sec
                    DoEvents(500)
                    UpdateProgressBar(Player, PBar, Ticks)   ;update progress bar
                Until(Ticks = 0) 				;end repeat if ticks = 0

                ;Continue with Crafting
                DeleteProgressBar(Player, PBar)
                GiveItem(Player, "Elm Logs", - 3) ; Take log from player
                DoEvents(1000)
                GiveItem(Player, "Elm Bow") ;Give player a bow
                OutPut(Player, "You have have made 1 Elm bow", 255, 145, 23)
                        ;get Crafting xp, add new xp and check if player has a Crafting level
                        MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
                        RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
                        MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
                        AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
                        CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
                        HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
                        MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
                        PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
                        SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
                        WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
                        DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
                        DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
                        ;extra skills for easy adding later.
                        NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|")
                        NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
                        NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
                        NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")

                      CraftingXpToGive% = CraftingXp + XpAmount ;amount xp to give player.

                              ;Send to levelup if Herbing level should be given.
             If (CraftingXpToGive >= Craftinglvl * 750) ;if player has amount of xp need to level send them to level up
                ThreadExecute("LevelUp", "Main", Player, Target, 11)	;parameter for Crafting = 11
                CraftingXpToGive% = 0 ;give 0 xp after level up
              EndIf

                   SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new melee xp amount

                CloseDialog(Player, ChatBox)

            Else
            DialogOutPut(Player, ChatBox, "You do not have any Elm logs.", 255, 145, 23)
            DoEvents(700)
            CloseDialog(Player, ChatBox)
            Return
            EndIf
         ElseIf (BowOption = 5)
;make Ash bow
         ;cost 3 Ash logs = 1 Ash bow
        XpAmount% = WoodCuttingLvl + Craftinglvl * Rand(4, 6) + Rand(53, 65) ;xp given to player for crafting
        CraftingTotXp% = Craftingxp + XpAmount
        logamount% = HasItem(Player, "Ash Logs") ;check if player has item mats
             If (Logamount >= 3)

                    PBar% = CreateProgressBar(Player, 55, 5, 255, 0.40, 0.82, 0.2, 0.04, 36, 36, "Making 1 Ash Bow") ; crafting bar
                    Ticks% = 36 ;amount of for ticks also change the max and valve number in the PBar above.
                    ;stop to do the progress bar count down
                Repeat
                    Ticks% = Ticks - 1				;take 1 tick per half a sec
                    DoEvents(500)
                    UpdateProgressBar(Player, PBar, Ticks)   ;update progress bar
                Until(Ticks = 0) 				;end repeat if ticks = 0

                ;Continue with Crafting
                DeleteProgressBar(Player, PBar)
                GiveItem(Player, "Ash Logs", - 3) ; Take log from player
                DoEvents(1000)
                GiveItem(Player, "Ash Bow") ;Give player a bow
                OutPut(Player, "You have have made 1 Ash bow", 255, 145, 23)
                        ;get Crafting xp, add new xp and check if player has a Crafting level
                        MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
                        RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
                        MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
                        AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
                        CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
                        HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
                        MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
                        PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
                        SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
                        WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
                        DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
                        DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
                        ;extra skills for easy adding later.
                        NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|")
                        NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
                        NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
                        NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")

                      CraftingXpToGive% = CraftingXp + XpAmount ;amount xp to give player.

                              ;Send to levelup if Herbing level should be given.
             If (CraftingXpToGive >= Craftinglvl * 750) ;if player has amount of xp need to level send them to level up
                ThreadExecute("LevelUp", "Main", Player, Target, 11)	;parameter for Crafting = 11
                CraftingXpToGive% = 0 ;give 0 xp after level up
              EndIf

                   SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new melee xp amount

                CloseDialog(Player, ChatBox)

            Else
            DialogOutPut(Player, ChatBox, "You do not have any Ash logs.", 255, 145, 23)
            DoEvents(700)
            CloseDialog(Player, ChatBox)
            Return
            EndIf
    ElseIf (BowOption = 6)
    DoEvents(1000)
    CloseDialog(Player, ChatBox)
    EndIf

 ElseIf (CraftingOption = 2) ;Make Handles and arrow shafts.

            CloseDialog(Player, ChatBox)
           chatbox% = OpenDialog(Player, Target, "Crafting", 693)
           DialogOutPut(Player, ChatBox, "What would you like to make?", 230, 145, 43)
           DialogOutPUt(Player, ChatBox, "1 Oak Log, will make 2 Handles, and 1 log will make 5 Arrow Shafts.", 230, 145, 43)
           Craftoption% = DialogInput(Player, ChatBox, "Handle,Arrow Shaft,None")

            If (Craftoption = 1) ;make handle
                AHAmount% = Input(Player, "How many would you like to make?", "Total", 2) ;get player to add amount of arrow heads to make.

                    If (HasItem(Actor(), "Oak Logs", AHAmount)) ; check if player has an empty vial

                        	PBar% = CreateProgressBar(Player, 55, 5, 255, 0.40, 0.82, 0.2, 0.04, 10, 10, "Making Handles") ; casting bar
                            Ticks% = 10 ;amount of for ticks also change the max and valve number in the PBar above.
                                ;stop to do the progress bar count down
                                Repeat
                                    Ticks% = Ticks - 1				;take 1 tick per half a sec
                                    DoEvents(500)
                                    UpdateProgressBar(Player, PBar, Ticks)   ;update progress bar
                                Until(Ticks = 0) ;end repeat if ticks = 0
                        ;Continue with smelting
                        DeleteProgressBar(Player, PBar)
                        TotXp% = AHAmount * 15 ;input amount * base amount
                        Arrhedamount% = AHAmount * 2 ; input amount * 2 is amount of handle to give.
                        CraftingtotXp% = CraftingXp + TotXp
                        GiveItem(player, "Oak Logs", - AHAmount) ;take bar
                        GiveItem(Player, "Handle", Arrhedamount) ;give arrows 3 arrows per bar.
                        ;get Crafting xp, add new xp and check if player has a Crafting level
                        MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
                        RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
                        MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
                        AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
                        CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
                        HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
                        MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
                        PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
                        SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
                        WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
                        DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
                        DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
                        ;extra skills for easy adding later.
                        NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|")
                        NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
                        NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
                        NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")

                      CraftingXpToGive% = CraftingXp + XpAmount ;amount xp to give player.

                              ;Send to levelup if Herbing level should be given.
             If (CraftingXpToGive >= Craftinglvl * 750) ;if player has amount of xp need to level send them to level up
                ThreadExecute("LevelUp", "Main", Player, Target, 11)	;parameter for Crafting = 11
                CraftingXpToGive% = 0 ;give 0 xp after level up
              EndIf

                   SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new melee xp amount

                        DialogOutPut(Player, ChatBox, "You have made " + Arrhedamount + " handles.", 230, 145, 43)
                        DialogInput(Player, ChatBox, "Close")
                        CloseDialog(Player, chatbox)

                    Else
                    DialogOutPut(Player, ChatBox, "You do not have enough Oak Logs to make that amount.", 230, 145, 43)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                    Return

                    EndIf
             ElseIf (Craftoption = 2) ;make arrow shafts
                    AHAmount% = Input(Player, "How many would you like to make?", "Total", 2) ;get player to add amount of arrow heads to make.

                    If (HasItem(Actor(), "Oak Logs", AHAmount)) ; check if player has an empty vial

                        	PBar% = CreateProgressBar(Player, 55, 5, 255, 0.40, 0.82, 0.2, 0.04, 10, 10, "Making Handles") ; casting bar
                            Ticks% = 10 ;amount of for ticks also change the max and valve number in the PBar above.
                                ;stop to do the progress bar count down
                                Repeat
                                    Ticks% = Ticks - 1				;take 1 tick per half a sec
                                    DoEvents(500)
                                    UpdateProgressBar(Player, PBar, Ticks)   ;update progress bar
                                Until(Ticks = 0) ;end repeat if ticks = 0
                        ;Continue with smelting
                        DeleteProgressBar(Player, PBar)
                        TotXp% = AHAmount * 25 ;input amount * base amount
                        Arrhedamount% = AHAmount * 5 ; input amount * 5 is amount of arrow shafts heads to give.
                        CraftingtotXp% = Craftingxp + TotXp
                        GiveItem(player, "Oak Log", - AHAmount) ;take bar
                        GiveItem(Player, "Arrow Shaft", Arrhedamount) ;give arrows shafts.
                        ;get Crafting xp, add new xp and check if player has a Crafting level
                        MeleeXp% = Split(ActorGlobal(Player, 2), 1, "|")
                        RangingXp% = Split(ActorGlobal(Player, 2), 2, "|")
                        MagicXp% = Split(ActorGlobal(Player, 2), 3, "|")
                        AlchemyXp% = Split(ActorGlobal(Player, 2), 4, "|")
                        CraftingXp% = Split(ActorGlobal(Player, 2), 5, "|")
                        HerbingXp% = Split(ActorGlobal(Player, 2), 6, "|")
                        MiningXp% = Split(ActorGlobal(Player, 2), 7, "|")
                        PrayerXp% = Split(ActorGlobal(Player, 2), 8, "|")
                        SmeltingXp% = Split(ActorGlobal(Player, 2), 9, "|")
                        WoodCuttingXp% = Split(ActorGlobal(Player, 2), 10, "|")
                        DodgeXp% = Split(ActorGlobal(Player, 2), 11, "|")
                        DexXp% = Split(ActorGlobal(Player, 2), 12, "|")
                        ;extra skills for easy adding later.
                        NewSkillXp1% = Split(ActorGlobal(Player, 2), 13, "|")
                        NewSkillXp2% = Split(ActorGlobal(Player, 2), 14, "|")
                        NewskillXp3% = Split(ActorGlobal(Player, 2), 15, "|")
                        NewskillXp4% = Split(ActorGlobal(Player, 2), 16, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 17, "|")
                        NewskillXp5% = Split(ActorGlobal(Player, 2), 18, "|")

                      CraftingXpToGive% = CraftingXp + XpAmount ;amount xp to give player.

                              ;Send to levelup if Herbing level should be given.
             If (CraftingXpToGive >= Craftinglvl * 750) ;if player has amount of xp need to level send them to level up
                ThreadExecute("LevelUp", "Main", Player, Target, 11)	;parameter for Crafting = 11
                CraftingXpToGive% = 0 ;give 0 xp after level up
              EndIf

                   SetActorGlobal(Player, 2, SkillXPToStore) ;set dilimiter to actor global 2 with new melee xp amount

                        DialogOutPut(Player, ChatBox, "You have made " + Arrhedamount + " Arrow Shafts.", 230, 145, 43)
                        DialogInput(Player, ChatBox, "Close")
                        CloseDialog(Player, chatbox)

                    Else
                    DialogOutPut(Player, ChatBox, "You do not have enough Oak Logs to make that amount.", 230, 145, 43)
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                    Return

                    EndIf

             ElseIf (Craftoption = 3) ;Close
                    DialogInput(Player, ChatBox, "Close")
                    CloseDialog(Player, ChatBox)
                    Return
             EndIf

EndIf

End Function

```