Community

SCI Programming => SCI Syntax Help => Topic started by: Doan Sephim on June 11, 2019, 07:12:48 PM

Title: Where'd my buttons go (Sierra Script Conversion)
Post by: Doan Sephim on June 11, 2019, 07:12:48 PM
All Scripts are now converted and without error message, and yet...
See attachment
Here's the code I was using from the Controls Script:
Code: [Select]
(method (setSize &tmp [rect 4])
(TextSize @rect text font)
(= [rect rtBOTTOM] (+ [rect rtBOTTOM] 2))
(= [rect rtRIGHT] (+ [rect rtRIGHT] 2))
(= nsBottom (+ nsTop [rect rtBOTTOM]))
(= [rect rtRIGHT] (* (/ (+ [rect rtRIGHT] 15) 16) 16))
(= nsRight (+ [rect rtRIGHT] nsLeft))
)
(method (draw &tmp x y x2 y2 w h [rect 4])
; Calculate the areas
(= x2 (- nsRight 8))
(= y2 (- nsBottom 8))
(= w (- nsRight nsLeft))
(= h (- nsBottom nsTop))
(TextSize @rect text font)
; Draw the side borders
(for ( (= y (+ nsTop 8))) (< y y2)  ( (= y (+ y 8))) (DrawCel gWB 0 4 nsLeft y -1) (DrawCel gWB 0 6 x2 y -1))
; Draw the top and bottom borders
(for ( (= x (+ nsLeft 8))) (< x x2)  ( (= x (+ x 8))) (DrawCel gWB 0 5 x nsTop -1) (DrawCel gWB 0 7 x y2 -1))
; Draw the corners
(DrawCel gWB 0 0 nsLeft nsTop -1)
(DrawCel gWB 0 1 x2 nsTop -1)
(DrawCel gWB 0 2 nsLeft y2 -1)
(DrawCel gWB 0 3 x2 y2 -1)
; Draw the text
(Display
text
dsCOORD
(+ nsLeft (>> (- w [rect rtRIGHT]) 1))
(+ (+ nsTop (>> (- h [rect rtBOTTOM]) 1)) 1 dsCOLOR)
gWndColor
dsBACKGROUND
clTRANSPARENT
dsFONT
font
dsWIDTH
[rect
rtRIGHT]
)
)
Title: Re: Where'd my buttons go (Sierra Script Conversion)
Post by: lskovlun on June 11, 2019, 07:18:11 PM
Hard to say what that is without seeing any code... it seems clear that you must have modified something to get that effect? otherwise, copy the SYSWINDOW.SC file over from the template game (contains the Save class and friends..) and delete whatever file contains the converted class.
Title: Re: Where'd my buttons go (Sierra Script Conversion)
Post by: Doan Sephim on June 11, 2019, 07:34:09 PM
Hmm...no dice.
I'm also experiencing some strange behavior with my character changing region script...

Will tinker around a bit.

EDIT:
Got my text back, but lost my sweet custom button artwork. One step forward, One step back :)
This is with the following template code in the Controls script
Code: [Select]
(method (setSize &tmp [rect 4])
(TextSize @rect text font)
(= [rect rtBOTTOM] (+ [rect rtBOTTOM] 2))
(= [rect rtRIGHT] (+ [rect rtRIGHT] 2))
(= nsBottom (+ nsTop [rect rtBOTTOM]))
(= [rect rtRIGHT] (* (/ (+ [rect rtRIGHT] 15) 16) 16))
(= nsRight (+ [rect rtRIGHT] nsLeft))
)
Title: Re: Where'd my buttons go (Sierra Script Conversion)
Post by: Doan Sephim on June 11, 2019, 07:45:20 PM
Borders up, but smooshed...no text  :o
Hmmm...looks like the template did half the trick lol
Title: Re: Where'd my buttons go (Sierra Script Conversion)
Post by: Doan Sephim on June 11, 2019, 08:00:25 PM
Got 'em back!
Conversion misplaced a single parenthesis that threw the whole thing off.
I had this:
Code: [Select]
(Display
text
dsCOORD
(+ nsLeft (>> (- w [rect rtRIGHT]) 1))
(+ (+ nsTop (>> (- h [rect rtBOTTOM]) 1)) 1 dsCOLOR)
                        gWndColor
But I realized that it should have been this:
Code: [Select]
(Display
text
dsCOORD
(+ nsLeft (>> (- w [rect rtRIGHT]) 1))
(+ (+ nsTop (>> (- h [rect rtBOTTOM]) 1)) 1)
dsCOLOR
                        gWndColor
Title: Re: Where'd my buttons go (Sierra Script Conversion)
Post by: MusicallyInspired on June 11, 2019, 11:19:33 PM
Looks good!