adamsharp Posted September 14, 2009 Author Share Posted September 14, 2009 If you can fix this the fixer can use it in thier game.```Sub Brsm(Index)Dim brDim irDim stDim siDim goDim testtest = Rand(1,2)si = Rand(1,2)go = Rand(1,2)st = Rand(1,2)ir = Rand(1,2)br = Rand(1,2)If CanTake(Index, 201, 1) ThenCall PlayerMsg(Index,"Attempting to smelt...", 10)If br = 1 ThenCall PlayerMsg(Index,"Smelt successful! You get a bronze bar!", 10) Call GiveCurrency(Index, 211, 1) Call TakeItem(Index, 201, 1)End IfIf br = 2 ThenCall PlayerMsg(Index,"Failed to smelt, ore destroyed", 12)Call TakeItem(Index, 201, 1)End IfElseIf CanTake(Index, 202, 1) ThenCall PlayerMsg(Index,"Attempting to smelt...", 10)If ir = 1 ThenCall PlayerMsg(Index,"Smelt successful! You get a iron bar!", 10) Call GiveCurrency(Index, 212, 1) Call TakeItem(Index, 202, 1)End IfIf ir = 2 ThenCall PlayerMsg(Index,"Failed to smelt, ore destroyed", 12)Call TakeItem(Index, 202, 1)End IfElseIf CanTake(Index, 203, 1) ThenCall PlayerMsg(Index,"Attempting to smelt...", 10)If st = 1 ThenCall PlayerMsg(Index,"Smelt successful! You get a steel bar!", 10) Call GiveCurrency(Index, 213, 1) Call TakeItem(Index, 203, 1)End IfIf st = 2 ThenCall PlayerMsg(Index,"Failed to smelt, ore destroyed", 12)Call TakeItem(Index, 203, 1)End IfElseIf CanTake(Index, 204, 1) ThenCall PlayerMsg(Index,"Attempting to smelt...", 10)If si = 1 ThenCall PlayerMsg(Index,"Smelt successful! You get a silver bar!", 10) Call GiveCurrency(Index, 214, 1) Call TakeItem(Index, 204, 1)End IfIf si = 2 ThenCall PlayerMsg(Index,"Failed to smelt, ore destroyed", 12)Call TakeItem(Index, 204, 1)End IfElseIf CanTake(Index, 205, 1) ThenCall PlayerMsg(Index,"Attempting to smelt...", 10)If go = 1 ThenCall PlayerMsg(Index,"Smelt successful! You get a gold bar!", 10) Call GiveCurrency(Index, 215, 1) Call TakeItem(Index, 205, 1)End IfIf go = 2 ThenCall PlayerMsg(Index,"Failed to smelt, ore destroyed", 12)Call TakeItem(Index, 205, 1)End IfElseIf CanTake(Index, 206, 1) ThenCall PlayerMsg(Index,"Attempting to smelt...", 10)If test = 1 ThenCall PlayerMsg(Index,"Smelt successful! You get a 206 bar!", 10) Call GiveCurrency(Index, 216, 1) Call TakeItem(Index, 206, 1)End IfIf test = 2 ThenCall PlayerMsg(Index,"Failed to smelt, ore destroyed", 12)Call TakeItem(Index, 206, 1)End IfElseCall PlayerMsg(Index,"No Ore To Smelt", 12)End IfEnd Sub```Regards,Adamsharp. Link to comment Share on other sites More sharing options...
Zamin Posted September 14, 2009 Share Posted September 14, 2009 OK, it should work now:```Sub Brsm(Index) Dim br Dim ir Dim st Dim si Dim go Dim test test = Rand(1,2) si = Rand(1,2) go = Rand(1,2) st = Rand(1,2) ir = Rand(1,2) br = Rand(1,2) If CanTake(Index, 201, 1) Then Call PlayerMsg(Index,"Attempting to smelt...", 10) If br = 1 Then Call PlayerMsg(Index,"Smelt successful! You get a bronze bar!", 10) Call GiveCurrency(Index, 211, 1) Call TakeItem(Index, 201, 1) End If If br = 2 Then Call PlayerMsg(Index,"Failed to smelt, ore destroyed", 12) Call TakeItem(Index, 201, 1) End If ElseIf CanTake(Index, 202, 1) Then Call PlayerMsg(Index,"Attempting to smelt...", 10) If ir = 1 Then Call PlayerMsg(Index,"Smelt successful! You get a iron bar!", 10) Call GiveCurrency(Index, 212, 1) Call TakeItem(Index, 202, 1) End If If ir = 2 Then Call PlayerMsg(Index,"Failed to smelt, ore destroyed", 12) Call TakeItem(Index, 202, 1) End If ElseIf CanTake(Index, 203, 1) Then Call PlayerMsg(Index,"Attempting to smelt...", 10) If st = 1 Then Call PlayerMsg(Index,"Smelt successful! You get a steel bar!", 10) Call GiveCurrency(Index, 213, 1) Call TakeItem(Index, 203, 1) End If If st = 2 Then Call PlayerMsg(Index,"Failed to smelt, ore destroyed", 12) Call TakeItem(Index, 203, 1) End If ElseIf CanTake(Index, 204, 1) Then Call PlayerMsg(Index,"Attempting to smelt...", 10) If si = 1 Then Call PlayerMsg(Index,"Smelt successful! You get a silver bar!", 10) Call GiveCurrency(Index, 214, 1) Call TakeItem(Index, 204, 1) End If If si = 2 Then Call PlayerMsg(Index,"Failed to smelt, ore destroyed", 12) Call TakeItem(Index, 204, 1) End If ElseIf CanTake(Index, 205, 1) Then Call PlayerMsg(Index,"Attempting to smelt...", 10) If go = 1 Then Call PlayerMsg(Index,"Smelt successful! You get a gold bar!", 10) Call GiveCurrency(Index, 215, 1) Call TakeItem(Index, 205, 1) End If If go = 2 Then Call PlayerMsg(Index,"Failed to smelt, ore destroyed", 12) Call TakeItem(Index, 205, 1) End If ElseIf CanTake(Index, 206, 1) Then Call PlayerMsg(Index,"Attempting to smelt...", 10) If test = 1 Then Call PlayerMsg(Index,"Smelt successful! You get a 206 bar!", 10) Call GiveCurrency(Index, 216, 1) Call TakeItem(Index, 206, 1) End If If test = 2 Then Call PlayerMsg(Index,"Failed to smelt, ore destroyed", 12) Call TakeItem(Index, 206, 1) End If Else Call PlayerMsg(Index,"No Ore To Smelt", 12) End If End Sub```Haven't tested it though. Let me know how it goes.Also, please keep everything nicely alligned as shown above. It is really hard to read code without any indentation. I'm sure you will note that too. :)-Thanks Link to comment Share on other sites More sharing options...
adamsharp Posted September 15, 2009 Author Share Posted September 15, 2009 yes that worked thank youNow I have a problem with my new script WoodCutting!```Case 1wc(Index)Dim RR = Rand(1,5)If CanTake(Index, 250, 1) Then Call PlayerMsg(Index,"Attempting to get wood...", 10)If R = 1 Or If R = 2 ThenCall PlayerMsg(Index,"Woodcutting successful! Found 1 evergreen log!", 10)End IfIf R = 3 ThenCall PlayerMsg(Index,"Woodcutting successful! Found 2 evergreen logs!", 10)End IfIf R = 4 Or If R = 5 ThenCall PlayerMsg(Index,"Woodcutting failed, hatchet damaged!", 12)End IfElseCall PlayerMsg(Index,"You don't have a hatchet!", 12)End IfEnd Sub```Regards,Adamsharp. Link to comment Share on other sites More sharing options...
kris_hole Posted September 15, 2009 Share Posted September 15, 2009 ```Case 1wc(Index)Dim RR = Rand(1,5)If CanTake(Index, 250, 1) Then Call PlayerMsg(Index,"Attempting to get wood...", 10)If R = 1 Or R = 2 ThenCall PlayerMsg(Index,"Woodcutting successful! Found 1 evergreen log!", 10)End IfIf R = 3 ThenCall PlayerMsg(Index,"Woodcutting successful! Found 2 evergreen logs!", 10)End IfIf R = 4 Or R = 5 ThenCall PlayerMsg(Index,"Woodcutting failed, hatchet damaged!", 12)End IfElseCall PlayerMsg(Index,"You don't have a hatchet!", 12)End IfEnd Sub``` Link to comment Share on other sites More sharing options...
Owen F Posted September 15, 2009 Share Posted September 15, 2009 Let's see [Probably wrong ill give it a shot]> **Case 1wc(Index)** What the hell is this? Are you trying to make a function like Call 1Wc(index) In which case it would be Sub 1Wc> > Dim R> > R = Rand(1,5)> > If CanTake(Index, 250, 1) Then> Call PlayerMsg(Index,"Attempting to get wood…", 10)> If R = 1 Or R = 2 Then> Call PlayerMsg(Index,"Woodcutting successful! Found 1 evergreen log!", 10)> It doesn't give them any items here, only a message> ElseIf R = 3 Then> Call PlayerMsg(Index,"Woodcutting successful! Found 2 evergreen logs!", 10)> ElseIf R = 4 Or R = 5 Then> Call PlayerMsg(Index,"Woodcutting failed, hatchet damaged!", 12)> Else> Call PlayerMsg(Index,"You don't have a hatchet!", 12)> End If> End SubSo…Edit the # # of the give items```Sub 1WcDim RR = Rand(1,5)If CanTake(Index, 250, 1) Then Call PlayerMsg(Index,"Attempting to get wood...", 10)If R = 1 Or R = 2 ThenCall PlayerMsg(Index,"Woodcutting successful! Found 1 evergreen log!", 10)Call GiveItem(index, #, #)ElseIf R = 3 ThenCall PlayerMsg(Index,"Woodcutting successful! Found 2 evergreen logs!", 10)Call GiveItem(index, #, #)ElseIf R = 4 Or If R = 5 ThenCall PlayerMsg(Index,"Woodcutting failed, hatchet damaged!", 12)ElseCall PlayerMsg(Index,"You don't have a hatchet!", 12)End IfEnd Sub```Should be just about right unless i've overlooked something D: Link to comment Share on other sites More sharing options...
kris_hole Posted September 15, 2009 Share Posted September 15, 2009 erm… owen... he asked why it wasnt workign not why doesnt it give items :P and you've left the Or If's in. it doesnt work like that,If R = 4 Or If R = 5 :P Link to comment Share on other sites More sharing options...
Owen F Posted September 15, 2009 Share Posted September 15, 2009 I only saw the top one.shows how stupid i am at reviewing scripts. One moment while i edit ;)Also: why have a woodcutting script that tells you it gives you item and leaves you empty handed? :3 Link to comment Share on other sites More sharing options...
kris_hole Posted September 15, 2009 Share Posted September 15, 2009 retarded online maybe :P XD Link to comment Share on other sites More sharing options...
balliztik1 Posted September 15, 2009 Share Posted September 15, 2009 You don't use If before each condition. You only use If at the beginning of the line.```Sub 1Wc(index)R = Rand(1,5)If CanTake(Index, 250, 1) Then Call PlayerMsg(Index,"Attempting to get wood...", 10)If R = 1 Or R = 2 ThenCall PlayerMsg(Index,"Woodcutting successful! Found 1 evergreen log!", 10)Call GiveItem(index, #, #)ElseIf R = 3 ThenCall PlayerMsg(Index,"Woodcutting successful! Found 2 evergreen logs!", 10)Call GiveItem(index, #, #)ElseIf R = 4 Or R = 5 ThenCall PlayerMsg(Index,"Woodcutting failed, hatchet damaged!", 12)ElseCall PlayerMsg(Index,"You don't have a hatchet!", 12)End IfEnd IfEnd Sub```The sub parameters need an index, and there was an unended If-statement. Link to comment Share on other sites More sharing options...
Owen F Posted September 15, 2009 Share Posted September 15, 2009 I think i fixed most of them errors except the end if and i think i screwed up on the Or statements Link to comment Share on other sites More sharing options...
kris_hole Posted September 15, 2009 Share Posted September 15, 2009 @ballie you left in If R = 4 or IF R = 5that second if would make it not work would it not? Link to comment Share on other sites More sharing options...
balliztik1 Posted September 19, 2009 Share Posted September 19, 2009 @[THE-KRIS:> link=topic=51836.msg545646#msg545646 date=1253022566]> @ballie you left in If R = 4 or IF R = 5> > that second if would make it not work would it not?xD Fail.I even pointed out that it does indeed break the script. I edited it on. Link to comment Share on other sites More sharing options...
kris_hole Posted September 19, 2009 Share Posted September 19, 2009 well done XD (claps from the distance) you nugget :P 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