ID:145707
 
Code:
mob
var
Mining = 1
MExp = 0
MaxMExp = 100
PickAxe = 0
ismining = 0
Move()
if(usr.ismining == 1)
usr.ismining = 0
usr << "You stop mining."
else
..()
proc
Bronze()
if(usr.ismining == 0)
if(usr.Mining >= 0)
usr << "You begin to mine.."
if(prob(50))
usr.ismining = 1
sleep(30)
usr.MExp += 25
usr.MineCheck()
usr << "You mine bronze ore!"
usr.MineCheck()
usr.contents += new/obj/Bronze_Ore
if(prob(50))
usr.ismining = 1
usr << "notta"
sleep(30)
else
usr << "You are not high enough level to mine this yet."
return
else
..()
if(usr.contents.len >= 35)
usr << "Your pack is full."
return
Iron()
if(usr.ismining == 0)
if(usr.Mining >= 15)
if(prob(50))
usr.ismining = 1
sleep(30)
usr.MExp += 25
usr << "You mine iron ore!"
usr.contents += new/obj/Iron_Ore
usr.MineCheck()
if(prob(50))
usr.ismining = 1
usr << "notta"
sleep(30)
else
usr << "You are not high enough level to mine this yet."
return
else
..()
if(usr.contents.len >= 35)
usr << "Your pack is full."
return

proc
MineCheck()
if(MExp >= MaxMExp)
usr.Mining+=1
usr.MExp=0
usr.MaxMExp+=25
usr << "Your mining increased to level [usr.Mining]!"

obj
icon = 'Skills.dmi'
Bronze
name = "Rock"
icon_state = "copper"
verb
Examine()
usr << "This rock contains bronze."
Mine()
set src in oview(1)
var/obj/haspick = locate(/obj/PickAxes/) in usr.contents
if(haspick)
usr.Bronze()
else
usr << "You need a PickAxe to mine."
Bronze_Ore
name = "Bronze Ore"
icon_state = "copper ore"
Iron
name = "Rock"
icon_state = "iron"
verb
Examine()
usr << "This rock contains iron."
Mine()
set src in oview(1)
var/obj/haspick = locate(/obj/PickAxes/) in usr.contents
if(haspick)
usr.Iron()
else
usr << "You need a PickAxe to mine."
Iron_Ore
name = "Iron Ore"
icon_state = "iron ore"
PickAxes
Bronze_PickAxe
name = "Bronze PickAxe"
icon = 'Skills.dmi'
icon_state = "bPick Axe"
Iron_PickAxe
name = "Iron PickAxe"
icon = 'Skills.dmi'
icon_state = "iPick Axe"


Problem description:

I want it so you keep mining till you move or ur inventory is full, but right now it just mines one thing and stops, can i get sum help. And yes i tried the loop proc, but i cant get it to work well for when you move it stops mining.
No put usr in proc. Ungh.
In response to Jp
Jp wrote:
No put usr in proc. Ungh.

What do you mean?? Try adding commas, are u saying "No, put usr in proc." or are u talking with like an accent "No put usr in proc."
In response to Evidence
he means don't put usr in a proc. usr doesnt always refer to the player. there's a article about it somewhere on the site, byondscape i think.
In response to JMT
But everything works except the part were i want it to keep going until the inventory is full or the usr moves, right now it just mines 2 things and stops.
In response to Evidence
1. Should be Developer How-To
2. With usr in a proc, it does NOT work fine. Wait untill later, and see the Runtime errors rolling in.
In response to Mysame
None of you are actualy helping me in anyway, I asked how do i make ot so mining just doesnt stop once u get 2 objects, and all u can say is sumthing about th proc.
In response to Evidence
We are helping. You don't know what we're talking about, 'nuf said. Usr in a proc is a BIG mistake. Before we CAN help you further, you need to fix it. And as I said, this belongs in Developer How-To.
In response to Mysame
Then how about a little help on what to replace usr with?
In response to Evidence
You've also got boolean vars, a bad way of adding something to contents.. I'm starting to having doubts if you coded that yourself, really.
In response to Mysame
Most of it is by me, but i looked a mining demo for a idea on what to do. But i didnt copy and paste. Check it out here --> http://developer.byond.com/hub/SageofTheSword/MiningDemo
In response to Evidence
That is a HORRIBLE demo.
In response to Mysame
You sure are quick to critisize, How 'bout you put ur words were ur mouth is and tell me what i can do to inprove this?
In response to Evidence
Didn't we already said that you may not use 'usr' there a DOZEN times?!
In response to Evidence
Then how about a little help on what to replace usr with?
In response to Mysame
Evidence wrote:
Then how about a little help on what to replace usr with?


Do i have to repeat my self again?
In response to Evidence
I hope you haven't gotten so fed up with them that you quit watching this post :P

You should replace all 'usr's with 'src'. This makes sure who you are referring to.. I will take a look at the rest of the code to see what the problem is as well.
Evidence wrote:
>           if(usr.contents.len >= 35)
> usr << "Your pack is full."
> return
>


Try making this an 'else if' instead of an if statement. Tell me if that helps.
In response to Flerix
Thank you Ferix =)
In response to Evidence
Glad to help instead of flaming.. that seems to be what is happening around the forums lately; I understand there is malice for people that are programming freeloader, but you guys really need to understand some people really need some help and dont understand things.
Page: 1 2