mining

Discussion about the technical aspects of scripting. Ask about all issues involving your freelance projects here.
Locked
mwade0123
Passer by
Posts: 3
Joined: Sun May 31, 2015 3:48 pm

mining

Post by mwade0123 »

so what would i need to do to make this script work on this shard?


;This script will attempt to mine cave tiles in a 5x5 area
;without having to move your character.
;The order of the tiles mined is as follows:
;|25|10|11|12|13|
;|24| 9| 2| 3|14|
;|23| 8| 1| 4|15|
;|22| 7| 6| 5|16|
;|21|20|19|18|17|


Set %playerx #CHARPOSX
Set %playery #CHARPOSY
Set %spot 1
Set #LTARGETKIND 2
GOSUB miningspot
START:
GOSUB findpickaxe
GOSUB usepickaxe
GOTO START


SUB findpickaxe
;This section pauses the script and stores the
;coordinates of the last spot you mined, in case
;you need your pet to fetch an object. Press play
;when you're done storing the ore.
If #WEIGHT >= 350
{
Sound
Event sysmessage You're getting close to the maximum weight, store your ore.
Set %storex #LTARGETX
Set %storey #LTARGETY
Pause
Set #LTARGETX %storex
Set #LTARGETY %storey
Set #LTARGETKIND 2
}
FINDITEM NPF C
If #FINDTYPE = NPF
{
Return
}
;This section will pause the script when you're
;out of pickaxes. You can return to your original
;position and press play to resume where you left off.
If #FINDTYPE = X
{
Sound
Event sysmessage You're out of pickaxes.
Pause
return
}

SUB usepickaxe
Set #LOBJECTID #FINDID
Event Macro 17
Target
Event Macro 22
set %jrnl #jindex
while #true
{
if #jindex > %jrnl
{
set %jrnl %jrnl + 1
scanjournal %jrnl
If Your_tool in #JOURNAL
{
Gosub findpickaxe
Set #LOBJECTID #FINDID
Event Macro 17
Target
Event Macro 22
}
If There_is in #JOURNAL
{
Set %spot %spot + 1
GOSUB miningspot
Wait 1s
Return
}
}
}

SUB miningspot
If %spot = 1
{
Set #LTARGETX %playerx
Set #LTARGETY %playery
Return
}

If %spot = 2
{
Set #LTARGETY #LTARGETY - 1
Return
}

If %spot = 3
{
Set #LTARGETX #LTARGETX + 1
Return
}

If %spot = 4
{
Set #LTARGETY #LTARGETY + 1
Return
}

If %spot = 5
{
Set #LTARGETY #LTARGETY + 1
Return
}

If %spot = 6
{
Set #LTARGETX #LTARGETX - 1
Return
}

If %spot = 7
{
Set #LTARGETX #LTARGETX - 1
Return
}

If %spot = 8
{
Set #LTARGETY #LTARGETY - 1
Return
}

If %spot = 9
{
Set #LTARGETY #LTARGETY - 1
Return
}

If %spot = 10
{
Set #LTARGETY #LTARGETY - 1
Return
}

If %spot = 11
{
Set #LTARGETX #LTARGETX + 1
Return
}

If %spot = 12
{
Set #LTARGETX #LTARGETX + 1
Return
}

If %spot = 13
{
Set #LTARGETX #LTARGETX + 1
Return
}

If %spot = 14
{
Set #LTARGETY #LTARGETY + 1
Return
}

If %spot = 15
{
Set #LTARGETY #LTARGETY + 1
Return
}

If %spot = 16
{
Set #LTARGETY #LTARGETY + 1
Return
}

If %spot = 17
{
Set #LTARGETY #LTARGETY + 1
Return
}

If %spot = 18
{
Set #LTARGETX #LTARGETX - 1
Return
}

If %spot = 19
{
Set #LTARGETX #LTARGETX - 1
Return
}

If %spot = 20
{
Set #LTARGETX #LTARGETX - 1
Return
}

If %spot = 21
{
Set #LTARGETX #LTARGETX - 1
Return
}

If %spot = 22
{
Set #LTARGETY #LTARGETY - 1
Return
}

If %spot = 23
{
Set #LTARGETY #LTARGETY - 1
Return
}

If %spot = 24
{
Set #LTARGETY #LTARGETY - 1
Return
}

If %spot = 25
{
Set #LTARGETY #LTARGETY - 1
Return
}

If %spot = 26
{
Sound
Event sysmessage You have mined all the ore in a 5x5 area, please move to a new 5x5 area and restart the script. ^_^
Halt
)
Locked