state = 30;
nextstate = -1;
condition = gf(145,13) == 1 && party_has_item(214) == 0;
question = "I have no more flawless crystals to sell. (End this quest.)";
text1 = "Sage Angela looks disappointed, but nods anyway. _I understand. Please return, should you find more in your travels._";
state = 30;
nextstate = -1;
condition = gf(145,13) == 0 && party_has_item(214) > 0;
question = "Do you need any more flawless crystals?";
text1 = "A look of surprise appears on Sage Angela's face. _Yes! If you have more, I will gladly pay for them!_";
text3 = "(This quest is active again. if you wish to remove it from your journal, speak to the character who gave it, and ask them to terminate the agreement.)";
Talk node 45 reads more or less as follows: if the quest to collect flawless crystals is currently active (gf(145,13) == 1) and the party is not carrying any (party_has_item(214) == 0;), offer a conversation option to end the quest. If this option is selected, toggle the quest off (toggle_quest(61,3);), and - I assume - toggle a flag linked to the status of the quest (set_flag(145,13,0); off, as gf() (get flag?) cannot accept quest numbers as arguments. Thus, everything is neatly ended. The quest can only be switched off when none of the party members are carrying flawless crystals, and the relevant flag is toggled to make it appear to the game that the player is all done doing work for that character. As for talk node 46, it's roughly the same thing in reverse. If the quest-related flag is set to 0, and the party is carrying greater than zero flawless crystals, offer a conversation option to re-open the quest, and set the appropriate flag again. Problem is, while I have to assume the flag is set without issue, the quest will not re-open. Maybe there's some safeguard built into the game itself to prevent against that. If so, the best option would seem to be changing the quest-ending code so that that conversation option is only displayed once the best reward received from that quest is given. Problem there is in that case, I would like to make Sage Angela say "You've given me all I need". If this as() bit that appears in the original script is meant to make same-numbered strings appear only when they are given as an argument (as(2), to make text string 2 appear, for example), I could achieve that, but one way or the other, I will find some way of doing this. Ever since the second game (for there wasn't a quest log in the original Avernum), it has been a hindrance to be assigned quests that can never be completed.
As an aside to this, there's another curiosity to be found in Almaria's script. Upon trying to enter that area in the demo version of the game, the solider at the gate will say "I'm so sorry. This confuses me as much as it does you. According to this scroll, you are only allowed to wander in what is called the 'Demo.'", among other things. However, at the beginning of that talk node is a line which reads condition = gf(148,20) == 0 && gf(170,1) > 8 && registered() == FALSE;. Surely the demo limitation cannot be circumvented simply by modifying scripts. That seems too easy, and yet gf(148,20) seems to be linked only to whether or not the player has been granted access to Almaria before, and gf(170,1) appears to be related either to the player's reputation, or how many quests they have completed for Meryhew. All I can really say is that scripting is becoming more powerful by the moment, but I'm rapidly running out of moments today.
It is now ~1:20pm, and I want to head out at 1:30, so aside from one brief story about something that happened on the way home last night, that'll be it. As for the story, it goes that the walk was normal and quiet right up until I was almost at the house, then I heard a vehicle coming toward me (driving down the street the same direction I was walking), and when they passed by, they honked the horn. I jumped, and glared at them even though they probably couldn't see me, and then walked a couple steps more forward, needing only to cross the street, walk up the driveway, and head into the house. Just before I crossed the street though, I heard a woman yell "Do you need a ride?", but kind of like she was drunk, and I motioned across the street / tried to say "I'm just going over there", to no apparent avail. She asked again, so I tried gesturing / answering a second time, then some guy in the vehicle with her said "Stop yelling!", after which there was a brief pause, and then she said "Okay! Meow meow meow meow!", and I just hung my head a bit. It's another benefit to not taking rides from people I don't know, I guess.
At any rate, I'm off to the train station, and from there to London for the day. I am admittedly becoming kind of nervous now, but hopefully that'll pass. I want to have fun, and with all the places I have marked out to go to, that should be completely possible~