I’m too stupid for the simpliest things again. I have a book that you can examine and read. Whenever you type “examine spellbook” the game terminates and returns to the editor. I have no idea what’s going on. The code:
spellbook: Thing
name='spellbook'
vocabWords='spellbook'
location=me
flagged=nil
known=[
'blick' -> 0,
'gilgom' -> 0
]
dobjFor(Examine){
verify(){}
action(){
"Your spellbook depicts the spells you have learned.";
if(!flagged){
" It is currently empty.";
}
}
}
dobjFor(Read){
verify(){}
action(){
if(!flagged){
"Your spellbook is empty. What an unworthy enchanter you are!";
return;
}
"The following spells are written down in your spellbook:";
if(known['blick']==1) {"\bBLICK - See through black objects";}
if(known['gilgom']==1) {"\bGILGOM - Make things lighter";}
}
}
;
1.) What’s wrong?
2.) Being inexperienced with the TADS IDE, how can I determine which line in the source code causes the error?
I pasted the above code (unchanged) into a sample game and it ran fine. Meaning it is probably not related to that code snippet? I don’t run out of my editor, so I’m not sure about your failure mode. Do you get a stackdump when you run it standalone? Also, recommend compiling it with -source reflect to enable reflection services. That enhances stackdump info and gets me code lines during crashes.
As a style tip, you might make things more concise in adv3 by eliminating the dobjFor(Examine|Read) and instead provisioning desc and readDesc respectively. Ie
spellbook: Thing
name='spellbook'
vocabWords='spellbook'
location=me
flagged=nil
known=[
'blick' -> 0,
'gilgom' -> 0
]
desc = "Your spellbook depicts the spells you have learned.
<<unless flagged>>It is currently empty. <<end>>"
readDesc = "<<if flagged>>The following spells are written down
in your spellbook:
<<if known['blick']==1>>\bBLICK - See through black objects<<end>>
<<if known['gilgom']==1>>\bGILGOM - Make things lighter<<end>>
<<else>>Your spellbook is empty. What an unworthy enchanter
you are! <<end>>"
;
That probably won’t change your crash behavior though.
warning: just awake, is possible that what I have written below isn’t in proper english…
hold on… a major difference between adv3 and Adv3Lite is that dobjFor(Read) and readDesc in the former are part of the class Readable, and adv3 Thing don’t have this method and propriety, when in adv3Lite both method and propriety are part of Thing. (hence the custom dobjFor(Read) ), so I think that the concise adv3 version ought to have as first line
spellbook: Readable
Aside this, I concur with JJMcC that the issue is elsewhere, my wild guess is either in the handling of spell addition or of that flagged variable (I note that outside the spellbook object ought to be called as spellbook.flagged, for what can be of help)
Strange. I’m always using Ctrl+F5 in the editor to run the game, and there it crashes. I now tried the .t3 file in the debug folder, and hey, that doesn’t crash! Works for me for now as I can continue, but of course I’m still curious what crashes the game when I started it from the editor.
If it crashes from the editor but not from whatever terp is installed in your system, the next questions to ask include (a) what’s your OS, (b) have you downloaded and installed the most current version of Workbench, and (c) what version of adv3 are you compiling?
Void
This is a featureless void.
>version
version
TADS 3 Library version 3.1.3
T3 VM (mjr-T3) version 3.1.3
The “TADS 3 Library version” is the adv3 version, which is almost certainly going to be the same as the VM version (was there ever a point during active development of T3 when the versions were out of sync?).