Community
SCI Programming => SCI Syntax Help => Topic started by: gumby on July 13, 2010, 07:04:58 PM
-
Is there any way to replace the title of the game with some other text? I'm specifically thinking about indicating what room the actor is currently in, so it would have to happen upon init of a room, I suppose.
-
Absolutely, I'll have to wait till I actually get online before I can post any code, but I'm pretty sure there's an example of doig this already online. I think I did something similar in larry 2 reloaded. check out the sci resources thread to get the link to the leisure suit larry 2 reloaded site and check out the main script. You should see where I randomly change the status. It will be something similar to that except use the room number as the variable instead of what I've got. Anyway I'll try to post some code tomorow that is more specific, but the larry reloaded code might give you some ideas for now.
-
Ok, I got it to work and it isn't to complex so I'm going to try and type it on my phone so here goes. The only changes you need to make will be in the main script. Start by scrolling down to the startRoom method. Somewhere in there add in
(SL:doit())That will cause the menu bars status line to be updated. Now we just want to change what the status line says so scroll down some more until you find the statusCode instance. There just change the game title to something like "Room # %d" and then after the gMaxScore add the name of the variable you want that %d to change into, in this case gRoomNumber.Format(param1 " Score: %d of %-3d Room # %d " gScore gMaxScore gRoomNumber)
-
Thanks for this. I've been wondering how to update the status line in real-time in case I ever started a KQ3 remake (which requires a timer on the status line). I knew how to alter it, but not update it constantly.
-
Of course to constantly update the status line, you would need to stick the (SL:doit()) inside of a doit method, either in the main script or the room script. I'm not sure how well the game (memory wise) would like to constantly rewrite the status bar, but theoretically...
-
Thanks, works perfectly. Previously, I was able to find the code in the main script responsible for displaying the status line, but wasn't sure how to make it update (I guess it's probably no different than updating the score). Thanks again.
-
Followup: Got this working exactly how I wanted it. I moved the
(SL:doit())
into the init method of the room scripts. Immediately prior to calling, I set a global variable with the room name and modified the output of the status line to utilize the variable. The only hiccup is that I had to initialize the global in the init method of the main script (to simply an empty string) because apparently the status line gets called prior to calling any room scripts.
-
Also, you would have to edit it back out of all scripts. If I got this right, you were trying more to display a room name (which I'm assuming you declare in each rooms script) rather than the actual room number. it would make sense that you would need to at least declare the variable in the main script since it itself makes a call to it in your status code bit. I'd be surprised if the script compiled without it.
-
Yep, I'm 'hard-coding' a local variable in the room scripts that holds the room name and right before calling the doit(), I set a global variable (that lives in the main script) setting it to the value of the room script local variable. I basically mirrored the gRoomNumber variable with a gRoomName variable in the main (which I set upon init() of the room) and then call the doit().