log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- Accessing old floppy disks (Gen:3)
- November developer 'fireside' chat on saturday night (News:)
- RISCOSbits releases a new laptop solution (News:4)
- Announcing the TIB 2024 Advent Calendar (News:2)
- RISC OS London Show Report 2024 (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
Acorn Arcade forums: Programming: Adventure parser
 
  Adventure parser
  andrew (15:22 15/9/2005)
  monkeyson2 (16:26 15/9/2005)
    andrew (19:10 15/9/2005)
  rich (07:45 16/9/2005)
    andrew (12:10 16/9/2005)
      ninj (14:22 22/9/2005)
        andrew (18:11 22/9/2005)
          ninj (18:29 22/9/2005)
          instantiator (12:06 27/9/2005)
            rich (12:59 27/9/2005)
              monkeyson2 (13:46 27/9/2005)
                Phlamethrower (15:02 27/9/2005)
              andrew (19:08 27/9/2005)
                rich (19:55 27/9/2005)
                monkeyson2 (09:36 28/9/2005)
                  rich (10:10 28/9/2005)
                  andrew (18:45 28/9/2005)
 
Andrew Message #69229, posted by andrew at 15:22, 15/9/2005
HandbagHandbag Boi
Posts: 3439
So for the first adventure i wrote the parser went something like this:

1. recognise first word or word pair; some words are synonymous but recognised.
2. redirect to appropriate routine
3. if routine has more than two objects or subordinate clause (for want of more accurate term) then see if the top level of this action can be dealt with by the same routine and then pass to individual subroutines e.g. say to goat "hello" or give book to wizard
4. If only one object then have individual routine.

Later adventures took this further (e.g. Magnetic scrolls) but even then many of the words can be discarded and re-formed into one of the above. The hardest part of course if the discarding and re-arranging.

Anybody have any clever but not to convoluted ways of parsing?
  ^[ Log in to reply ]
 
Phil Mellor Message #69231, posted by monkeyson2 at 16:26, 15/9/2005, in reply to message #69229
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
Have you read the Inform designer's manual?

http://www.inform-fiction.org/manual/html/ch5.html

Infact, why not write your adventure in Inform?
  ^[ Log in to reply ]
 
Andrew Message #69236, posted by andrew at 19:10, 15/9/2005, in reply to message #69231
HandbagHandbag Boi
Posts: 3439
Thanks tho' I prefer BASIC/assembler.

In fact if you want to see what's really possible take a look at the "Wonderland" manual by MS. That's too much I reckon however. I was just wondering if I'm being wasteful of space the way I was doing it.
Somebody showed me an amazing way of compacting a lot of "IF FNn THEN.." using null variable=EVAL("FN"+n) or something like that. Brilliant.
  ^[ Log in to reply ]
 
Richard Goodwin Message #69247, posted by rich at 07:45, 16/9/2005, in reply to message #69229
Rich
Dictator for life
Posts: 6828
My first Archimedes program was a video recorder based on the Watford hardware. Because I had to write it at home on my Acorn Electron it had a type-in English parser before it had mouse controls, and took a fairly similar route to yours - it would see key words and match it with its list of commands and synonyms, and then parse for nearby extra words. This meant you could ask it to "Please play back at half speed". I think you could chain commands (parsing for e.g. 'and then') but it's been a while...
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Andrew Message #69255, posted by andrew at 12:10, 16/9/2005, in reply to message #69247
HandbagHandbag Boi
Posts: 3439
I was tempted to write an Arc adventure, it'd certainly be easier but the Beeb is more of a challenge!
  ^[ Log in to reply ]
 
ninjah Message #69543, posted by ninj at 14:22, 22/9/2005, in reply to message #69255
Member
Posts: 288
I remember there was a series in the Micro User, probably in the very early nineties or late eighties. That went into some depth on how to write an adventure game parser, and I have to say having read that, I'd just use Inform!

That said, I don't think a Z-code interpreter exists for the Beeb, so while you can run your game on an Arc or an Apple II or a Palm or whatever, you can't run it on a Beeb. Perhaps that could be your challenge - to get a Z-code interpreter running on the Beeb!
  ^[ Log in to reply ]
 
Andrew Message #69556, posted by andrew at 18:11, 22/9/2005, in reply to message #69543
HandbagHandbag Boi
Posts: 3439
A challenge right enough - I just want to write the game! :)
  ^[ Log in to reply ]
 
ninjah Message #69557, posted by ninj at 18:29, 22/9/2005, in reply to message #69556
Member
Posts: 288
:)
  ^[ Log in to reply ]
 
Lewis Westbury Message #69729, posted by instantiator at 12:06, 27/9/2005, in reply to message #69556
Member
Posts: 365
Anyone ever consider writing a RISC OS parser? ie. a CLI, but adventure-game English - and able to simulate actions in the desktop?
  ^[ Log in to reply ]
 
Richard Goodwin Message #69734, posted by rich at 12:59, 27/9/2005, in reply to message #69729
Rich
Dictator for life
Posts: 6828
No, but I did once write a command mouseclick x y b so I could simulate desktop mouse clicks from a BASIC program.

...to take screenshots from a web browser so I could auto-thumbnail template files. I sent a GET command to change the colours of a web page. This meant that the screenshot was always of the same URL - so I had to hit the reload button to refresh the graphics. Then I had to close the browser window each time so that I didn't have loads of them by the end of the excercise. Made sense to do another mouse click.
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Phil Mellor Message #69735, posted by monkeyson2 at 13:46, 27/9/2005, in reply to message #69734
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
You can see a directory window containing a text file, a draw file and a sprite file.

> DELETE FILE

Do you mean the text file, the draw file, or the sprite file?

> SPRITE

You can't, it's write protected.

> CLOSE WINDOW. LOOK.

You close the window.

You are in a maze of twisty, turny pinboard icons, all alike.

> SHUT DOWN

You shut down the computer.

It is very dark. You are likely to be eaten by a grue.

[Edited by monkeyson2 at 14:48, 27/9/2005]
  ^[ Log in to reply ]
 
Jeffrey Lee Message #69751, posted by Phlamethrower at 15:02, 27/9/2005, in reply to message #69735
PhlamethrowerHot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff

Posts: 15100
:E
  ^[ Log in to reply ]
 
Andrew Message #69773, posted by andrew at 19:08, 27/9/2005, in reply to message #69734
HandbagHandbag Boi
Posts: 3439
No, but I did once write a command mouseclick x y b so I could simulate desktop mouse clicks from a BASIC program.
How do you simulate mouse double clicks from BASIC? Or rather, implement a mouse double click via BASIC - with SWIs? I seem to remember I couldn't get the BASIC commands themselves to do it.
  ^[ Log in to reply ]
 
Richard Goodwin Message #69777, posted by rich at 19:55, 27/9/2005, in reply to message #69773
Rich
Dictator for life
Posts: 6828
No, but I did once write a command mouseclick x y b so I could simulate desktop mouse clicks from a BASIC program.
How do you simulate mouse double clicks from BASIC? Or rather, implement a mouse double click via BASIC - with SWIs? I seem to remember I couldn't get the BASIC commands themselves to do it.
Sorry - doubleclicks? Just click twice quickly ;)

Actually, one trick I found when I wrote my "poor mans VNC" (clickable screenshot via web page) is that sending 7 as the mouse button (i.e. all buttons at once) is enough to load programs - this is probably double click, or at least enough of one for some uses.
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Phil Mellor Message #69781, posted by monkeyson2 at 09:36, 28/9/2005, in reply to message #69773
monkeyson2Please don't let them make me be a monkey butler

Posts: 12380
No, but I did once write a command mouseclick x y b so I could simulate desktop mouse clicks from a BASIC program.
How do you simulate mouse double clicks from BASIC? Or rather, implement a mouse double click via BASIC - with SWIs? I seem to remember I couldn't get the BASIC commands themselves to do it.
All desktop programs respond to messages (eg open window, close window, key press, mouse click) so presumably you just send/broadcast the appropriate message yourself. That's how a lot of these automatic typing/macro programs work.
  ^[ Log in to reply ]
 
Richard Goodwin Message #69792, posted by rich at 10:10, 28/9/2005, in reply to message #69781
Rich
Dictator for life
Posts: 6828
^ I would also know a little bit about this :E
________
RichGCheers,
Rich.
  ^[ Log in to reply ]
 
Andrew Message #69834, posted by andrew at 18:45, 28/9/2005, in reply to message #69781
HandbagHandbag Boi
Posts: 3439
No, but I did once write a command mouseclick x y b so I could simulate desktop mouse clicks from a BASIC program.
How do you simulate mouse double clicks from BASIC? Or rather, implement a mouse double click via BASIC - with SWIs? I seem to remember I couldn't get the BASIC commands themselves to do it.
All desktop programs respond to messages (eg open window, close window, key press, mouse click) so presumably you just send/broadcast the appropriate message yourself. That's how a lot of these automatic typing/macro programs work.
I was trying to implement it with Mouse x,y,z [t] but couldn't work out how to do double clicks.
  ^[ Log in to reply ]
 

Acorn Arcade forums: Programming: Adventure parser