Author Topic: A bit confused with : and ? symbols in scripts after Props  (Read 678 times)

0 Members and 1 Guest are viewing this topic.

Offline L@Zar0

A bit confused with : and ? symbols in scripts after Props
« on: November 16, 2024, 10:16:54 AM »
Hi,

I'm very begginner with SCI, so, sorry if I ask very silly things. xD
I searched the wiki tutorials, and AFAIK a Prop with ':' or '?', the difference (as I understood) is for assign or read respectively.
But I don't know if from the point of view of SCI Compiler 3.0.1.7 is the same. For example, KQ5 CD Talkie version has (when decompiling):

Code: [Select]
(if (not (gTheIconBar curInvIcon?))
(gTheIconBar enable: (gTheIconBar useIconItem?))

This means that is reading the variable, right? If I use here ':', it would work the same way?

Thanks in advance.



Offline Kawa

Re: A bit confused with : and ? symbols in scripts after Props
« Reply #1 on: November 16, 2024, 10:32:01 AM »
Quick test indicates you're right.

Code: [Select]
; Identical
(Printf "picture is %d" (self picture?))
(Printf "picture is %d" (self picture:))

; Opposite is invalid
(self picture? 101)

Using '?' to request a property's value is good for readability.

Offline L@Zar0

Re: A bit confused with : and ? symbols in scripts after Props
« Reply #2 on: November 16, 2024, 12:05:12 PM »
Ok, thanks. This was going crazy for me. I'm looking the sci-scripts of sluicebox (I want to compare them with the decompiled part of the original game), and sluicebox scripts has not '?' (or at least I have not found any). So, I was not sure if they would work as they are.

In any case, I'm not sure if SCI Companion is outputting '?' when it wants to assign some value.

BTW, I assume you are the creator of updated kawa version of  SCI Companion 3.2.5, am I right? I tried to use that version with KQ5 CD, but when compiling some scripts the game breaks. I can use also 3.1.0.x version that other person did time ago.

Offline Kawa

Re: A bit confused with : and ? symbols in scripts after Props
« Reply #3 on: November 16, 2024, 12:13:45 PM »
You can't assign with ?, and no decompiler should emit such. But since requesting a value with : is valid, Sluicebox' decompiler is free to do so.

Offline L@Zar0

Re: A bit confused with : and ? symbols in scripts after Props
« Reply #4 on: November 16, 2024, 01:02:01 PM »
So, definitely, we can avoid '?' because ':' can be used for both things, can't we?

Offline Kawa

Re: A bit confused with : and ? symbols in scripts after Props
« Reply #5 on: November 16, 2024, 01:24:01 PM »
But you shouldn't because ? makes the intent of asking an object for a property's value more readable and clear.

Offline L@Zar0

Re: A bit confused with : and ? symbols in scripts after Props
« Reply #6 on: November 16, 2024, 01:31:16 PM »
Ok, I understand. Thanks a lot. I will try to understand the KQ5 CD sci code. I will try to check the viability to put text subtitles.
Maybe I have more questions in the future. I tried to do the intro speech+text (spanish), and this is the result but I can not put here links.

But I'm not sure if I did well the code and the most problematic was synchronizing the texts with the audio.
And it is a lot of work do all this, so I'm not sure yet if i will be able to continue.

Anyway, thanks again.
« Last Edit: November 16, 2024, 01:35:06 PM by L@Zar0 »


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.046 seconds with 22 queries.