Author Topic: Need help finding a tutorial -- Am I going crazy?  (Read 11538 times)

0 Members and 1 Guest are viewing this topic.

Offline claudehuggins

Need help finding a tutorial -- Am I going crazy?
« on: September 22, 2016, 11:58:21 PM »
Times like this make me wish there was a "?!" message icon.

I swear this is a tutorial/guide I saw somewhere. I don't know if it was on the forums, or the wiki, or what, but I can't find it for the life of me.

It was a guide on making an "exit message" (optionally, a randomly selected one) that appears in DOS upon exiting the game. The example given was the messages that pop up when you exit SQ6 to DOS, and the process involved putting all the messages you wanted in a text resource.

I know this tutorial/guide exists because I remember using it and showing off the results to my friends. Or did I hallucinate the whole thing? Or maybe I'm just tired and it was right here all along (I stayed up later than usual tonight to work on RoPreSto.)

Also, I'm sorry if this isn't in the right board. I couldn't think where else to put it, and as I mentioned before, I'm quite tired, so apologies if this post in general has a thousand horrible mistakes. I'll probably edit this heavily when I wake up tomorrow.


A while ago, at a block party I found myself socially trapped at, I thought to myself: I need a t-shirt that says, "I'd rather be programming".

Offline MusicallyInspired

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #1 on: September 23, 2016, 12:29:00 AM »
That...would be cool. Is that something that's part of the scripts at all I wonder or part of the interpreter?
Brass Lantern Prop Competition

Offline lskovlun


Offline Collector

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #3 on: September 23, 2016, 01:16:27 AM »
KQII Remake Pic

Offline claudehuggins

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #4 on: September 23, 2016, 08:46:49 AM »
lskovlun had it. Odd, could have sworn SQ6 was mentioned in the post... I know that game did something similar, so maybe that's what confused me.

Thank you!!

I was, however, mistaken in my remembering that it was for SCI0. Though, I can't think of any early SCI games that used this sort of feature, so I'm not sure what in the world gave me that assumption. Well, the important thing is I found the post I was looking for :)
« Last Edit: September 23, 2016, 08:52:37 AM by claudehuggins »
A while ago, at a block party I found myself socially trapped at, I thought to myself: I need a t-shirt that says, "I'd rather be programming".

Offline Cloudee1

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #5 on: September 23, 2016, 11:36:25 AM »
I accomplished this in the MenuBar script.

Scroll down to the MENU_QUIT case statement and add in anything that you want. In my case I always add in the "Visit SciProgramming.com" line. In this case here it is hardcoded in the script, but it would be just as easy to send it to a text resource instead.

Code: [Select]

(case MENU_QUIT  
(if(Print("Do you really want to quit?" #title "Quit" #font gDefaultFont #button " Quit " 1 #button " Oops " 0))
Print("Visit SciProgramming.com")
= gQuitGame TRUE
)
)

I can't remember if you can use the Random procedure in the print statement directly, but if so then assuming in this case text resource 100 lines 1,2,3,4 then change the sciprogramming line above to something like...

Code: [Select]
Print(100 Random(1 4))
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline OmerMor

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #6 on: September 23, 2016, 01:12:48 PM »
The kernel call was added in SCI version 1.001.071 (1993-01-15).

Offline Kawa

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #7 on: September 23, 2016, 01:13:07 PM »
Poor claude :D

Offline claudehuggins

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #8 on: September 23, 2016, 01:35:35 PM »
I accomplished this in the MenuBar script.

Scroll down to the MENU_QUIT case statement and add in anything that you want. In my case I always add in the "Visit SciProgramming.com" line. In this case here it is hardcoded in the script, but it would be just as easy to send it to a text resource instead.

Code: [Select]

(case MENU_QUIT  
(if(Print("Do you really want to quit?" #title "Quit" #font gDefaultFont #button " Quit " 1 #button " Oops " 0))
Print("Visit SciProgramming.com")
= gQuitGame TRUE
)
)

I can't remember if you can use the Random procedure in the print statement directly, but if so then assuming in this case text resource 100 lines 1,2,3,4 then change the sciprogramming line above to something like...

Code: [Select]
Print(100 Random(1 4))

Your method got me as close to what I wanted as I think I'm going to get with this version of SCI :P
And it doesn't seem like you can call the random procedure in this situation, but I'm sure I could find an albeit less-graceful way of doing it, or maybe a way for the print statement to take a variable...
But, all in all, it's solely aesthetic in the end. One will be plenty. :)
A while ago, at a block party I found myself socially trapped at, I thought to myself: I need a t-shirt that says, "I'd rather be programming".

Offline troflip

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #9 on: September 23, 2016, 01:44:23 PM »
Why wouldn't you be able to use Random in a Print statement?
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Cloudee1

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #10 on: September 23, 2016, 02:44:51 PM »
I had that inkling, but I really wasn't sure... you could always use a switch statement... but it's not very pretty

Code: [Select]
(case MENU_QUIT
  (if(Print("Do you really want to quit?" #title "Quit" #font gDefaultFont #button " Quit " 1 #button " Oops " 0))
    (switch(Random(0 3))
      (case 0 Print(100 1))
      (case 1 Print(100 2))
      (case 2 Print(100 3))
      (default Print(100 4))
    )// end switch
    = gQuitGame TRUE
  )//end if
)// end case
 
Or the best solution would be to create a variable to use

In the handle event method, add the new varable... your current variable list may look different than this, I am pulling up Manic's source code to copy from, but just add randomStatement to the end of whatever is listed in the var defines.

Code: [Select]
(method (handleEvent pEvent)
(var menuItem, hGauge, newSpeed, randomStatement)

Then in the case menu quit statement set the variable and use it.

Code: [Select]
(case MENU_QUIT
     = randomStatement Random(1 4)
     (if(Print("Do you really want to quit?" #title "Quit" #font gDefaultFont #button " Quit " 1 #button " Oops " 0))
          Print(100 randomStatement)
          = gQuitGame TRUE
     )
)

I can't think of any reason why this wouldn't work

* tested, works... you may need to adjust accordingly for Sierra syntax. As mentioned elsewhere, I have not yet made the change
« Last Edit: September 23, 2016, 03:01:22 PM by Cloudee1 »
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline troflip

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #11 on: September 23, 2016, 03:14:20 PM »
Random returns a value, and... you can obviously pass values to functions, so...

Code: [Select]
(MENU_QUIT
     (if (Print "Do you really want to quit?" #title "Quit" #font gDefaultFont #button " Quit " 1 #button " Oops " 0)
          (Print 100 (Random 1 4))
          (= gQuitGame TRUE)
     )
)
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline claudehuggins

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #12 on: September 23, 2016, 03:17:18 PM »
Random returns a value, and... you can obviously pass values to functions, so...

Code: [Select]
(MENU_QUIT
     (if (Print "Do you really want to quit?" #title "Quit" #font gDefaultFont #button " Quit " 1 #button " Oops " 0)
          (Print 100 (Random 1 4))
          (= gQuitGame TRUE)
     )
)
Okay, that's just bizarre...The first time I tried this, it didn't work, and that's why I said it didn't...but I tried it again just now, the exact same way, and it worked.
Weird.
Okay, glad that's handled, though! I thought it was a little odd that this would cause errors.
A while ago, at a block party I found myself socially trapped at, I thought to myself: I need a t-shirt that says, "I'd rather be programming".

Offline Cloudee1

Re: Need help finding a tutorial -- Am I going crazy?
« Reply #13 on: September 23, 2016, 03:19:24 PM »
Yeah Phil, you're right. This does work
Code: [Select]
Print(100 Random(1 4)) // Studio syntax

the differences in the syntax would be my guess why Claude thought it failed initially
Code: [Select]
(Print 100 (Random 1 4)) // Sierra syntax

That's my bad Claude for not pointing out at the time that I was using Studio syntax when I first posted the solution. Well if nothing else, you now have three ways to accomplish the same goal
« Last Edit: September 23, 2016, 03:24:02 PM by Cloudee1 »
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition


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

Page created in 0.038 seconds with 24 queries.