Author Topic: Tried to set view, but it is not showing [SOLVED]  (Read 279 times)

Hi Guys,

I wanted to add an animated object to a room. So I created the obejct oLight. I made a view, tried the preview and its working.

I added this to the room script:

function room_Load()
{
oLight.SetView(3);
}

function room_AfterFadeIn()
{
oLight.Animate(0, 5, eRepeat,  eNoBlock);
}

But when I start the game, it is still showing the cup image and not the view. If I rightclick on view 3 and search for usages it finds no usage..
Am I missing something obvious? Thanks for any helpful comments :)
« Last Edit: 25 Nov 2019, 19:24 by Racoon »

Snarky

  • Global Moderator
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: Tried to set view, but it is not showing
« Reply #1 on: 19 Nov 2019, 00:14 »
For event handlers that are supposed to be called automatically when certain things happen, you can't just add them to the script, you have to link them up in the room event properties pane.

Re: Tried to set view, but it is not showing
« Reply #2 on: 19 Nov 2019, 00:44 »
Hey Snarky,

Thanks for your reply! Sorry, but can you describe what you mean with link them up? I did go to the room events in the properties and put it in the room script there. Do you mean something else?
 

Cassiebsg

  • Cavefish
  • Fleeing the Cylon tyrrany...
    • Cassiebsg worked on one or more games that won an AGS Award!
    •  
    • Cassiebsg worked on one or more games that was nominated for an AGS Award!
Re: Tried to set view, but it is not showing
« Reply #3 on: 19 Nov 2019, 01:54 »
Did you type it or did you click the ... button? Try clicking the button, if it doesn't take you to the start of the corresponding function check the that the names are exactly the same. Best way to fix this, if it's the problem, is to delete one of them and copy/paste the name of the other.
There are those who believe that life here began out there...

Khris

  • partook in silencing a crtitc despite facts
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
Re: Tried to set view, but it is not showing
« Reply #4 on: 19 Nov 2019, 04:22 »
Add a Display() call, like this:

Code: [Select]
function room_AfterFadeIn()
{
  Display("AfterFadeIn called");
  oLight.Animate(0, 5, eRepeat,  eNoBlock);
}

Do you see that in-game?
Fail at Floaty Rog' now!  still having to deal with what games are going through

Re: Tried to set view, but it is not showing
« Reply #5 on: 19 Nov 2019, 06:27 »
As an additional note -

If I rightclick on view 3 and search for usages it finds no usage.

this won't show any usage if you are setting this view in script, only if you have a view set from the beginning in the editor, which currently is only possible with characters. So, this command has a limited purpose.

Re: Tried to set view, but it is not showing
« Reply #6 on: 19 Nov 2019, 11:27 »
Okay, I know get what you mean with, that I cant just put it in the script. I finally got it working, yay. Its difficult as a beginner to figure some of these things out. Thanks everyone  :-D

Khris

  • partook in silencing a crtitc despite facts
    • Lifetime Achievement Award Winner
    • I can help with play testing
    • I can help with scripting
    • I can help with translating
    • Khris worked on one or more games that was nominated for an AGS Award!
Re: Tried to set view, but it is not showing
« Reply #7 on: 19 Nov 2019, 13:00 »
For reference, in case somebody else finds this thread, what did you do to fix it?
Fail at Floaty Rog' now!  still having to deal with what games are going through

Re: Tried to set view, but it is not showing
« Reply #8 on: 19 Nov 2019, 19:32 »
My mistake was, that I found the script for an animated object on the forums and thought it would just do to copy it to the room script. But for it to work you have to go to the room properties and for example if you want to use "room_AfterFadeIn" you have to click on the "..." next to "Enters room after fade-in" for the function to work.

Slasher

  • slasher
    • I can help with AGS tutoring
    • Lifetime Achievement Award Winner
    • I can help with scripting
    • I can help with story design
    • Slasher worked on one or more games that won an AGS Award!
    •  
    • Slasher worked on one or more games that was nominated for an AGS Award!
Re: Tried to set view, but it is not showing
« Reply #9 on: 19 Nov 2019, 19:50 »
That's a mistake many many people do...

Glad it's sorted ;)