Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - robbo007

Pages: [1] 2 3 ... 8
1
SCI Syntax Help / Re: SCI0: Issues implementing Trite Phrase Menu item
« on: December 11, 2024, 07:13:22 AM »
Right solved.
I was not declaring my string1 correctly. Same problem as Kawa pointed out earlier. I needed to use [string1 40] in the local instead of what I was using string1.

From what I understand was going on here is its placing the gExpletive into string1 and it was not big enough to hold it hence the weirdness with the view naming error.

Code: [Select]
(Print  (Format @string1 029 47 gExpletive)
Thanks again everyone :)

2
SCI Syntax Help / Re: SCI0: Issues implementing Trite Phrase Menu item
« on: December 10, 2024, 12:56:04 PM »
Like I said, that would be [gExpletive 20] in SCI Companion. gExpletive = 20 defines one variable preset to the number value 20, which is entirely different, while [gExpletive 20] would define gExpletive and then add nineteen more blank slots until the next global variable, which means there's space for 40 characters.

Aha! I did not know that. Thanks Kawa :)

Its seemed to have resolved the expletive issue. No crashing between rooms any-more :)  But it has also created some bugs with the dying script when using the (Print  (Format @string1 029 47 gExpletive) leaving the room and coming back and trying to die it get some random text added to my view.  I need to troubleshoot it a little more.

Why does the sluicebox code not use this? It only declares it in the main.sc as a local gExpletiveBuffer and gExpletive.

3
SCI Syntax Help / Re: SCI0: Issues implementing Trite Phrase Menu item
« on: December 09, 2024, 01:02:49 PM »
Question. How is gExpletive defined to begin with?

In the LSL games, the trite phrase and expletive are specifically defined as 20 words/40 characters In SCI Companion, that'd be (local ... [gExpletive 20] ...).

(Edit: corrected, I misread the OG source)

I was looking at the original source and its defined in script 10. I see other comments in the code as you mentioned in the game.sh

 
Code: [Select]
       filthLevelBuffer 170 ;** NOTE: 30 characters long
expletiveBuffer 200 ;** NOTE: 40 characters long

Code: [Select]
(expletiveI
(GetInput (Format @string expletive) 38
{Enter your favorite expletive:})
(if ( > (StrLen @string) 4)
(Format expletive @string)
)
)

I define it in the menubar.sc:

Code: [Select]
(MENU_EXPLETIVE
(GetInput (Format @temp4 gExpletive) 38
{Enter your favorite expletive:}
)
(if (> (StrLen @temp4) 4)
(Format gExpletive @temp4)
)
)

I also have these in my main.sc
Code: [Select]
gExpletive
;This is used for the expletive menu
gExpletiveBuffer
;This is the buffer used for the expletive menu
gFilthLevelBuffer
;This is the buffer used for the filth level

I've tried adding = 20 to the gExpletive and gExpletiveBuffer but it still crashes. Its gotta be something with the character length as using something with 8 characters works.

290.sc
Code: [Select]
(= gExpletive
(Format @gExpletiveBuffer 290 0) ;%s
)
(Format @gFilthLevelBuffer 290 0) ;%s



4
SCI Syntax Help / Re: SCI0: Issues implementing Trite Phrase Menu item
« on: December 08, 2024, 01:23:52 PM »
Sluice's decompile has the menu item as switch 776. You define MENU_EXPLETIVE as $0309. 0x0309 is decimal 777, so presuming `^x is 776 this shouldn't trigger at all, right? You've said "If I use %s in my text file 290 1 it works but does not show a default Trite phrase when selecting it from the menu.".

Did you do that background? Pretty cool.

So if I define the @gExpletiveBuffer in room 290 to use a pre-filled text like
Code: [Select]
(= gExpletive (Format @gExpletiveBuffer 290 1)) ; "Have a nice day."  I get the crash on start up. (Attached picture)

If I define it to use the variable %s:
Code: [Select]
(= gExpletive
(Format @gExpletiveBuffer 290 0) ;%s
)

It does not crash on startup, you can enter in a expletive text and if calling the @gExpletiveBuffer in your roomscript you do get it printed on screen. When changing rooms it will crash if the number of characters entered into the expletive is more than 8.




5
SCI Syntax Help / Re: SCI0: Issues implementing Trite Phrase Menu item
« on: December 06, 2024, 12:33:47 PM »
As you guys mentioned in the other post this error seems to be similar. If I add the trite phrase via the menu it will then crash when I change rooms.



6
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: December 04, 2024, 12:47:14 PM »
Amazing guys that did the job.

So I've added the show_state script 797 to my main.sc but I dont really understand what's happening and why would I need to add something there? What is it doing and what is best practice here? Should I be adding other scripts here like my regions path script maybe? Does this free up heap space as I'm already skating on thin ice with that.

Code: [Select]
(method (startRoom roomNum)
(DisposeLoad
NULL
FILEIO_SCRIPT
JUMP_SCRIPT
EXTRA_SCRIPT
WINDOW_SCRIPT
TIMER_SCRIPT
FOLLOW_SCRIPT
REV_SCRIPT
DCICON_SCRIPT
DOOR_SCRIPT
AUTODOOR_SCRIPT
WANDER_SCRIPT
AVOID_SCRIPT
DPATH_SCRIPT
SHOW_STATE ;script 797
)
(DisposeScript DISPOSELOAD_SCRIPT)

7
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: December 04, 2024, 06:04:45 AM »
Right I've found the issue. I was using this script taken from LSL3 to check the changeState numbers to troubleshoot my changeState scripting. It displays the State number at the top of the screen in realtime. Any ideas why that causes the crash? Its a very handy little script.

I call this on my method for the peephole door changeState:

Code: [Select]
(method (changeState newState)
(ShowState self newState 1 2)
(switch (= state newState)

Code: [Select]
;;; Sierra Script 1.0 - (do not remove this comment)
;**
;** Logics for room 797 -- Just a showState procedure
;**
;** Leisure Suit Larry 4 - Never say Nontoonyt (AKA The Missing Floppies)
;**
;** Last Update: October 8th, 2024
;**
(script# 797)
(include sci.sh)
(include game.sh)
(use Main)

(public
ShowState 1
)
(procedure (TestFlag flag)
(return
(if (& [gFlagArray (/ flag 16)] (>> $8000 (mod flag 16))) 1 else 0)
)
)
(procedure (ShowState whatScript newState where color &tmp [str 33])
(if (and gDebugging (not (TestFlag 14)))
(if (< argc 2)
(= where 1)
)
(if (< argc 3)
(= color 7)
)
(Display
(Format @str 797 0 (whatScript name:) (whatScript state:) newState) ; "%s was state %d; is now state %d."
dsCOORD
1
(- (* 8 where) 7)
dsFONT
999
dsCOLOR
color
dsBACKGROUND
0
)
)
)

8
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: December 02, 2024, 06:14:30 AM »
OK, so this seems to be connected to the same issue as your earlier ego initialization problem (in the trite phrase thread). The debugger hits at a callb $1 instruction, which is the first instruction after the fault. callb $1 corresponds to (SetUpEgo), so the faulting instruction is one of the sends just before that line, which both send to gEgo. You can double-check by viewing the value of gEgo (global 0): In the debugger, press g then enter the number zero. The next input box after that lets you see the current value of global 0, and optionally to change it. I am guessing that gEgo is 0 at this point.

What did you do about the problem in the trite phrase thread?

You are right its gEgo is 0. Do you know why is it not picking up the changes I've made to main.sc ? Or is my syntax in main.sc wrong?
Regards,

9
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: November 29, 2024, 05:43:54 AM »
I think your onto something here. I did not fix the Trite phrase yet but it does the same thing when I add a trite phrase and change rooms.

My main.sc has the following line:
Code: [Select]
(User alterEgo: (= gEgo ego) blocks: 0 y: 150)
I can't seem to find the equivalent for adding this part: (= ego egoObj) or is it (= gEgo ego) ?




10
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: November 28, 2024, 05:46:41 PM »
Have you fixed those things I pointed out with your variable declarations? Because those could result in memory corruption if you got them to compile somehow. If this is not a corruption bug, we'd need to see one or both room init methods.

I removed the ones that we not valid and I'm only using:
Code: [Select]
(local
    messageCount
passwd = 1 ;this is the password variable used for the Ken sent me password in the Door_script.
)

The init for Lefty's bar has:

Code: [Select]
(script# 102)
(include sci.sh)
(include game.sh)
(use main)
(use controls)
(use cycle)
(use game)
(use feature)
(use obj)
(use inv)
(use door)
(use rm797) ;showState debugging changestates script

(public
rm102 0
)
(procedure (GetInput str maxLen prompt &tmp [temp0 4]) ;The GetInput procedure. Does not seem to load form Main.sc. Noting that 97 to 122 are 'a' to 'z', and 97-32='A'.
(if (Print (if (>= argc 3) prompt else {}) #edit str maxLen &rest)
(StrLen str)
)
)
(procedure (toUpper &tmp i ch) ; This procedure turns all text into caps when using toUpper and GetInput statements.
(for ((= i 0)) (= ch (StrAt @passwd i)) ((++ i))
(if (and (>= ch 97) (<= ch 122))
(StrAt @passwd i (- ch 32))
)
)
)

(enum ;** Pimp state values
OpenHole
AskForPasswd
GotPasswd
)
(local
    messageCount
passwd = 1 ;this is the password variable used for the Ken sent me password in the Door_script.
)

(define LEFTY_LEFT 150)
(define LEFTY_RIGHT 243)
(define LEFTY_CENTRE 192)
(define LEFTY_Y 109)

(define vRoom 102
)
(define lPicture 0)
(define lDoor 1)
(define lFan 2)
(define lJukebox 3)
(define lPerson 4)
(define lPerson1 5)
(define lPerson2 6)
(define lPerson3 7)
(define lPeepHole 8)


(instance rm102 of Rm
(properties
picture 102
north 0
east 0
south 0
west 0
)

(method (init)
(super init:)
(self setScript: RoomScript)
(switch gPreviousRoomNumber
)
(cond
((== gPreviousRoomNumber 101) (gEgo posn: 86 128 loop: 2)
)
((== gPreviousRoomNumber 103) (gEgo posn: 286 168 loop: 1)
)
(else
(gEgo posn: 155 170 loop: 3)
)
)
(SetUpEgo)
(gEgo init:)
(aPicture init:)
(aFan init:)
(aJukebox init:)
(aPerson init:)
(aPerson1 init:)
(aPerson2 init:)
(aPerson3 init:)
(aLefty init:)
(aPeepHole init:)
(if (== gPreviousRoomNumber 103) (aDoor init: close:) ;this checks to see where ego has come from and if come from room 103 it will then close the door after
else
(aDoor init:)
)
)
)

And outside Lefty's where it crashes:

Code: [Select]
(script# 106)
(include sci.sh)
(include game.sh)
(use main)
(use controls)
(use cycle)
(use game)
;(use AutoDoor)
(use feature)
(use obj)
(use inv)
(use door)
;(use jump)
;(use dpath)
(use Sound)

(public
rm106 0
)

(define vRoom 106
)
(define lSign 0)
(define lSign2 1)
(define lSign3 2)
(define lDoor   3)


(instance rm106 of Rm
(properties
picture 106
north 102
east 108
south 0
west 107
)

(method (init)
(super init:)
(SetDebug) ;This forced game into debug.
(self setScript: RoomScript)
(switch gPreviousRoomNumber
)
(cond
((== gPreviousRoomNumber 105) (gEgo posn: 283 152 loop: 2)
)
((== gPreviousRoomNumber 102) (gEgo posn: 134 158 loop: 2)
)
((== gPreviousRoomNumber 107) (gEgo posn: 12 166 loop: 0)
)
((== gPreviousRoomNumber 108) (gEgo posn: 309 165 loop: 1)
)
  (else
(gEgo posn: 134 162 loop: 2)

)
)
(SetUpEgo)
(gEgo init:)(gEgo view: 705)
;(aSign init:)
(aSign2 init:)
(aSign3 init:)
(aSign4 init:)
(if (== gPreviousRoomNumber 102) (aDoor init: close:)
else
(aDoor init:)
)
)
)

11
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: November 28, 2024, 09:36:36 AM »
After implementing the super-dupper "peephole" script I'm now getting some oddities.

When ego runs the "peephole" script and leaves that room and comes back in, then when trying to exit either to the north (Hall) or south (outside Lefty's) I get the following lock ups. This only seems to happen if the peephole script has initiated. If not initiated both exits work as they should do.

Code: [Select]
(instance aDoorScript of Script ;Peep hole script
(properties)
(method (handleEvent event)
(if (or (!= (event type:) evSAID) (event claimed:))
(return)
)
)

(method (changeState newState)
(ShowState self newState 1 2)
(switch (= state newState)
      (OpenHole ; Peep hole door opens
      (ProgramControl)
  (aPeepHole cycleSpeed: 1 setLoop: 8 setCycle: End self)
)
(AskForPasswd ;The pimp speaks to ego
(Print 102 1) ;"Yeah. Whatsda passwoid?"
(PlayerControl)
(GetInput @passwd 45 {"Whatsda passwoid?"})(toUpper)
(if (== STRINGS_EQUAL (StrCmp @passwd "KEN SENT ME")
)
(self changeState: GotPasswd)
else
(Print 102 4) ;"Scram, dog breath!"
(aPeepHole setCel: 0 stopUpd:)
(self dispose:)
)
)

(GotPasswd ;Got password speak friend and enter.
(gGame changeScore: 5)
(Print 102 5) ;"Come on in."
(aPeepHole setCel: 0 stopUpd:)
;(aDoor open:)
;(self dispose:)
(gRoom newRoom: 103)

)
)
)
)

12
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: November 26, 2024, 04:24:08 PM »
Amazing. Thanks guys. This seems to do the trick forcing it all to caps. :)

Code: [Select]
(method (changeState newState)
(ShowState self newState 1 2)
(switch (= state newState)
      (OpenHole ; Peep hole door opens
      ;(ProgramControl)
  (= peephole_open 0)
  (aPeepHole cycleSpeed: 1 setLoop: 8 setCycle: End self)
)
(AskForPasswd ;The pimp speaks to ego
(= seconds 20)
(Print 102 1) ;"Yeah. Whatsda passwoid?"
(GetInput @passwd 45 {Whatsda passwoid?})(toUpper)
(if (== STRINGS_EQUAL (StrCmp @passwd "KEN SENT ME")
)
(self changeState: GotPasswd)
else
(Print {Scram Butthead})
(aPeepHole setCel: 0 stopUpd:)
)
)

13
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: November 26, 2024, 09:59:03 AM »
Right this seems to work. Needs a little more work putting in delays etc.. But as Kawa mentioned its case sensitive. Doh. Is there any way around this using the GetInput command? To capture both Ken and ken when typed?

Code: [Select]
(method (changeState newState)
(ShowState self newState 1 2)
(switch (= state newState)
      (OpenHole ; Peep hole door opens
      ;(ProgramControl)
  (= peephole_open 0)
  (aPeepHole cycleSpeed: 1 setLoop: 8 setCycle: End self)
)
(AskForPasswd ;The pimp speaks to ego
(= seconds 20)
(Print 102 1) ;"Yeah. Whatsda passwoid?"
(GetInput @passwd 45 {Whatsda passwoid?})
(if (== STRINGS_EQUAL (StrCmp @passwd "Ken sent me"))
(self changeState: GotPasswd)
else
(Print {Scram Butthead})
(aPeepHole setCel: 0 stopUpd:)
)
)

(GotPasswd ;Got password speak friend and enter.
(Print {Testing if reaching new state})
(aPeepHole setCel: 0 stopUpd:)

)
)
)
)

14
SCI Syntax Help / Re: SCI0: Varibles and changestates
« on: November 24, 2024, 01:09:37 PM »
Hi,
Thanks for explaining a little more. I went back through the the LSL3 code to check how they used the enums. It seems a lot clearer when using them. Nice pointer. :)

So I was trying to use the StrCmp command to compare the GetInput text saved in the string @passwd matches but it does not seem to compare it. You can type anything in when prompted and it then moves to the GotPasswd changeState. Is it my syntax that is wrong? Or is there a simpler way to do it?

Code: [Select]
(enum ;** Pimp state values
OpenHole
AskForPasswd
GotPasswd
)
(local
    messageCount
peephole_open = 0
peephole_closed = 1
password = ken sent me
passwd
)

Code: [Select]
(method (handleEvent pEvent)
(super handleEvent: pEvent)
; handle Said's, etc...
(if (Said 'knock/door')
(if (& (gEgo onControl:) ctlBLUE)
(Print 102 0) ;You rap loudly on the naugahyde door. You wonder how many naugas had to give their all just to decorate this sleazehole.
(aDoorScript changeState: 0)

else
(PrintNotCloseEnough)
)
)
)

Code: [Select]
(instance aDoorScript of Script ;Peep hole script
(method (handleEvent event)
(if (or (!= (event type:) evSAID) (event claimed:))
(return)
)
)

(method (changeState newState)
(ShowState self newState 1 2)
(switch (= state newState)
      (OpenHole ; Peep hole door opens
      ;(ProgramControl)
  (= peephole_open 0)
  (aPeepHole cycleSpeed: 1 setLoop: 8 setCycle: End self)
)
(AskForPasswd ;The pimp speaks to ego
(= seconds 5)
(Print 102 1) ;"Yeah. Whatsda passwoid?"
(GetInput @passwd 45 {Whatsda passwoid?})
(if (== STRINGS_EQUAL (StrCmp @passwd "Ken send me"))
)
(self changeState: GotPasswd)
;;; else
;;; (Print {Scram Butthead})
;;; (aPeepHole setCel: 0 stopUpd:)
)
(GotPasswd ;Got password speak friend and enter.
(Print {Testing if reaching new state})
(aPeepHole setCel: 0 stopUpd:)

)
)
)
)

15
SCI Syntax Help / SCI0: Varibles and changestates
« on: November 21, 2024, 04:29:16 PM »
Hi guys,
I'm trying to create a script that mimics the LSL1 pimp door script in Lefty's Bar. I'm trying to understand what is the best approach.

Player types "knock on door", pimp replies "What's the password", player types password and its checked, if correct then opens door.

Would you use a variable to hold the text the player types in "ken sent me"? How do you then check this is the correct text entered against the variable?

When dealing with a script inside the RoomScript do you generally try and keep all the said statements inside that script? Or do you put the said statements in the RoomScript then declare the changeState you want to goto with that said statement ? I'm getting lost how to organise all my said statements and scripts in each room. What's the best approach?

Thanks,

Pages: [1] 2 3 ... 8

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

Page created in 0.032 seconds with 20 queries.