Author Topic: Change 'title bar' within game  (Read 5632 times)

0 Members and 1 Guest are viewing this topic.

Offline gumby

Change 'title bar' within game
« 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.


In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Cloudee1

Re: Change 'title bar' within game
« Reply #1 on: July 13, 2010, 09:40:05 PM »
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.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline Cloudee1

Re: Change 'title bar' within game
« Reply #2 on: July 13, 2010, 10:43:33 PM »
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
Code: [Select]
(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.
Code: [Select]
Format(param1 " Score: %d of %-3d              Room # %d " gScore gMaxScore gRoomNumber)
« Last Edit: July 14, 2010, 03:47:39 PM by Cloudee1 »
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline MusicallyInspired

Re: Change 'title bar' within game
« Reply #3 on: July 14, 2010, 02:02:52 PM »
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.
Brass Lantern Prop Competition

Offline Cloudee1

Re: Change 'title bar' within game
« Reply #4 on: July 14, 2010, 07:47:50 PM »
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...
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline gumby

Re: Change 'title bar' within game
« Reply #5 on: July 14, 2010, 09:42:29 PM »
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.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline gumby

Re: Change 'title bar' within game
« Reply #6 on: July 15, 2010, 08:25:29 AM »
Followup:  Got this working exactly how I wanted it.  I moved the
Code: [Select]
(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.
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition

Offline Cloudee1

Re: Change 'title bar' within game
« Reply #7 on: July 15, 2010, 08:53:10 PM »
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.
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline gumby

Re: Change 'title bar' within game
« Reply #8 on: July 15, 2010, 09:23:25 PM »
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().
In the Great Underground Empire (Zork port in development)
Winter Break 2012 Rope Prop Competition


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

Page created in 0.046 seconds with 22 queries.