Author Topic: Extract all `said` strings from scripts  (Read 470 times)

0 Members and 1 Guest are viewing this topic.

Offline ZvikaZ

Extract all `said` strings from scripts
« on: May 06, 2020, 06:20:03 AM »
It's related to my previous post, but it's actually a different topic - what I really need now is to extract all `said` strings.
That can be accomplished with SCICompanion's 'Find in Files' feature, but it leaves work to do.
For example, there are cases like:
Code: [Select]
(Said
         'get,explore,climb[<on,onto,up]/bone,android,protrusion[<metallic]'
)
which aren't found.

And anyway, the find in files give results like:
Code: [Select]
Main.sc: ((Said 'pump,backstage/shark,pass') (proc255_0 0 3) (= global200 1))While all I'm intereseted at is
Code: [Select]
'pump,backstage/shark,pass'
I can solve this, but again, I don't want to re-invent the wheel, if someone has already solved it...



Offline lskovlun

Re: Extract all `said` strings from scripts
« Reply #1 on: May 06, 2020, 06:32:48 AM »
I'd point you to scidisasm from the FreeSCI package which does this (it works through the script file block by block, so you'd get the said strings in a block of its own). You may be able to extract the files from here:

https://launchpad.net/ubuntu/trusty/+package/freesci

Offline lskovlun

Re: Extract all `said` strings from scripts
« Reply #2 on: May 06, 2020, 06:50:06 AM »
(I didn't think I'd be referring to old FreeSCI binary packages in 2020, let alone that there'd be one in Ubuntu Trusty - released in 2014 - and that it would work...)  ::)

Offline ZvikaZ

Re: Extract all `said` strings from scripts
« Reply #3 on: May 06, 2020, 07:25:35 AM »
(I didn't think I'd be referring to old FreeSCI binary packages in 2020, let alone that there'd be one in Ubuntu Trusty - released in 2014 - and that it would work...)  ::)

It's even worse than what you think ;-)
I tryed compiling it on my Centos7, but it complained.

Then I started an old Ubuntu12 VM I had, downloaded FreeSCI from Ubuntu store, but it seems to be without the tools.
So, I compiled here, assuming that with this Ubuntu things will be easier.
But got the same error :-(

Code: [Select]
bdfgname.c:50:1: error: conflicting types for 'getline'
/usr/include/stdio.h:675:20: note: previous declaration of 'getline' was here

I hacked a little SCI engine in ScummVM, but now I never imagined that I will try to fix problems in the original FreeSCI  ;D

EDIT
===
A simple change of 'getline' in that file to 'my_getline' fixed the problem.
Now I got the scidisasm working...
« Last Edit: May 06, 2020, 07:29:15 AM by ZvikaZ »

Offline ZvikaZ

Re: Extract all `said` strings from scripts
« Reply #4 on: May 06, 2020, 07:31:44 AM »
I'd point you to scidisasm from the FreeSCI package which does this (it works through the script file block by block, so you'd get the said strings in a block of its own). You may be able to extract the files from here:

https://launchpad.net/ubuntu/trusty/+package/freesci

It's working great!
Thanks

EDIT
===
For future reference, here's the complete guide:
1. Download FreeSCI source files from https://launchpad.net/ubuntu/trusty/+package/freesci
2. Compile
3. If it fails - just replace 'getline' in the failing file to 'my_getline'
4. Run 'src/tools/scidisasm' in the game's directory
5.
Code: [Select]
grep said * | grep lofsa | cut -f 2 -d ";" | cut -f 2 -d '"' | sort | uniq > said.txt
« Last Edit: May 06, 2020, 07:39:02 AM by ZvikaZ »

Offline lskovlun

Re: Extract all `said` strings from scripts
« Reply #5 on: May 06, 2020, 07:33:16 AM »
I wasn't being sarcastic. The package in Trusty worked for me. It was compiled statically and so ran easily. Building from source is another matter, but I think I actually tried a year or two ago, using my age old DARCS repository.

Offline lskovlun

Re: Extract all `said` strings from scripts
« Reply #6 on: May 06, 2020, 08:34:29 AM »
And I was thinking that parsing this part of the output would be easier:
Code: [Select]
; Obj type #4, offset 0x10b0, size 0x52:
.said
10b4: search , look , examine [ < at , around ] [ / room , area ] [ / !* ]
10d2: cast >
10d6: crawl , duck
10dc: use , force , pull , move
10e8: / wizard , dude
10ef: / frame , painting
10f6: / path , path
10fd: / staff

; Obj type #5, offset 0x1102, size 0x1c8:
.strings
1106: rm220
110c: Fire Wizard:
1119: Water Wizard:
1127: Earth Wizard:
1135: Air Wizard:
(etc.)

Offline ZvikaZ

Re: Extract all `said` strings from scripts
« Reply #7 on: May 06, 2020, 09:46:41 AM »
Well, I find it quicker to `grep` and choose specific line, rather than choose one block out of the file.
But I don't think that really matters...

Anyway, after another thought, I preferred the following Unix pipeline:
Code: [Select]
grep said *.script | grep lofsa > said_per_room.txt
Thus having all `Said`s in their context, it will be easier to translate.


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.101 seconds with 24 queries.