PDA

View Full Version : Problem counter script



Trinitis
09-13-2003, 07:50 PM
Ok, so porcell gave me this script to help me count items in a container..but he said I'd have to fiddle with it cause it counts everything twice..well, yes it does. Figured someone here might be able to tell me whats going on, cause I've been fighting with it all bloody day.

-The Script-

#Count Items in Container

if_1 goto Start
echo Useage: .count container "full item name here"
exit

Start:
counter set 0
save %1
shift
goto Check

Check:
put prep 416
waitfor Your spell
put cast at my %s
put mana

CheckNext:
echo 1
match AddOne %1
match Done Mana Points:
matchwait

Addone:
echo 2
counter add 1
goto CheckNext

Done:
echo 3
echo
echo Counter is %c
exit

(Note : I added the echo 1, echo 2, and echo 3 trying to debug it..)

When the script runs, it does this.

.count pouch ruby

[Press the ESCape key to abort script.]
prep 416
[Script]>You gesture and invoke the powers of the elements for the Piercing Gaze spell...
Your spell is ready.
cast at my pouch
mana
1
[Script]>Violetgypsy put an enruned monir trunk in a battered iron box that is on the ground.
[Script]>
You gesture at an elegant black silk gem pouch.
You gaze at the pouch and see. . .

An elegant black silk gem pouch which contains:
A spiked onyx scarab (in)
A sky-blue glaes scarab (in)
An emerald (in)
A spiked onyx scarab (in)
A small white pearl (in)
A pink sapphire (in)
A star sapphire (in)
A violet sapphire (in)
A star sapphire (in)
A star sapphire (in)
2
1
A star ruby (in)
2
1
2
1
A star ruby (in)
2
1


Cast Roundtime 3 Seconds.
[Script]>
3

Counter is 4

[Script finished!]
Mana Points: 246 remaining: 226

Any of you scriptoids have any ideas? :P

-Adredrin

Caels
09-13-2003, 08:30 PM
Wel, not sure if this might be the problem or not, but %1 will only cover the first word of the item you are trying to count.

if you type in :
.count pouch ruby sapphire

then the script will count all the word "ruby" occurrences, and ignore all other words.

Possible fix is, where it says MATCH AddOne %1 replace with :
MATCH AddOne %1 %2 %3 %4

up to however many words you think might be present

Caels
09-13-2003, 08:42 PM
Well, the fix above won't help you any since you only used the word ruby by itself, but try adding a separation between checks, it may just be running over itself to quickly and causing the error.

Like in hunting scripts, you can have a macth set up for the "Also here" or "Also in the room" and sometimes it completely skips it because the GSL just sucks like that.

Deathravin
09-17-2003, 10:01 PM
Wizard doubles matches. Not in every case, but if you give it a chance to, it'll see the match twice. I'll give you a for-instance.


<<<Script>>>

HuntPrepareSpellsCheck:
Counter set 0
Match HuntPrepareSpellsCheck2 You don't have a prepared spell to release!
Match HuntPrepareSpellsCheck2 You feel the magic of your spell rush away from you.
put release
Matchwait

HuntPrepareSpellsCheck2:
put prep 405
put cast
Save WallOfForceNo
HuntPrepareSpellsCheck3:
Match HuntPrepareSpellsCheckA Cloak of Shadows with
Match HuntPrepareSpellsCheckA Elemental Defense III with
Match HuntPrepareSpellsCheckA Elemental Defense II with
Match HuntPrepareSpellsCheckA Elemental Defense I with
Match HuntPrepareSpellsCheckA Spirit Warding II with
Match HuntPrepareSpellsCheckA Spirit Warding I with
Match HuntPrepareSpellsCheckA Spirit Barrier with
Match HuntPrepareSpellsCheckA Lesser Shroud with
Match HuntPrepareSpellsCheckB Wall of Force
Match HuntPrepareDP3 Roundtime 3 seconds.
Matchwait

HuntPrepareDP3:
pause 3
Goto HuntPrepareD%s

HuntPrepareSpellsCheckA:
Counter Add 1
goto HuntPrepareSpellsCheck3

HuntPrepareSpellsCheckB:
Counter Add 1
Save WallOfForceYes
goto HuntPrepareSpellsCheck3

HuntPrepareSpellsCheckDY1:
HuntPrepareSpellsCheckDY2:
HuntPrepareSpellsCheckDY3:
HuntPrepareSpellsCheckDY4:
HuntPrepareSpellsCheckDY5:
HuntPrepareSpellsCheckDY6:
HuntPrepareSpellsCheckDY7:
HuntPrepareSpellsCheckDY8:
HuntPrepareSpellsCheckDY9:
HuntPrepareSpellsCheckDY10:
HuntPrepareSpellsCheckDY11:
HuntPrepareSpellsCheckDY12:
HuntPrepareSpellsCheckDY13:
HuntPrepareSpellsCheckDY14:
HuntPrepareSpellsCheckDY15:
HuntPrepareSpellsCheckDY16:
HuntPrepareSpellsCheckDY17:
HuntPrepareDWallOfForceNo:
Echo
Echo *
Echo * I cant hunt, I need Spells
Echo * I'm Gunna go Spell my ass up again
Echo *
Echo
Goto SpellingUpStart

HuntPrepareDWallOfForceYes:
Goto HuntPrepareSpellsCheckDY%c

HuntPrepareSpellsCheckDY18:
Echo
Echo *
Echo * I will now go hunt
Echo *
Echo
Goto Huntingprepare

<<<Comments>>>

Do you think that I have 18 spells on me? There are only 9 spells up in the HuntPrepareSpellsCheck3.
It can and WILL every time, consistantly, show 18 for the counter. Thats the way wizard works, just FYI. (eScape, and presumeably Stormfront do not do this)

-Deathravin

Reyek
09-18-2003, 05:54 AM
Not sure about Stormfront on this one.... The scripting sections of it have yet to be completed even for us Alpha testers. :(