Community

SCI Programming => SCI Syntax Help => Topic started by: Doan Sephim on December 10, 2018, 09:10:10 PM

Title: Importing a Character (a la Quest for Glory)
Post by: Doan Sephim on December 10, 2018, 09:10:10 PM
How'd they do this? I assume it saved a file that contains values for certain variables, but what how would one accomplish actually importing this into another program?
Title: Re: Importing a Character (a la Quest for Glory)
Post by: MusicallyInspired on December 11, 2018, 09:16:56 AM
I doubt it's a standard SCI save file. I haven't looked into it at all, but my guess is it's more likely a completely custom format in byte code that they scripted the games to understand. AGDI's QFG2VGA remake (made in AGS) will also understand these files and produce a new one for use in QFG3 onward.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Kawa on December 11, 2018, 01:19:30 PM
True enough on being a custom format.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: OmerMor on December 11, 2018, 03:59:31 PM
I attached the original save and import scripts I could find.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Charles on December 17, 2018, 04:31:20 PM
It's interesting seeing these original scripts (especially since I think SCI Companion's decompiler has trouble decompiling those particular scripts).

I remember reading about one of the bugs in QFG2's exporting, related to one poor coder's misunderstanding of how boolean math works, but it's neat being able to see it in black and white.

Code: [Select]
;; Bits in svMiscEquip
(define  FINESWORD_BIT  $0001) ; fine sword
(define  FLAMESWORD_BIT $0002) ; flaming sword
(define  COMPASS_BIT    $0003) ; compass [NB, COMPASS_BIT == FINESWORD_BIT & FLAMESWORD_BIT]
(define  PIN_BIT        $0004) ; spahire pin
(define  LAMP_BIT       $0008) ; brass lamp
(define  TOKEN_BIT      $0010) ; EOF token
(define  GLASSES_BIT    $0020) ; X-Ray Glasses

; things transferred from "Quest for Glory 1"
(define  BABA_BIT       $0030) ; Flag set from QG1 [NB, BABA_BIT == TOKEN_BIT & GLASSES_BIT]
(define  SWORD_BIT      $0040) ; Sword
(define  CHAIN_BIT      $0080) ;
(define  PICK_BIT       $0100) ;
(define  TOOL_BIT       $0200) ;

I knew about the COMPASS_BIT, but the BABA_BIT is new to me.  It's interesting to see that the QFG3 import code also replicates the bug... I wonder if it just wasn't noticed as being wrong then. I imagine the AGD team had to leave that bug as is in QFG2VGA, because it's just too intwined to change, without breaking compatibility with QFG3/4.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: EricOakford on February 09, 2021, 12:34:39 PM
And here are my recreations of the QFG3 Import and CharSave scripts! It's interesting that the game saves your inventory and whether you bought the blackbird from the junk dealers, since QFG4 doesn't use those at all (as you start with no items).

EDIT 2/10/2021: The import and export scripts for QFG4 are here! Also, I slightly updated the QFG3 scripts.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Kawa on February 10, 2021, 11:01:12 AM
It's like Christmas in February.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Doan Sephim on February 10, 2021, 12:14:30 PM
It's like Christmas in February.
Agreed! I just wish I were capable of understanding more of this stuff.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Kawa on February 10, 2021, 02:11:22 PM
Agreed! I just wish I were capable of understanding more of this stuff.
That just means the code needs lots of comments!
Title: Re: Importing a Character (a la Quest for Glory)
Post by: lskovlun on February 10, 2021, 05:14:40 PM
That just means the code needs lots of comments!
And/or a design doc.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Kawa on February 10, 2021, 06:05:21 PM
And/or a design doc.
Imagine if the Coles followed in Lowe's footsteps and released the code for their games. There'd probably be either a fat document on hero importing, or a hefty comment block.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: OmerMor on February 11, 2021, 02:48:28 AM
Imagine if the Coles followed in Lowe's footsteps and released the code for their games. There'd probably be either a fat document on hero importing, or a hefty comment block.

Unfortunately the Coles didn't keep most of their code. I do have a few character import/export scripts. Have I not released them here somewhere?
Title: Re: Importing a Character (a la Quest for Glory)
Post by: OmerMor on February 11, 2021, 02:53:39 AM
Have I not released them here somewhere?

Nevermind. Here they are.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Kawa on February 11, 2021, 08:04:18 AM
Huh. Surprisingly small amount of green in QfG3 RIMPORT there...
Title: Re: Importing a Character (a la Quest for Glory)
Post by: lskovlun on February 11, 2021, 09:08:22 AM
Huh. Surprisingly small amount of green in QfG3 RIMPORT there...
I'm not sure what you mean there. But it's definitely not the latest version of that script; it doesn't use the message system at all, which the final one of course does.
and yes, I've seen those before. I can't believe I haven't noticed this until now.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: OmerMor on February 11, 2021, 10:21:13 AM
Huh. Surprisingly small amount of green in QfG3 RIMPORT there...
What green?

it's definitely not the latest version of that script; it doesn't use the message system at all, which the final one of course does.
That's correct. This is the qfg3 import script written during the qfg2 development time.
Title: Re: Importing a Character (a la Quest for Glory)
Post by: Kawa on February 11, 2021, 09:36:43 PM
I'm not sure what you mean there.
Comments. Often colorcoded in green.