PDA

View Full Version : Problem with room checking section of script..



roller81
04-02-2008, 08:24 PM
Ok, here is the section of my script that is not working right:


checkroom:
echo IN ROOM R%roomNumber
match start Sorry, you may only type ahead
match R%roomNumber You can't go there
match R%roomNumber I could not find what
match R%roomNumber Also here:
match attack a wraith
match R%roomNumber Obvious exits:
matchwait

What happens, is whenever I go into a room that has someone else in it, it moves to the 'attack' section. Below is a clip of the output when it goes into the 'checkroom' section.


setVariable: roomNumber=20
IN ROOM R20
[Smuggling Tunnels, Storage]
Wooden planks marked with various symbols and halves of words pile into the eastern corners of the room as if swept there. Tattered bits of textiles, piles of grain, and other odd smuggled bits mix in with the kindling, and a small pile of an unidentifiable ore has tumbled piece by piece into the next room. A few odd scorch marks line the dirt in the walls. You also see a wraith, a wraith and a wraith.
Also here: Randomguy
Obvious exits: north, east, south, west


Since it should match "Also here:" before "a wraith", why is it attacking instead of moving?

Deathravin
04-03-2008, 03:52 AM
Here's my roomcheck block... It gets into the room via a put direction, not a move direction (that's VERY important - especially in SF where everything isn't matched twice)...

You're just not thinking very third dimentionally... If it matches something in the room description & "You also see" paragraph, you still have yet to see "Also Here" or "Obvious Exits"... So you can match the wraith, then go straight in to see if anybody's here without missing a beat to you - but it's another label with more matches.

In SF, I'm not sure if it will see the disk or not... in Wizard, it certainly will (Wizard keeps everything in buffer for one match after it's matched... I can give you a script that will explain it better, but just assume I'm right)... But I never had an issue... But then I always used Wizard to script with my sorcerer.


HuntRoomCheck:
Save Hunt
Match GenericStandupAdd P>
Match KillVruul a lesser vruul
Match MoveRoomHunt ...wait
Match MoveRoomAdd Obvious exits:
Match MoveRoomAdd Obvious paths:
Match ComeBackToCenterL You can't go there.
Match ComeBackToCenterL Where are you trying to go?
Match ComeBackFromGoGo I could not find what you were referring to.
Match ComeBackFromGoGo around you.
Match ComeBackFromGoGo leaves you.
Match ComeBackFromGoGo A dark shadow seems to detach itself from your body, swiftly dissipating into the air.
Match GenericStandupAdd You don't seem to be able to move to do that.
Match GenericStandupAdd You can't do that while laying down.
Match GenericStandupAdd You must be standing to do that.
Match GenericStandupAdd You are still stunned.
Match GenericSignsAdd is no longer effective.
Matchwait

KillVruul:
save Vruul
goto KillingitRoomCheck

KillingitRoomCheck:
Match KillingitRoomCheck2p Roundtime:
Match KillitRoomFull disk
Match KillitRoomFull Also here:
Match KillitRoomFull Also in the room:
Match KillingitRoomCheck2P Obvious exits:
Match KillingitRoomCheck2P Obvious paths:
Matchwait



As for why it's still matching mob before also here, i'm not sure... This is always how I made my scripts to avoid that issue. But I've done things similar to yours for other things and they worked fine.

roller81
04-03-2008, 06:33 AM
thanks for that code deathravin, I'm still not sure wtf was wrong with mine, but breaking it into two seperate room checks seems to be working fine now

Outdrsyguy1
04-03-2008, 10:57 AM
The problem with yours was that the script reads word for word line by line just like you would. So if it comes to something like "wraith" and it knows to do an action, it quits reading and does that action. It doesn't take in the whole paragraph and review for bits and pieces and then perform an action.
You gave it a bunch of things to look for with match and when it finds the first one, it follows that path.

roller81
04-03-2008, 03:10 PM
yeah but didnt Wizard used to go through the matches in order. Like say for whatever reason, you did a match based on the 'info' screen:

put info
match ConNum (CON)
match StrNum (STR)
match DexNum (DEX)
matchwait

Wouldnt that (previously) go to ConNum section every time, since it checked for that match first? I could of swore thats how it used to work..

Outdrsyguy1
04-03-2008, 05:40 PM
well, i think your confused. How long of a string does it check before it makes a decision? one sentance, one paragraph, 10 paragraphs... what if (DEX) was in the first sentance and (CON) was in the 3rd paragraph? there's no way for it to decide how much to look at before making a decision. Atleast that's how i see it. In my experience it just goes word by word till it finds a match to one of any of the parameters then branches from there.