PDA

View Full Version : Help Debugging a script?



Celexei
04-07-2004, 07:42 PM
I just got done writing my first successful hunting script, wrote it for something a step up from rats, so i went kappas. They're not to plentiful but they get the job done....My problem with my script though is i can't seem to get it to stop poaching as well as i have a problem with everytime i swing it automatically try's to skin and search? I set it up specifically so it would not do this but i can't seem to get it to work, otherwise its flawless as far as i can tell. I don't claim to know anything about scripting, i just wanted to learn how to write my own, and i was in need of one such as this, so i wrote it. Anywho here it is......

#Hunts greater kappas around the Coastal Cliffs, Black Sands Area
#Created by Lady Celexei Blackvine

counter set 0

start:
pause 1
put look
match checkexp [Beach Area, Tide Pool]
match hunting [The Black Sands]
match hunting [Beach Area, The Seam]
match hunting [Beach Area, Rocky Shore]
match hunting [Beach Area, Sailors’ Haven]
match hunting [Beach Area, Dock]
match hunting [Rocky Shore, Outside Haven]
match hunting [Rocky Shore, Boat Ramp]
match hunting [Rocky Shore, Boat House]
match hunting [Sailor’s Haven, Outside Rear]
match restorhunt [Merchant's Guild, Anteroom]
match logoff [Scripting Violation Limbo]
match logoff [Consolation Lounge]
match logoff [The Cell]
match lost Obvious
match filter greater kappa
matchwait

hunting:
match filter a greater kappa
match mover Obvious paths:
matchwait

mover:
pause .5
put %s
match start Sorry, you may only type ahead
match goback You can’t go there
match goback I could not find what
match filter a greater kappa
match mover Obvious paths:
matchwait

goback:
put look
match gb0 Obvious paths: southwest
match gb2 Obvious paths: northwest
match gb4 Obvious paths: northeast
match gb6 Obvious paths: southeast
match gb3 Obvious paths: north
match gb5 Obvious paths: east
match gb7 Obvious paths: south
match gb1 Obvious paths: west
matchwait

gb0:
save sw
goto mover

gb1:
save w
goto mover

gb2:
save nw
goto mover

gb3:
save n
goto mover

gb4:
save ne
goto mover

gb5:
save e
goto mover

gb6:
save se
goto mover

gb 7:
save s
goto mover

M0:
save w
goto mover

lost:
pause 1
put look
match filter a greater kappa
match checkexp [Beach Area, Tide Pool]
match hunting [The Black Sands]
match hunting [Beach Area, The Seam]
match hunting [Beach Area, Rocky Shore]
match hunting [Beach Area, Sailors’ Haven]
match hunting [Beach Area, Dock]
match hunting [Rocky Shore, Outside Haven]
match hunting [Rocky Shore, Boat Ramp]
match hunting [Rocky Shore, Boat House]
match hunting [Sailor’s Haven, Outside Rear]
match restorhunt [Merchant's Guild, Anteroom]

checkexp:
put exp
match gorest you must rest
match chooser your mind is
matchwait

chooser:
put time
match M0 by the elven time standard

filter:
put look
match start You can’t go there
match mover Also here
match attkap Obvious paths
matchwait

attkap:
waitfor A greater kappa swings
put post o
put kill
pause 1
put post d
match mover you referring to
match mover You currently have no valid target
match dead dies
match dead dead
match dead motionless
match dead A little bit
match attkap only type ahead

dead:
pause
put skin kappa
match skinned You skinned
match attkap You might want
match continue You botched
match continue You can only skin creatures
match continue been skinned

continue:
put search kappa
goto start

skinned:
put sheath
waitfor You put a
put get fin
put stow my fin
waitfor Your put a
put ready weapon
waitfor You remove
put search kappa
goto start

restorhunt:
put exp
match gohunt Your mind is muddled
match gohunt Your mind is clear
match gohunt Your mind is fresh and clear
match gohunt Your mind is clear as a bell
match rest Your mind
matchwait

gohunt:
put stand
put gird
waitfor You
move out
move out
move n
move ne
move e
move n
move go gate
move nw
move nw
move nw
move go road
move w
move w
move nw
move w
move w
move w
move nw
move nw
move w
move w
move sw
move w
move w
move w
move sw
move w
move go path
move e
goto start

gorest:
put look in my backpack
match sellfurrier fin
match moverest and a
match moverest and an
matchwait

moverest:
move w
move go path
move e
move ne
move e
move e
move e
move ne
move e
move e
move se
move se
move e
move e
move e
move se
move e
move e
move go road
move se
move se
move se
move go gate
put sheath
waitfor You
put wear shield
waitfor You
move s
move w
move se
move s
move go guild
go pass
put sit
goto rest

sellfurrier:
move w
move go path
move e
move ne
move e
move e
move e
move ne
move e
move e
move se
move se
move e
move e
move e
move se
move e
move e
move go road
move se
move se
move se
move go gate
put sheath
waitfor You
put wear shield
waitfor You
move s
move go furr
put remove my back
waitfor You take a
put sell backpack
waitfor Dakris takes
put wear my backpack
waitfor You put a
move out
move w
move s
move s
move s
move go bank
move go arch
goto bankdepo

bank depo:
pause 1
put depo all
match gobankrest You
matchwait

gobankrest:
move go arch
move out
move w
move w
move n
move go guild
move go pass
put sit
goto rest

rest:
pause 65
put exper
match rest Your mind can’t take much more
match rest Your mind is numbed
match gohunt Your mind is becoming numbed
match gohunt Your mind is muddled
match gohunt Your mind is clear
match gohunt Your mind is fresh and clear
match gohunt Your mind is clear as a bell
matchwait

logoff:
put exit


and yes i'm sure the coding looks familiar...i used alot of it from the rat hunter scritp :shrug: its my first script what can i say.

Latrinsorm
04-07-2004, 08:39 PM
Your gb7: is typo-ed as gb 7:

You left the matchwait off at the end of attkap:, lost:, dead:

The chooser: looks like it should be a waitfor, not a match, but you can just throw matchwait at the end if you want to keep it a match.

Hope that helps! :)

Celexei
04-07-2004, 08:41 PM
thanx bunches!

Celexei
04-07-2004, 08:46 PM
does it matter much whether its a match or waitfor?

Latrinsorm
04-07-2004, 08:49 PM
Originally posted by Celexei
does it matter much whether its a match or waitfor? No. All a match is is multiple waitfors running simultaneously and a match enters the command immediately before the thing happens (kinda hard to explain, it's troublesome if you're worried about type ahead lines) as opposed to technically waiting for it.

Anebriated
04-07-2004, 08:51 PM
A waitfor will pause the script until that line is returned. You can place multiple MATCHes together in order to do various tasks due to the outcome of something else.

Bobmuhthol
04-07-2004, 08:52 PM
<<All a match is is multiple waitfors running simultaneously>>

As a waitfor is a waitfor and a match is a match, this is a stupid description. It's basically an IF_THEN statement, but far less advanced, and can only GOTO labels as a result.

Latrinsorm
04-07-2004, 10:35 PM
Originally posted by Bobmuhthol
this is a stupid description.No it isn't. If they're so different, how come a single-line match does the same thing as a waitfor, barring the difference I already noted?

Anebriated
04-07-2004, 10:40 PM
The only reason your statement was wrong is because a waitfor will pause the script indefinately with no way of moving on until that string is found. A match as bob said is an 'If/then' statement. If a certain condition is met then goto another part of the script. You can have up to something like 18 or 24 Matches with one Matchwait.

Bobmuhthol
04-07-2004, 10:44 PM
<<how come a single-line match does the same thing as a waitfor>>

It doesn't. Matching a string does a GOTO, waitfor pauses the script until a certain string is found and then continues.

And you can have 32 matches in the match table.

Latrinsorm
04-07-2004, 10:48 PM
Originally posted by Elrodin
a waitfor will pause the script indefinately with no way of moving on until that string is found. How's that different from a match? Usually there's no pause because we (scripters) put a command in beforehand, but that doesn't mean the match/matchwait system won't pause. Try this out:

match north Park
match west Central
matchwait

north:
move n
exit

west:
move w
exit

Start it up. See if it pauses indefinitely or not.

edit: Ok, Bob's marginally right. :grr:

[Edited on 4-8-2004 by Latrinsorm]

Bobmuhthol
04-07-2004, 10:50 PM
Yeah, now compare that to the following:

waitfor Warclaidhm
put kill warclaidhm

Note the not separation of labels.

Anebriated
04-07-2004, 10:57 PM
try this instead


match north Park
match west Central
matchwait 1
goto pause

north:
move n
exit

west:
move w
exit

pause:
pause 15
echo * * * * * * * * * * *
echo * you are pausing *
echo * * * * * * * * * * *
exit

Anebriated
04-07-2004, 10:58 PM
there are different situations for each. If there is one action you are expecting and its guarenteed to come then use a waitfor. If there are MULTIPLE actions that could happen use a match. Its not that hard, *we* scripters know this.

Artha
04-07-2004, 11:03 PM
SF = unlimited matches.

Fengus
04-08-2004, 08:18 PM
Originally posted by Latrinsorm
match north Park
match west Central
matchwait


On an unrelated note, a trailing space is maintained in the script editor and can be matched. Thats problematic.

kazman32
05-06-2004, 06:33 AM
I edited that script to use myself and It works good until I get to The Black Sands room (dead end) and then it just stops there,any suggestions?

kazman32
05-06-2004, 02:53 PM
Nevermind,I fixed it.