I am using Gforth or pFORTH as my FORTH environment for my text adventure project, I was wondering, how do I use VERB NOUN situations with FORTH words? I theorized I make a variable (Variable verb) and then when I use a word like GET I would define itlike so : get vget verb ! ; and if I was to use GET SWORD I would use the same get word, then sword would be : sword (using if conditions of what verbs were used before the word SWORD) ; would that be a way to do it? :)
Of course, you have to elaborate this a bit if there are more things to pick up ;-)BTW, the easiest way to do that is to hash the string and use CASE..ENDCASE as a dispatcher, e.g.
UNTESTED <<
It's much neater to do a table of course, but that's a bit harder.
It's much neater to do a table of course, but that's a bit harder.Maybe, but „the sword” — or, in general, the argument — is rather secondary
question. The primary question is: what if the player types TAKE instead
of GET? And the answer is: an ABORT will be performed, ruining the game.
So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
but it's not quite prepared for gaming purposes.
It's much neater to do a table of course, but that's a bit harder.Maybe, but „the sword” — or, in general, the argument — is rather secondary
question. The primary question is: what if the player types TAKE instead
of GET? And the answer is: an ABORT will be performed, ruining the game.
So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
but it's not quite prepared for gaming purposes.
The primary question is: what if the player types TAKE insteadRTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!
of GET? And the answer is: an ABORT will be performed, ruining the game.
I am using Gforth or pFORTH as my FORTH environment for my textAn objects extension using the VERB NOUN format would seem to fit.
adventure project, I was wondering, how do I use VERB NOUN situations
with FORTH words? I theorized I make a variable (Variable verb) and
then when I use a word like GET I would define it like so : get vget
verb ! ; and if I was to use GET SWORD I would use the same get word,
then sword would be : sword (using if conditions of what verbs were
used before the word SWORD) ; would that be a way to do it? :)
I am using Gforth or pFORTH as my FORTH environment for my text adventure project, I was wondering, how
It's much neater to do a table of course, but that's a bit harder.
Maybe, but „the sword” — or, in general, the argument — is rather secondary
question. The primary question is: what if the player types TAKE instead
of GET? And the answer is: an ABORT will be performed, ruining the game.
So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
but it's not quite prepared for gaming purposes.
On 12/08/2022 00:32, Zbig wrote:
It's much neater to do a table of course, but that's a bit harder.
Maybe, but „the sword” — or, in general, the argument — is rather secondary
question. The primary question is: what if the player types TAKE instead
of GET? And the answer is: an ABORT will be performed, ruining the game.
So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
but it's not quite prepared for gaming purposes.
Determination beats reason every time. Infocom solved it 40 years ago.
On Fri, 12 Aug 2022 12:02:19 +1000
dxforth <dxforth@gmail.com> wrote:
On 12/08/2022 00:32, Zbig wrote:Other text game adventure systems are available; It might be fun, but it's still wheel-reinventing.
It's much neater to do a table of course, but that's a bit harder.
Maybe, but „the sword” — or, in general, the argument — is rather secondary
question. The primary question is: what if the player types TAKE instead >>> of GET? And the answer is: an ABORT will be performed, ruining the game. >>>
So yes, it is tempting to use Forth interpreter, which is already here, ready for use,
but it's not quite prepared for gaming purposes.
Determination beats reason every time. Infocom solved it 40 years ago.
Other text game adventure systems are available; It might be fun, but it's still wheel-reinventing.Sure. I've done MANY - most recently one for Rosetta Codes RCRPG: https://rosettacode.org/wiki/RCRPG/uBasic-4tH
On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
The primary question is: what if the player types TAKE instead
of GET? And the answer is: an ABORT will be performed, ruining the game.
RTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!
On 12/08/2022 02:55, Hans Bezemer wrote:
On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
The primary question is: what if the player types TAKE instead
of GET? And the answer is: an ABORT will be performed, ruining the game.
RTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!But how do you stop the forth interpreter handling numbers :) Case-sensitivity, number handling etc IMO conspire to make it
problematic for serious apps.
I had a quick look at venture.4th. While it uses the forth
interpreter, AFAICS it does so very minimally - something
that could be emulated without the quirks of forth?
On Sunday, August 14, 2022 at 7:27:56 AM UTC-4, dxforth wrote:
On 12/08/2022 02:55, Hans Bezemer wrote:
On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
The primary question is: what if the player types TAKE instead
of GET? And the answer is: an ABORT will be performed, ruining the game.
RTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!But how do you stop the forth interpreter handling numbers :) Case-sensitivity, number handling etc IMO conspire to make it
problematic for serious apps.
I had a quick look at venture.4th. While it uses the forthI never understood the tendency to avoid writing a new interpreter loop
interpreter, AFAICS it does so very minimally - something
that could be emulated without the quirks of forth?
in a case like this.
Since Forth exposes all the component parts it's pretty simple to
write your own and remove compilation, add a custom error handler
or whatever you need.
Is that just considered bad form?
Even in crippled standard Forth:
WORDLIST VALUE myapp
Even in crippled standard Forth:Actually which of twenty (or so) standards of Forth you mean ("WORDLIST"?)?
WORDLIST VALUE myapp
On Sunday, August 14, 2022 at 7:27:56 AM UTC-4, dxforth wrote:
On 12/08/2022 02:55, Hans Bezemer wrote:
On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:But how do you stop the forth interpreter handling numbers :)
The primary question is: what if the player types TAKE insteadRTFM. That'll learn them to stick to the provided vocabulary AND FOLLOW INSTRUCTIONS!
of GET? And the answer is: an ABORT will be performed, ruining the game. >>>
Case-sensitivity, number handling etc IMO conspire to make it
problematic for serious apps.
I had a quick look at venture.4th. While it uses the forth
interpreter, AFAICS it does so very minimally - something
that could be emulated without the quirks of forth?
I never understood the tendency to avoid writing a new interpreter loop
in a case like this.
Since Forth exposes all the component parts it's pretty simple to
write your own and remove compilation, add a custom error handler
or whatever you need.
Is that just considered bad form?
...
- This is one of the oldest for 4tH: https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/venture.4th
On 13/08/2022 22:17, Hans Bezemer wrote:
... - This is one of the oldest for 4tH: https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/venture.4th
FWIW here's a mostly working conversion to Standard Forth:
https://pastebin.com/tR9gCP4E
Due to PC problems will need to leave it to others to iron out remaining issues.
I never understood the tendency to avoid writing a new interpreter loop
in a case like this.
Since Forth exposes all the component parts it's pretty simple to
write your own and remove compilation, add a custom error handler
or whatever you need.
On Sunday, August 14, 2022 at 7:27:56 AM UTC-4, dxforth wrote:
On 12/08/2022 02:55, Hans Bezemer wrote:FOLLOW INSTRUCTIONS!
On Thursday, August 11, 2022 at 4:32:16 PM UTC+2, Zbig wrote:
The primary question is: what if the player types TAKE insteadRTFM. That'll learn them to stick to the provided vocabulary AND
of GET? And the answer is: an ABORT will be performed, ruining the game. >> >
But how do you stop the forth interpreter handling numbers :)
Case-sensitivity, number handling etc IMO conspire to make it
problematic for serious apps.
I had a quick look at venture.4th. While it uses the forth
interpreter, AFAICS it does so very minimally - something
that could be emulated without the quirks of forth?
I never understood the tendency to avoid writing a new interpreter loop
in a case like this.
Since Forth exposes all the component parts it's pretty simple to
write your own and remove compilation, add a custom error handler
or whatever you need.
Is that just considered bad form?
On Friday, August 12, 2022 at 10:44:39 AM UTC+2, Kerr-Mudd, John wrote:
Other text game adventure systems are available; It might be fun, but it's >> still wheel-reinventing.Sure. I've done MANY - most recently one for Rosetta Codes RCRPG: >https://rosettacode.org/wiki/RCRPG/uBasic-4tH
- This is one of the oldest for 4tH: >https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/venture.4th >- I've even done a meta one: where you can design adventures by using a >humble textfile: >https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/simpladv.4th >and >https://sourceforge.net/p/forth-4th/code/HEAD/tree/trunk/4th.src/apps/simpladv/theend.chs
But that's not the point here, I guess. It's not about the adventure, it's >about the voyage.
About "can I do that". About learning. Not about "you've seen it all before".
Hans Bezemer
On Fri, 12 Aug 2022 12:02:19 +1000rather secondary
dxforth <dxforth@gmail.com> wrote:
On 12/08/2022 00:32, Zbig wrote:
It's much neater to do a table of course, but that's a bit harder.
Maybe, but „the sword” — or, in general, the argument — is
here, ready for use,question. The primary question is: what if the player types TAKE instead >>>> of GET? And the answer is: an ABORT will be performed, ruining the game. >>>>
So yes, it is tempting to use Forth interpreter, which is already
Other text game adventure systems are available; It might be fun, but it's >> still wheel-reinventing.but it's not quite prepared for gaming purposes.
Determination beats reason every time. Infocom solved it 40 years ago.
Indeed there are. What's bothering is the premise: 'Oh, but it should be >possible to use the forth interpreter for that'. Suddenly it becomes about >forth proving itself rather than identifying the needs of the application. >I'm sure cute things can be done with the forth interpreter. I just question >the priority.
In article <td7a35$138s$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
On 12/08/2022 18:44, Kerr-Mudd, John wrote:
On Fri, 12 Aug 2022 12:02:19 +1000rather secondary
dxforth <dxforth@gmail.com> wrote:
On 12/08/2022 00:32, Zbig wrote:
It's much neater to do a table of course, but that's a bit harder.
Maybe, but „the sword” — or, in general, the argument — is
here, ready for use,question. The primary question is: what if the player types TAKE instead >>>>> of GET? And the answer is: an ABORT will be performed, ruining the game. >>>>>
So yes, it is tempting to use Forth interpreter, which is already
Other text game adventure systems are available; It might be fun, but it's >>> still wheel-reinventing.but it's not quite prepared for gaming purposes.
Determination beats reason every time. Infocom solved it 40 years ago. >>>>
Indeed there are. What's bothering is the premise: 'Oh, but it should be
possible to use the forth interpreter for that'. Suddenly it becomes about >> forth proving itself rather than identifying the needs of the application. >> I'm sure cute things can be done with the forth interpreter. I just question
the priority.
In my ciasdis assembler a mnemonic ( LEA, ) change the state of the
system and the words understood/accepted are different.
Like wise GET should switch to a wordlist which contains items like
a SWORD and maybe items present in the location.
If you start with
1 CONSTANT SWORD
you're on the wrong road.
It is just that the most simple way is using the Forth interpreter.
You can map the game syntax first, otherwise you don't know what
you're doing.
A great example is the BASIC interpreter that goes back to Chuck
Moore (IIRC).
There are many reasons to do things. Their value is in the eye of the beholder. Your opinion - no matter how well founded - is only one of all possible (and evenBut that's not the point here, I guess. It's not about the adventure, it's >about the voyage.With all due respect, a game is only valuable, if it is worth playing.
About "can I do that". About learning. Not about "you've seen it all before".
You should not embark on a game unless you have a great idea.
(Except exercises.)
See games.html on my site below.
You're the second (or third) one converting it to Standard Forth. I did an attempt inFWIW here's a mostly working conversion to Standard Forth: https://pastebin.com/tR9gCP4E
BL PARSE-WORD is closely related to PARSE-NAME. It skips leading delimiters and is defined in 4tH as "OMIT PARSE". Since it's not standard, it's open to anyone to defineDue to PC problems will need to leave it to others to iron out remaining issues.SwiftForth crashing was due to 'BL PARSE-WORD' in DECODE.
Replace with: BL WORD COUNT
I had a quick look at venture.4th. While it uses the forthNot quite - because it can't. 4tH has NO interpreter, since it doesn't
interpreter, AFAICS it does so very minimally - something
that could be emulated without the quirks of forth?
But how do you stop the forth interpreter handling numbers :) Case-sensitivity, number handling etc IMO conspire to make it4tH features a lib (interprt.4th) that can be configured by pragmas
problematic for serious apps.
With all due respect, a game is only valuable, if it is worth playing.Well, may be it is time to tell you where VENTURE.4tH came from. It started its life published as a "type-in" program for the Spectrum 16K in some Sinclair magazine in the '80-ies. So I typed it in, played it - and I thought it was neat.
You should not embark on a game unless you have a great idea.
In article <td7a35$138s$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
On 12/08/2022 18:44, Kerr-Mudd, John wrote:
On Fri, 12 Aug 2022 12:02:19 +1000rather secondary
dxforth <dxforth@gmail.com> wrote:
On 12/08/2022 00:32, Zbig wrote:
It's much neater to do a table of course, but that's a bit harder. >>>>>>Maybe, but „the sword” — or, in general, the argument — is
here, ready for use,question. The primary question is: what if the player types TAKE instead >>>>>> of GET? And the answer is: an ABORT will be performed, ruining the game. >>>>>>
So yes, it is tempting to use Forth interpreter, which is already
Other text game adventure systems are available; It might be fun, but it's >>>> still wheel-reinventing.but it's not quite prepared for gaming purposes.
Determination beats reason every time. Infocom solved it 40 years ago. >>>>>
Indeed there are. What's bothering is the premise: 'Oh, but it should be >>> possible to use the forth interpreter for that'. Suddenly it becomes about >>> forth proving itself rather than identifying the needs of the application. >>> I'm sure cute things can be done with the forth interpreter. I just question
the priority.
In my ciasdis assembler a mnemonic ( LEA, ) change the state of the
system and the words understood/accepted are different.
Forth assemblers are a cheap and effective use of the forth interpreter.
They also come with many limitations and the user is warned it's easy to >screw-up. In short, you get what you pay for.
Like wise GET should switch to a wordlist which contains items like
a SWORD and maybe items present in the location.
If you start with
1 CONSTANT SWORD
you're on the wrong road.
It is just that the most simple way is using the Forth interpreter.
You can map the game syntax first, otherwise you don't know what
you're doing.
A great example is the BASIC interpreter that goes back to Chuck
Moore (IIRC).
His intention was to attract Forth users - not BASIC users :)
On Sunday, August 14, 2022 at 1:27:56 PM UTC+2, dxforth wrote:
I had a quick look at venture.4th. While it uses the forth
interpreter, AFAICS it does so very minimally - something
that could be emulated without the quirks of forth?
Not quite - because it can't. 4tH has NO interpreter, since it doesn't
have a REPL. It either compiles or executes. It doesn't interpret while compiling and it can't compile while executing. Those are completely separate.
...
A great example is the BASIC interpreter that goes back to Chuck
Moore (IIRC).
His intention was to attract Forth users - not BASIC users :)
...
The reference to the interpreter serves to draw attention to
techniques used there, not BASIC.
r 2dup r> scan 2swap 2 pick - ;
On 17/08/2022 02:26, Hans Bezemer wrote:Yes. At execution time, REFILL does just that - it reads a line
I see. OTOH it is using the WORD parser.
That can be replaced as follows. In my case it saves 16 KB -In 4tH you have a set runtime, which includes these words - so you
the difference between keeping
the forth compiler and discarding it.
See games.html on my site below.One interesting quote down there:
On Wednesday, August 17, 2022 at 2:40:04 AM UTC+2, dxforth wrote:
You're really twisting my arm here, but I can get it to run (partially)..
include lib/pickroll.4th
include lib/anscore.4th
include lib/scanskip.4th
include lib/row.4th
hide split
: split ( a u c -- a2 u2 a3 u3 )
r 2dup r> scan 2swap 2 pick - ;
2 array input2
: token ( -- a u )
input2 2@ bl skip bl split 2swap input2 2! ;
: decode ( x -- a n x' f) token rot 2 string-key row ;
: get-input ( -- u ) pad dup 32 accept tuck input2 2! ;
: command \ input a command
cr ." Command: " get-input 0= abort" User abort" cr
;
begin
command token type space token type
again
1. 2CONSTANT - I can get this to run, but I'll need the preprocessor for this one. But of an overkill if you ask me;
2. SPLIT - is usually part of SCANSKIP.4tH - so I have to "forget" about this one when importing SCAN;
3. INPUT - is a file modifier under 4tH (builtin), so a tiny name change is required. Can't forget a builtin word - or override it for that matter. You can only forget things in the symbol table;
4. DECODE - compiles, but running it is for another day.
What it tells me is that one needs to code for the forth one has. GettingOf course you should. And I think most people do that - given the loads of "special extensions" most people have (and use - even when publishing code here).
the best out of each system is better - and more enjoyable - than forcing systems to conform to a single mindset.
...
The only problem I feel I encounter over and over again are COMUS words. Let's face
it - almost EVERY Forth compiler supports them in one way or another. But hardcore
purists always complain "it's not standard" (which is technically correct) and since
they're not standardized their implementation (may) differ(s).
So people are always doubting "should I define them or not"? (as you did in your
code). Personally, I like conditional compilation (let the compiler figure it out), but
others don't. Anyway, they're kind of standard, but actually they aren't - so it's a
massive sh*tshow over and over again.
I'd like to see a "COMUS" wordset to settle it once and for all. The purist may disavow
the entire wordset if they prefer - nobody is obliged to include any wordset in their
specific implementation - but at least we got that stumbling block out of the way.
Leaving things in limbo simply doesn't work IMHO.
And correct me if I'm wrong - but we're the only language having that problem.
Never heard of "common C words" outside ANY standard, for example.
ecvt fcvt etc are COMUS words in C. Informally defined,
Luckily the 4tH specific words were fully explained inNo, I'm sorry. After I'd really exhausted all ideas how to turn a (4tH) :NONAME into a (4tH) CONSTANT, I created :TOKEN - which turned to be very easy to define in 4tH, but extremely difficult in ANS. So yeah - that's a thing conditional
the 4tH manual, along with their equivalent ANS behaviour. I had forgotten about Easy4th. Not that would it have helped in the case of :token
So it's more formal than COMUS, and the intention is that they shouldThe only way a standards committee is going to achieve that is by making
not be commonly used in future code.
On Saturday, August 20, 2022 at 7:51:58 AM UTC+2, dxforth wrote:
Luckily the 4tH specific words were fully explained in
the 4tH manual, along with their equivalent ANS behaviour. I had forgotten >> about Easy4th. Not that would it have helped in the case of :token
No, I'm sorry. After I'd really exhausted all ideas how to turn a (4tH) :NONAME
into a (4tH) CONSTANT, I created :TOKEN - which turned to be very easy to define in 4tH, but extremely difficult in ANS. So yeah - that's a thing conditional
compilation was designed to solve. If anyone's got any good ideas, I'm all for it.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 34:19:29 |
Calls: | 6,707 |
Files: | 12,239 |
Messages: | 5,353,328 |