Community

SCI Programming => SCI Syntax Help => Topic started by: richruss691 on April 06, 2020, 06:27:13 PM

Title: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 06, 2020, 06:27:13 PM
I am trying to add back into QFG1 VGA the troll's cave that they removed when they did the vga remake. I am still in the very early stages. I have art made and i have the room added and the pile of stuff placed. I can enter and leave the room with no problem. That's as far as i have gotten.

Right now the problem i am running into is with messages. When add a message other than the default look/do messages to either the room or the pile of stuff it doesn't work right. I've tinkered around a bit, sometimes it might show the look message for one but not the other. Sometimes it will only show the default messages. Sometimes weird glitches show up. The do messages are always only the default.

Anybody have any thoughts? Any help would be greatly appreciated.

Thanks
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Charles on April 08, 2020, 02:28:26 PM
That sounds like an awesome project.  I love the idea of fan-added content to the Sierra games.

I'm afraid I don't really have enough experience with the SCI1 games to help though.  But a couple questions come to mind, that might help others troubleshoot you:

Did you decompile QFG1VGA yourself, or download it from the Decompilation Archive (http://sciprogramming.com/community/index.php?topic=1793.msg12056#msg12056)?
Sometimes scripts won't decompile properly, and when you recompile them it could cause the weird glitches you're seeing.

Make sure you go to Tools-->Rebuild Resources, then delete all the external patch files (all the ###.hep, .src, .v56, etc -- if the game finds those, they'll overwrite any scripts embedded in resource.000, which may be your newly created ones)

What version of SCICompanion are you using?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 08, 2020, 10:07:00 PM
Thank you for your reply.

This is a project that I've been working on for a while, I'm trying to make the vga version more like the ega version. I started with a bunch of graphical mods and have just recently started script editing.

I decompiled the scripts myself but the two rooms I've changed so far have recompiled with no errors and so far seem to run the way they should, although more testing should be done.

One of the first things i did, before decompiling, was rebuild the resources then delete all the patches from the directory.

I started with version 3.0.1.7 and after i started having the problem i switched to version 3.1.0.3 which, as far as i could find, is the newest.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: OmerMor on April 09, 2020, 02:36:44 PM
This is a cool project! I hope you manage to accomplish it.

In 2015 I had a similar idea of expanding the ending scene in QFG1VGA to match the one in QFG1EGA: http://sciprogramming.com/community/index.php?topic=1522 (http://sciprogramming.com/community/index.php?topic=1522)
Most of the artwork assets are already there so it should not be too hard.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 10, 2020, 01:58:19 AM
Thanks, i hope i can finish it too!

I had forgotten just how different the two versions of the ending are. been too long since i've played the ega, i guess. lol. that is definitely something to add to the end of my list. thanks!
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 10, 2020, 11:34:30 AM
Just a small update on solving the problem with the messages in my new room.

they still don't work but i'm narrowing down the cause. in the messages section of the explorer, the messages for the new room have a status error:

Resource load failed

so that it clearly why the messages don't display. unfortunately i have no idea what could be causing that and i don't know how it could be related to the weird stuff i was seeing before.

if anyone has any ideas why the message resource might fail to load, i'd really like to hear them!

thanks
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 10, 2020, 11:11:35 PM
I have made some progress, sort of. I decided to start over using the scripts from the Decompilation Archive as mentioned by Charles. Thank you Charles.
I have not put in the enter or exit code for the new room because i know it works and i wanted to focus on the message problem.

so, here's what i'm looking at now: i can get the messages to display now but every other message on the list is ignored, so to get all the messages to display i have to double them up or use place holder messages that don't get used. its not ideal but at least i feel like i can move forward. Any ideas as to the cause or how to fix it would be appreciated.

And i almost forgot, a big thank you to EricOakford for posting that decompile. it looks like they did an enormous amout of work changing the variable names, etc. to names that make some kind of sense.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on April 11, 2020, 06:23:42 PM
I saw this before but never wished you luck. I love community made "mods" for Sierra games and the whole concept. This is a slightly less ambitious project than my own "Space Quest 1 VGA Retro" and "King's Quest 5 - No Dead Ends" 'MODs'. And yes, the decompilation archives are a gold mine! Following this!
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Charles on April 11, 2020, 08:45:07 PM
I donít think Eric has gotten enough praise for his work on the decimpilation archive. Iíve lost count of how many demos and full games heís decompiled into functional source code.
And the templates for brand new games in just about every significant flavor of SCI.

Is that KQV No Dead-Ends mod yours? Do you have a page for it? Thatís an ambitious project. The only thing good about that game (IMO) is the atmosphere. I think thatís the only reason the game is ever remembered fondly by anybody (myself included), because the voice acting is amateurish, and the puzzles are frustratingly illogical. Best of luck to you, if youíre trying to polish that one.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Collector on April 11, 2020, 08:52:38 PM
Could start adding pages to the Wiki for such projects.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on April 11, 2020, 11:00:14 PM
Thanks for the compliments. I really need to get back to that SQ1SCI decompile. After that is done, I'll go back and go over the QFG decompiles again.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 13, 2020, 09:37:54 PM
I appreciate the support, thanks. the project is making progress, though slower than i'd like. I've got massages for the walls and the pile of stuff and i've got the code to dig through the pile and add the loot to the inventory but now i'm running into another problem.

when you dig through the pile, it's set to display a message "you dig through pile, etc." then it checks to see if you've done it before. if you haven't, it puts the loot in your inventory, sets a flag, and displays a message "you got such and such loot." if you've already collected the loot it give the message "nothing more of value."

all of this works except that the first message " did through pile" pops up and immediately moves on to the next message, which ever it ends up being. i want it to wait for user input, i.e. a mouse click or enter key, what ever, before moving to the next message. anybody know how to make it do that? i'll post some code bellow.

Quote
(instance theLoot of Prop
   (properties
      view 118
      x 138
      y 160
      signal ignAct
      loop 0
      cel 0
      noun N_LOOT
      priority 09
   )

   (method (doVerb theVerb)
      (switch theVerb
         (V_DO
            (messager say: N_LOOT V_DO 0 1 self)
            (if (Btst tookLoot)
               (messager say: N_LOOT V_DO 0 5 self)
             else
                (ego setScript: robLoot)
            )
         )
         (V_LOOK
            (if (< LootLooked 1)
               (messager say: N_LOOT V_LOOK 0 1 self)
               (++ LootLooked)
            else
               (messager say: N_LOOT V_LOOK 0 3 self)
               (= LootLooked 0)
            )
         )
         (else
            (super doVerb: theVerb &rest)
         )
      )
   )
)

(instance robLoot of Script
   (properties)
   
   (method (changeState newState)
      (switch (= state newState)
         (0
            (messager say: N_LOOT V_DO 0 3 self)
            (ego get: iSilver 30)
            (ego get: iGold 5)
         )
         (1
            (Bset tookLoot)
         )
      )
   )
)

edit: I tried a (Wait 600) command which should make it wait 10 seconds but it gave a really inconsistent duration, anywhere from 2 seconds to 14 seconds. is there a way to make it wait for a mouse click/keyboard event instead of the timer? i tried dropping in evMOUSEKEYBOARD but it did nothing.

edit: I got it working. my code was not well structured. i tightened it up, now it works. lol
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 14, 2020, 03:38:52 PM
Now that that's sorted out, I guess its time to move on to the intimidating part. Time to add the Troll stuff!
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on April 14, 2020, 05:42:53 PM
Is that KQV No Dead-Ends mod yours? Do you have a page for it? Thatís an ambitious project. The only thing good about that game (IMO) is the atmosphere. I think thatís the only reason the game is ever remembered fondly by anybody (myself included), because the voice acting is amateurish, and the puzzles are frustratingly illogical. Best of luck to you, if youíre trying to polish that one.

No page for it yet, no. I was trying to get some substantial work done on it and get it to a semi-release stage. I've removed a lot of dead ends already. For instance, the staff never breaks to open the temple door until you have both the gold coin and the genie lamp (but you can still die by being stuck inside for taking so long). The cat will always chase the rat even if you don't save it in time (much like the NES version actually). I was making 3 separate patches for the floppy versions (EGA and VGA) and CD version. Acceptable results most of the time! Just gotta get back to it.

Sorry, don't want to derail the topic. I think I had another thread dedicated to it elsewhere on the forum though.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 15, 2020, 11:39:29 PM
These messages are becoming the bane of this project! I've been having trouble with displaying messages but I thought I'd figured out a way to work around the problem. If i made every other message blank and never tried to access those empty messages, things seemed to be working fine. Unfortunately, today i decided to display one of the look messages upon entering the room. It seems to display that message fine but when i try to look around the room with the cursor, some of the messages display correctly but some display wrong. The ones that are wrong show a seemingly arbitrary talker and a gibberish message, or sometimes they might error out saying no such message exists.

I really hope someone can offer some advice on this. Its getting pretty frustrating and i don't think i can continue the project if i can't reliably display messages.

any help is appreciated,
    thanks
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: MusicallyInspired on April 16, 2020, 02:17:32 AM
I can't be sure but from the sounds of it it seems like Companion is setup to deal with implementing Messages in a certain way and QFG1 works in a different way that doesn't agree with Companion. Or maybe it's a compile issue or something? Something getting corrupted maybe? 
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 16, 2020, 03:56:19 AM
It must be something like like that. its odd though, i've recompiled a few of the existing de-compiled scripts and they seem to handle it fine. i just cant figure what could be different.

is there another way i could approach the situation? i know sci0 used Text resources, are they still compatible with sci1.1? i looked it up in the scicompanion documentation and tried to use it like the example but i got a compilation error. either i did it wrong or its not compatible.

maybe i can just put the messages directly in the script. it wouldn't be pretty but it might work
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on April 16, 2020, 06:48:18 AM
SCICompanion's destruction of message resources in QFG1VGA and PQ1VGA is a known issue. I reported it here (https://github.com/icefallgames/SCICompanion/issues/22). Kawa took a look at it, and confirmed that this is the result of Companion not properly supporting the older message resources that this game uses.
Maybe once I finish my new and improved decompilation of the game, I could look into creating a patch to port the game to a newer version of the interpreter, bringing it in line with the Macintosh version from 1994. That could be difficult, though.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 16, 2020, 02:00:32 PM
Thank you very much EricOakford! valuable information! in the mean time, is there anything i can do to make my thing work? can i use Text resources? I tried but couldn't figure it out. maybe someone can help?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on April 16, 2020, 06:35:26 PM
You could use text resources, if you forewent all use of the Messager class.

The Narrator and Talker classes' say method should allow you to pass a string pointer and caller. SQ5 and the template game it's based on have a Messager::sayFormat method that'd let you do something like (gMessager sayFormat: 99 "There's nothing here." self), but QFG1 seems to be missing this. And it wouldn't let you specify a text resource tuple anyway, taking only straight string pointers so you couldn't do (gMessager say: 99 scriptNumber 4 self) and load text line #4 that way anyway.

Doesn't mean you can't write a local procedure to do it yourself in just that room.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 16, 2020, 07:52:56 PM
Thanks Kawa.
I don't mind leaving out messenger class. My new room has no one to talk to so i don't need talkers. all i need is something that will display, for instance, line 4 from text resource 118. Can you help me get something like that working? i couldn't figure it out from the documentation. i must be missing somthing obvious.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on April 17, 2020, 09:15:19 AM
Code: [Select]
(procedure (Narrate line caller &tmp [buffer 1000])
(GetFarText scriptNumber line @buffer)
(gNarrator say: line caller)
)

(procedure (Say who line caller &tmp talker [buffer 1000])
(GetFarText scriptNumber line @buffer)
(= talker (gMessager findTalker: who))
(talker say: line caller)
)


(Narrate 2 self) ; have Narrator say line 2 from this script's text resource and call back after.

(Say 99 2 self) ; same, because talker 99 is the Narrator.

Put it in the script for your new room. I won't guarantee this is at all correct, I hacked it together in an external text editor. I included a version that takes a talker # just in case you decide otherwise.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 17, 2020, 11:30:34 AM
Thank you Kawa, I very much appreciate you help.

I tried both versions of the code you posted. They both compile without error but neither one works, unfortunately.

 The one without Talker support kicks back the error "Msg 999: 22 0 0.2 not found" then the game stops responding to input, the cursor moves around but won't anything else, not even bring down the menu.

 The version with Talker support give the error "<Messager findTalker:> can't find talker" then the game crashes.

Any thoughts?

I'm sorry I can't figure these things out on my own. this is my first time coding SCI and if its not in the tutorial its gonna take me a while.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on April 17, 2020, 04:33:25 PM
Hmm. Okay. So clearly I either misunderstood the Narrator/Talker-level say method, or QFG's is just that different.


Fuck it, let's not be too damn smart.
Code: [Select]
(procedure (Narrate line caller &tmp [buffer 1000])
(GetFarText scriptNumber line @buffer)
(Print addText: @buffer init: caller)
)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 17, 2020, 06:38:16 PM
Thank you very much Kawa. it seems to be working quite well. soon i'll be able to move on to the part of the project i expected to be hard. lol

I do have one more question, for now. gMessager class by default displays the messages toword the top of the screen. this new Narrate procedure you have written displays at the middle of the screen. is it possible to modify the code so that it will disply toward the top?

Again, the help you've been is enormous, thank you
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on April 18, 2020, 03:20:17 AM
(Print addText: @buffer posn: -1 20 init: caller)

Replace the 20 as you like.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 18, 2020, 10:08:21 AM
Fantastic! Thank you so much! :)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on April 24, 2020, 12:33:59 AM
I just ran into something weird! I went to put the troll in my new room and it turned the entire background pic to black. I scratched my head for a few hours over it but did eventually manage to fix it. All the unused colors in the troll's pallet were set to used, and therefore showing as black. I changed them all to unused and it seems to have fixed the problem. i hope it doesn't creep into any other views.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on May 13, 2020, 07:41:30 PM
I've made some decent progress on this room now. The room now knows whether or not the troll is dead, the troll will fight you if he's not dead and you get too close to his pile of stuff, after the fight it returns you to the room and the troll falls over dead, and you can search his pile of stuff and only get treasure once. I am, however, seeing a problem with that last one.

If i hack a game save first thing so i can beat the troll right away, the first place i go it to the troll cave. I can get in and fight the troll in the first part of the cave, the part that existed in the release, and i can go to the new part of the cave and get the loot from the pile. No troll in that part, i can only get the loot once, works perfect. However, if i play longer before visiting the cave, it thinks the loot is already taken even when it's not. the rest of the room works as expected. It's as though the flag is being set at some other point in the game but that shouldn't be possible. It uses a global variable that I added myself that shouldn't be referenced anywhere else in the game.

I'll drop some code below. If anyone has any thoughts i'd like to hear them, please.

Quote
(instance robLoot of Script
   (properties)
   
   (method (changeState newState)
      (switch (= state newState)
         (0 ;N_LOOT
            (Narrate 13 self) ;dig through loot
         )
         (1
            (if (Btst digPile)
               (= rando (Random 15 16))
               (Narrate rando self) ;already got loot
            else
               (Narrate 14 self) ;get the loot
               (ego get: iSilver 30)
               (ego get: iGold 5)
               (Bset digPile)
            )
         )
      )
   )
)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: troflip on May 13, 2020, 08:16:11 PM
Where is digPile defined? Are you sure it's at a higher index than any other global flag?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on May 13, 2020, 09:02:57 PM
I defined it in script 000.

Quote
Are you sure it's at a higher index than any other global flag?

I don't know what that means so, no i'm not sure.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on May 14, 2020, 12:12:13 AM
I defined it in script 000.

Quote
Are you sure it's at a higher index than any other global flag?

I don't know what that means so, no i'm not sure.

That is, it's the last global in the list. But since this is a bit flag, you should probably have it be "SEARCHED_FRED_TREASURE" (the name I gave it in game.sh. If it's not there, make sure it's the last flag in the list!)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on May 14, 2020, 12:48:36 AM
thank you EricOakford for saving my bacon once again! "SEARCHED_FRED_TREASURE" seems to have fixed it, unless that flag gets triggered somewhere else. I can't think why it would though. digPile was at the end of the list, i wonder why it wasn't working.

thank you troflip for your input as well, it was helpful.

next on the agenda will be to make it so you can take fred's beard, then all that'll be left for this room is bells and whistles, i think.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on May 31, 2020, 09:29:07 PM
All of the necessary parts of my new room are in and appear to function properly, just needs a little polish maybe some bells and whistles and thorough testing then it'll be done. However, I've decided to take a break from this room for a while and focus on something else. The end credits sequence suggested by OmerMor.

As OmerMor suggested, it looked like it would be fairly easy to implement the fly-over as it seemed to be mostly already done. So I copied the necessary views from QfG ega as place holders and told the script to run the code that it bypasses in the official release. Of course, the code doesn't work right. Amongst other things, and currently my biggest concern, the fly-over begins but shortly into it the game crashes with one of those "you did something we didn't expect" errors. I don't know sci well enough to figure out much of that code block beyond moving the carpet around the screen, so i don't know even where to start with debugging this one. I got it to stop displaying the error message but now the game just stops doing anything and I have to "X" out of the game.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on June 01, 2020, 05:28:44 PM
Which oops code number is it?
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 01, 2020, 07:13:50 PM
looks like error 4
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: Kawa on June 02, 2020, 08:00:31 AM
That'd be "not an object".

What exactly isn't an object, I don't know. E_NOT_OBJECT may be raised by the Clone, DisposeClone, and RespondsTo kernel calls. More likely, it may also be raised by trying to send to something that's not an object, such as a null variable.

(Going off of SCI11 here, just in case.)
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 02, 2020, 11:16:14 AM
Thanks. That is at least a starting point. Let's see if i can follow it somewhere.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: EricOakford on June 02, 2020, 06:38:34 PM
I've put up a significantly updated decompilation of QFG1VGA here (https://github.com/EricOakford/SCI-Decompilation-Archive/tree/master/qfg1vga). It hasn't been tested yet.
Title: Re: Adding a room to Quest for Glory 1 (VGA)
Post by: richruss691 on June 02, 2020, 07:14:12 PM
awesome, thanks Eric