ID:159085
 
I'm trying to figure out how to set up a mining code, but to tell you the truth, I have no idea what I'm doing. I know what I want but I have limited experience with the code.

In the game, when you hit the "m" key while standing in front of a wall that can be mined (iconstate is at the bottom), there is a random chance (varies based on what you're trying to mine, but in this example, it is a 1 out of 10 chance) that you succeed. In order to mine, you need the pickaxe that has to be purchased from an NPC. You don't need to equip it or anything, it just has to be in the inventory.

I know that to allow for the needed variable, I need something like:
turf/BG/Mining/Strain RubyVein icon = 'Mineshaft.dmi' icon_state = "RubyVein" name = "" verb Mine() if(check.mine == 1) else return
But I do not know how to set up the rest.

Could someone please help me?

SladeJT wrote:
I have limited experience with the code.

THE code doesn't exist, it's a myth - like the Holy Grail.


In the game, when you hit the "m" key while standing in front of a wall that can be mined (iconstate is at the bottom), there is a random chance (varies based on what you're trying to mine, but in this example, it is a 1 out of 10 chance) that you succeed.

prob() comes to mind for this... or even pick() with prob()!

In order to mine, you need the pickaxe that has to be purchased from an NPC. You don't need to equip it or anything, it just has to be in the inventory.

locate() comes to mind here.

I know that to allow for the needed variable, I need something like:
...


Forum search boolean tricks. It'll help you out a lot :)
In response to GhostAnime
Thanks, but what about the m-key? I don't intend to use statpanel selected verbs.

Also, I meant to say "coding in general". >_<;
In response to SladeJT
SladeJT wrote:
Thanks, but what about the m-key? I don't intend to use statpanel selected verbs.
Look up macros in the DM reference.
(you put them in a macro file you create separately from a DM file)
In response to AJX
AJX wrote:
SladeJT wrote:
Thanks, but what about the m-key? I don't intend to use statpanel selected verbs.
Look up macros in the DM reference.
(you put them in a macro file you create separately from a DM file)
Thanks!