Author Topic: Bit of help with 3 Things  (Read 17149 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

Re: Bit of help with 3 Things
« Reply #15 on: June 07, 2007, 05:48:30 PM »
If you need it here's the syntax tree that's created from that script.
Brass Lantern Prop Competition

Offline Doan Sephim

Re: Bit of help with 3 Things
« Reply #16 on: June 07, 2007, 05:52:45 PM »
I PMed you with a redone script. I added an (if(sMenuStart) and I think I changed a few of the brackets...let me know if it works!

EDIT: OOPS!! I sent you the script prematurely. I was going over it again and found a problem. The way the code is the enter button will not do anything until sMenuStart is TRUE...you can replace the code with this slightly modified version:

Code: [Select]
(if (==(send pEvent:type)evKEYBOARD)
           
            (if(==(send pEvent:message)KEY_RETURN)
(if(sMenuStart)
            (if(sBegin)
                   (send gTheMusic:fade())
                   (send gRoom:newRoom(INITROOMS_SCRIPT))
                )(else
                    (if(sCont)
                        (send gGame:restore())
                    )(else
                       (if(sIntro)
                           = gIntro 1
                           (send gTheMusic:fade())
                           (send gRoom:newRoom(INITROOMS_SCRIPT))
                       )(else
                           (if(sCred)
                                = gCred 1
                               (send gTheMusic:fade())
                               (send gRoom:newRoom(INITROOMS_SCRIPT))
                           )
                       )
                    )
)
)(else
                (RoomScript:cue())
)
            )
)
« Last Edit: June 07, 2007, 06:01:32 PM by Doan Sephim »
Artificial Intelligence Competition

Offline troflip

Re: Bit of help with 3 Things
« Reply #17 on: June 07, 2007, 06:01:20 PM »
Procedure calls should have () at the end
Code: [Select]
(selectorZero)
Should be

Code: [Select]
selectorZero()
The former will not compile in SCI Companion.  Yes, it does compile in SCIStudio, but SCIStudio has incomprehensible grammar rules (not sure where you saw that style of calling functions Doan - I'm pretty sure Brian's tutorials never used it, nor is it used in the template game) .  The latter compiles fine in both and is consistent with usage in the template game and the tutorials.
« Last Edit: June 07, 2007, 06:03:54 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Bit of help with 3 Things
« Reply #18 on: June 07, 2007, 06:04:17 PM »
Thanks for that edit again, Doan. And thank you, troflip, that was my problem all along.

Also I'll ask again. I'm guessing the arrows won't control the menu selector in this script. How involved would the code have to be to implement that. I have an idea how it would work I'm just wondering what would be the most efficient way.
Brass Lantern Prop Competition

Offline Doan Sephim

Re: Bit of help with 3 Things
« Reply #19 on: June 07, 2007, 06:07:51 PM »
The script I posted allows for the arrows to select. All the code is there for the up and down arrows. You have put in code for left and right, so I am guessing that is what you are looking for. It's not very involved at all really...you just need a visual representation of which button is selected.

Troflip: thanks for the lesson in coding...I have no idea where I learned that really?! I am not a scripter (SCI was my first and only coding experience) and I did that from day one! oops!
« Last Edit: June 07, 2007, 06:14:52 PM by Doan Sephim »
Artificial Intelligence Competition

Offline MusicallyInspired

Re: Bit of help with 3 Things
« Reply #20 on: June 07, 2007, 07:03:21 PM »
I did see a bit of code that referenced your up and down procedures but they said Joystick not keyboard...will it work anyway?

Also a couple more errors I'm getting here. Firstly when I click on the "Continue Game" button it comes up with an error message that says "font.997 not found." and exits. I don't have any 997 numbers at all in my title script. I don't know what's going on there.

EDIT: I just discovered that it's not a title script error but there's actually an error in my save and restore classes apparently. F5 and F7 both give that font error when I press them in game. I've always had problems with the restore actually. It kept showing a "ctrl" character in the field box for the restore window for instance and I don't know why. Any idea how I can fix these font errors? I can't even find 997 in the SysWindow script. What's strange is I have a slightly earlier backup of my game and the save restore functions work fine. Although this did start happening after I was messing with cursors. But I put everything back to normal...I don't understand.

EDIT 2: I compiled the SysWindow script in SCI Studio and it suddenly works fine now. Strange. (I've been using SCI Companion exclusively all this time)

Secondly the mouse events. They work fine except for one thing. I have to click on them twice to get them to load. The first click puts the selector on the button and the second click loads whatever that button is supposed to be doing. Which is alright if that's the way it has to be, but I'm trying to make both happen simultaneously. I put the selector positioner code in both the "if" and the "else" but it still loads what the button does without moving the selector on top of the button. Here's my code. I've only so far altered the buttonBegin "if".

Code: [Select]
        (if(==(send pEvent:type())evMOUSEBUTTON)
            (if(sMenuStart)
                (if((> (send pEvent:x) (buttonBegin:nsLeft))and
                    (< (send pEvent:x) (buttonBegin:nsRight))and
                    (> (send pEvent:y) (buttonBegin:nsTop))and
                    (< (send pEvent:y) (buttonBegin:nsBottom)))
                    (if(sBegin)
                    (buttonSelect:posn(161 146))
                        (send gTheMusic:fade())
                        (send gRoom:newRoom(INITROOMS_SCRIPT))
                    )(else
                        selectorZero()
                    = sBegin 1
(buttonSelect:posn(161 146))
                    (send gTheMusic:fade())
                        (send gRoom:newRoom(INITROOMS_SCRIPT))
                        (send pEvent:claimed(TRUE))
                )
            )(else
                    (if((> (send pEvent:x) (buttonCont:nsLeft))and
                        (< (send pEvent:x) (buttonCont:nsRight))and
                    (> (send pEvent:y) (buttonCont:nsTop))and
                    (< (send pEvent:y) (buttonCont:nsBottom)))
                    (if(sCont)
                        (send gGame:restore())
                    )(else
                            (selectorZero())
                        = sCont 1
                        (buttonSelect:posn(161 165))
                        (send pEvent:claimed(TRUE))
                    )
                )(else
                        (if((> (send pEvent:x) (buttonCred:nsLeft))and
                            (< (send pEvent:x) (buttonCred:nsRight))and
                            (> (send pEvent:y) (buttonCred:nsTop))and
                            (< (send pEvent:y) (buttonCred:nsBottom)))
                            (if(sCred)
                                = gCred 1
                           (send gTheMusic:fade())
                           (send gRoom:newRoom(INITROOMS_SCRIPT))
                        )(else
                                (selectorZero())
                            = sCred 1
                            (buttonSelect:posn(58 165))
                            (send pEvent:claimed(TRUE))
                        )
                    )(else
                            (if((> (send pEvent:x) (buttonIntro:nsLeft))and
                                (< (send pEvent:x) (buttonIntro:nsRight))and
                                (> (send pEvent:y) (buttonIntro:nsTop))and
                            (< (send pEvent:y) (buttonIntro:nsBottom)))
                            (if(sIntro)
                                    = gIntro 1
                                (send gTheMusic:fade())
                                (send gRoom:newRoom(INITROOMS_SCRIPT))
                            )(else
                                    (selectorZero())
                                = sIntro 1
                                (buttonSelect:posn(58 146))
                                (send pEvent:claimed(TRUE))
                )
                            )
                        )
                    )
)
)(else
                (RoomScript:cue())
                (RoomScript:cue())
            )
Also, what exactly does "(send pEvent:claimed(TRUE))" do in this script?

Also one other thing. To make the Introduction and Credits buttons work the right way I assumed there'd need to be global variables enabled (which I've named gIntro and gCred) before the "(send gRoom:newRoom(INITROOMS_SCRIPT))" line is executed. But there'd have to be something somewhere else that would catch this and tell the game where to go. Would that be in the InitRooms script? Like a "(if (gIntro)...<do something>)(else (if gCred)....<do something>))(else <do normally>))"  kinda thing?
« Last Edit: June 07, 2007, 07:58:46 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline Doan Sephim

Re: Bit of help with 3 Things
« Reply #21 on: June 07, 2007, 08:07:21 PM »
Don't worry about it saying "Joystick" it will work just the same.

You do have to double-click...I did that merely for my game, you don't have to do that for yours. In fact, it would be less coding for single-click...you would just have to take out some code.

You wouldn't need to have a global variable and then go to initrooms, you could simply tell the game, when clicked on credits to go to that particular room:
Code: [Select]
(send gRoom:newRoom(900)) or whatever number room it would be.

I have no idea what
Code: [Select]
(send pEvent:claimed(TRUE)) really does, I just have it there because I borrowed some of this code from Cloudee1 and it was in his...sorry


Offline MusicallyInspired

Re: Bit of help with 3 Things
« Reply #22 on: June 07, 2007, 08:26:14 PM »
You do have to double-click...I did that merely for my game, you don't have to do that for yours. In fact, it would be less coding for single-click...you would just have to take out some code.
Would you be willing to show me which code? I've been messing with it for a while now and I still can't figure it out. Not with the selector landing on the button you click, anyway.

Quote
You wouldn't need to have a global variable and then go to initrooms, you could simply tell the game, when clicked on credits to go to that particular room:
Code: [Select]
(send gRoom:newRoom(900)) or whatever number room it would be.
Ah nice! Thank you for that!

Quote
I have no idea what
Code: [Select]
(send pEvent:claimed(TRUE)) really does, I just have it there because I borrowed some of this code from Cloudee1 and it was in his...sorry
I see. Well I'll just leave it there just in case, then.

My title screen is just about finished now. I just need to get that double-click issue sorted out. One last thing. I have these sparkles animating on the title. Right now they're only animating forwards and looping. How do I get it to loop forwards then backwards and loop that way?
« Last Edit: June 07, 2007, 08:29:45 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline troflip

Re: Bit of help with 3 Things
« Reply #23 on: June 07, 2007, 08:52:36 PM »
EDIT 2: I compiled the SysWindow script in SCI Studio and it suddenly works fine now. Strange. (I've been using SCI Companion exclusively all this time)

Uh oh.  What version of SCI Companion do you have?
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Bit of help with 3 Things
« Reply #24 on: June 07, 2007, 08:55:21 PM »
Version 2.1.0.4. Is that the latest version? When I tried compiling it in SCI Companion (all I changed was removing a couple of "//" in front of valid code parameters) it gave errors for using the "self" command or something if that means anything to you.
« Last Edit: June 07, 2007, 08:57:16 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline Doan Sephim

Re: Bit of help with 3 Things
« Reply #25 on: June 07, 2007, 09:30:15 PM »
Would you be willing to show me which code? I've been messing with it for a while now and I still can't figure it out. Not with the selector landing on the button you click, anyway.

Are you saying you want to click on the button, have the selector animate on the button for a split second and then move on to whatever the actual button does? If so, I would create something like this:
Code: [Select]
(instance buttonPress of Script
    (properties)
    (method (changeState newState)
        = state newState
        (switch (state)
            (case 2 = cycles 3
                  (code where the selector animates on the given button)
            (case 3
                  (code that does what the button says)
            )
         )
     )
)

To get this instance to work you have to do a couple things:
(1) on any one of your views that you have initialized, you need to add "setScript(buttonPress)" like:
Code: [Select]
(theThrone:init()setScript(buttonPress))This will make it so the instance is recognized.

(2)Then, wherever you have the click code you put in this: (buttonPress:changeState(2)), which will tell the script to run that code, send you to 3 cycles of the selector landing on the particular button, and then going on to run whatever that button does.

If you do this, you will have to do some re-working on your code. You should be able to figure it out though.

Quote
My title screen is just about finished now. I just need to get that double-click issue sorted out. One last thing. I have these sparkles animating on the title. Right now they're only animating forwards and looping. How do I get it to loop forwards then backwards and loop that way?

easiest way I think is to just make the view to shimmer out and back in again. But if you want it to shimmer out and in, and then wait a moment, you would have to do something like what I just showed you in creating another changeState instance that controls them...you should be able to find out how that works from what I described...but if you have questions, I will try to answer them.
« Last Edit: June 07, 2007, 09:32:39 PM by Doan Sephim »
Artificial Intelligence Competition

Offline troflip

Re: Bit of help with 3 Things
« Reply #26 on: June 07, 2007, 09:32:27 PM »
Version 2.1.0.4. Is that the latest version? When I tried compiling it in SCI Companion (all I changed was removing a couple of "//" in front of valid code parameters) it gave errors for using the "self" command or something if that means anything to you.

That's the latest version.

The error means nothing unless I know the exact error and see the code.  It would be great if people would file bug reports when they think they see bugs (you can do this from the Help menu).
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Bit of help with 3 Things
« Reply #27 on: June 07, 2007, 10:09:21 PM »
I've recreated the instance and emailed you the error message.

Thanks, Doan I'll look into altering the code for that.

Quote
easiest way I think is to just make the view to shimmer out and back in again. But if you want it to shimmer out and in, and then wait a moment, you would have to do something like what I just showed you in creating another changeState instance that controls them...you should be able to find out how that works from what I described...but if you have questions, I will try to answer them.
There's no way to just animate the cels in a loop forwards and then backwards?
« Last Edit: June 07, 2007, 10:11:51 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline Doan Sephim

Re: Bit of help with 3 Things
« Reply #28 on: June 07, 2007, 10:19:26 PM »
There is a way to make the view go backward...but the problem is you have to tell it to go backward. So to make it so you can tell it to do so, you have to make a changeState instance so that you can tell it do go backward after going forward, and then you have it cycle...it would look something like this:
Code: [Select]
(instance shimmerScript of Script
    (properties)
    (method (changeState newState)
        = state newState
        (switch (state)
            )(case 1 = cycles 20 // (or however many cycles it takes)
                 (shimmer:setCycle(End))
            )(case 2 = cycles 20
                 (shimmer:setCycle(Beg))
            )(case 3
                 (shimmerScript:changeState(1)) // make it all loop around forever!
            )
         )
    )
)

Then of course you have to have setScript(shimmerScript) in one of you instances...and then when you want the shimmering to begin: (shimmerScript:changeState(1))

Offline MusicallyInspired

Re: Bit of help with 3 Things
« Reply #29 on: June 07, 2007, 11:04:36 PM »
Doan, my friend, you've been awesome. Thanks so much for your help! My title screen is now complete! I probably won't bother doing that shimmer thing, though, I'll save it and keep it in mind for the future. I've done enough work already and it already looks nice enough.

I'll upload a demo of the title screen a little later on so you guys can check it out. Tell me if you notice anything offhand that differs in any way from KQ1SCI's menu ;).
Brass Lantern Prop Competition


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

Page created in 0.053 seconds with 23 queries.