Cannot change room

Started by highkingtorygg, Sat 28/03/2015 02:40:53

Previous topic - Next topic

highkingtorygg

I am trying to get my protagonist to get to a new room, but I cannot get it to work. This is one of the many different ways I've tried to do it.
Code: ags

function hfencegate_Interact()
{
Donovan.ChangeRoomAutoPosition (2);
}


Anyways, I'm a novice to both AGS and coding, and a complete dumbass, so any help is appreciated.

highkingtorygg

I named the protagonist Donovan, in case that was misleading.

monkey0506

When you say that you named the protagonist Donovan, is Donovan actually selected as the player character? That is, in Donovan's Character tab in the editor, is the "This is the player character" box checked?

If so, does the function "hfencegate_Interact" actually appear in the Events pane (click the Lightning bolt icon in the Properties pane) of hfencegate?

If so, is the function executing? You can easily tell this by putting:

Code: ags
Display("CHANGING ROOMS....");


Just above the call to ChangeRoomAutoPosition.

If that isn't being called, could you post the on_mouse_click function from your GlobalScript, as well as tell us any templates or modules you may be using?

There's a lot of things to consider as to why this might not be working. ;)

Mandle

Don't characters need a lower-case c in front of their name to tell AGS that they are characters?

cDonovan?

highkingtorygg

Quote from: monkey_05_06 on Sat 28/03/2015 04:07:27
When you say that you named the protagonist Donovan, is Donovan actually selected as the player character? That is, in Donovan's Character tab in the editor, is the "This is the player character" box checked?

If so, does the function "hfencegate_Interact" actually appear in the Events pane (click the Lightning bolt icon in the Properties pane) of hfencegate?

If so, is the function executing? You can easily tell this by putting:

Code: ags
Display("CHANGING ROOMS....");


Just above the call to ChangeRoomAutoPosition.

If that isn't being called, could you post the on_mouse_click function from your GlobalScript, as well as tell us any templates or modules you may be using?

There's a lot of things to consider as to why this might not be working. ;)

The protagonist's script name is now cdonovan, "hfencegate_interact" is in the events pane, the function is executing, but I still cannot get it to work. I have a second room, all set up and everything. The global script for on_mouse_click is
Code: ags

function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
  {
  }
  else if (button == eMouseLeft) 
  {
    ProcessClick(mouse.x,mouse.y, mouse.Mode);
  }
  else // right-click, so cycle cursor
  {   
    mouse.SelectNextMode();
  }
}

AprilSkies

#5
post edited. I asked something u already answered to...

So is it executing? do you see the message "CHANGING ROOM..." ?

www.apemarina.altervista.org

Mandle

Quote from: highkingtorygg on Sat 28/03/2015 02:40:53
I am trying to get my protagonist to get to a new room, but I cannot get it to work. This is one of the many different ways I've tried to do it.
Code: ags

function hfencegate_Interact()
{
Donovan.ChangeRoomAutoPosition (2);
}


Anyways, I'm a novice to both AGS and coding, and a complete dumbass, so any help is appreciated.

I see that you changed the character's script name to cdonovan but did you also change this script to cdonovan?

As in:

Code: ags
cdonovan.ChangeRoomAutoPosition (2);


(Maybe also cDonovan would be a bit better for your own clarity in seperating character names from AGS code when you look at it later)

highkingtorygg

Quote from: Mandle on Sat 28/03/2015 13:12:31
Quote from: highkingtorygg on Sat 28/03/2015 02:40:53
I am trying to get my protagonist to get to a new room, but I cannot get it to work. This is one of the many different ways I've tried to do it.
Code: ags

function hfencegate_Interact()
{
Donovan.ChangeRoomAutoPosition (2);
}


Anyways, I'm a novice to both AGS and coding, and a complete dumbass, so any help is appreciated.

I see that you changed the character's script name to cdonovan but did you also change this script to cdonovan?

As in:

Code: ags
cdonovan.ChangeRoomAutoPosition (2);


(Maybe also cDonovan would be a bit better for your own clarity in seperating character names from AGS code when you look at it later)

I did

Mandle

#8
Quote from: AprilSkies on Sat 28/03/2015 12:38:41
post edited. I asked something u already answered to...

So is it executing? do you see the message "CHANGING ROOM..." ?

What about this more important question ^^

Which is based on this earlier post:

Quote from: monkey_05_06 on Sat 28/03/2015 04:07:27
is the function executing? You can easily tell this by putting:

Code: ags
Display("CHANGING ROOMS....");


Just above the call to ChangeRoomAutoPosition.

(Not trying to be an ass...We are really trying to track down the issue here)

highkingtorygg

Quote from: Mandle on Sat 28/03/2015 13:26:43
Quote from: AprilSkies on Sat 28/03/2015 12:38:41
post edited. I asked something u already answered to...

So is it executing? do you see the message "CHANGING ROOM..." ?

What about this more important question ^^

Which is based on this earlier post:

Quote from: monkey_05_06 on Sat 28/03/2015 04:07:27
is the function executing? You can easily tell this by putting:

Code: ags
Display("CHANGING ROOMS....");


Just above the call to ChangeRoomAutoPosition.

(Not trying to be an ass...We are really trying to track down the issue here)

It does display it, but then doesn't do anything until I click again, which causes it to quit and display the message: An internal error has occurred. Please note down the following information. Error: prepare_script: error -18 (no such function in script) trying to run 'room_Leave' (room 1)

Mandle

The reason nothing happens until you click again is because the Display message stays on the screen until you click...

So:

Error: prepare_script: error -18 (no such function in script) trying to run 'room_Leave' (room 1)

This is telling you that there is no such function as "room_Leave" in the script that controls room 1.

I don't know if you have such a function somewhere in Global Script or somewhere else but here AGS is telling you that it doesn't exist in the script for room 1.

Not to be rude here or anything but:

CLICK HERE FOR A STEP BY STEP TUTORIAL ON AGS

(It starts off really basic but gets in-depth on most of what you will ever need to know when making an AGS game if you watch through the series)

Seriously...I was also stumbling around in the dark until I found this tutorial series...

(Well, I'm still stumbling around in the dark but at least this series gave me a flashlight so I wouldn't get eaten by a gr...

Crimson Wizard

#11
Quote from: Mandle on Sat 28/03/2015 14:45:25
Error: prepare_script: error -18 (no such function in script) trying to run 'room_Leave' (room 1)

This is telling you that there is no such function as "room_Leave" in the script that controls room 1.

I don't know if you have such a function somewhere in Global Script or somewhere else but here AGS is telling you that it doesn't exist in the script for room 1.

This error means that you have this name "room_Leave" typed into Events pane ("Leaves room" line) of your room, while you don't have actual function inside room script.
Simply delete this text from the Events.

Also, I am guessing you were actually having this error from the very beginning? It is very important to tell about such things.


Quote from: Mandle on Sat 28/03/2015 06:18:45
Don't characters need a lower-case c in front of their name to tell AGS that they are characters?

cDonovan?
No, Mandle, "c" prefix is simply a convention, not a rule.

highkingtorygg

Quote from: Mandle on Sat 28/03/2015 14:45:25
The reason nothing happens until you click again is because the Display message stays on the screen until you click...

So:

Error: prepare_script: error -18 (no such function in script) trying to run 'room_Leave' (room 1)

This is telling you that there is no such function as "room_Leave" in the script that controls room 1.

I don't know if you have such a function somewhere in Global Script or somewhere else but here AGS is telling you that it doesn't exist in the script for room 1.

Not to be rude here or anything but:

CLICK HERE FOR A STEP BY STEP TUTORIAL ON AGS

(It starts off really basic but gets in-depth on most of what you will ever need to know when making an AGS game if you watch through the series)

Seriously...I was also stumbling around in the dark until I found this tutorial series...

(Well, I'm still stumbling around in the dark but at least this series gave me a flashlight so I wouldn't get eaten by a gr...

Thanks, and as i said, Im a dumbass

monkey0506

I'm a bit confused now...is this problem solved?

Also please don't quote the entire post you are responding to. We generally just quote specific portions of posts for emphasis. Quoting the entire post (especially when it's the post right above yours) is rather distracting.

highkingtorygg

the problem has not been solved yet

monkey0506

Okay. Let's start over.

1) What code do you currently have?
2) What results do you expect?
3) What results do you get? Include any error messages you might get as well.

Crimson Wizard

highkingtorygg , did you read my previous post? Did you try the solution? What happened next?
http://www.adventuregamestudio.co.uk/forums/index.php?topic=51925.msg636510226#msg636510226

Monsieur OUXX

I smells an Icey.

highkingtorygg, please try what Crimson Wizard said ^. And if it doesn't work, answer monkey's questions.
 

highkingtorygg

Okay. I'm of be confuse now because I tried it with the default game and it worked. So I don't know what went wrong, so screw it. I did what Crimson Wizard said to do, watched most of the youtube things. I'm just going to base it on the default game, instead of creating it from scratch.

Cassiebsg

@highkingtorygg : You shouldn't just settle for the default because it's the default, you should choose it because you wish for a Sierra interface... if you wish another interface, then choose another template (they are there to help you out). No need to use the Sierra template, if all you wish in your game is a simple one click button, or 2 mouse button (BASS template), or a LucasArts type of interface or....

So... choose what you wish, then pick up a template. Then start coding. ;)
There are those who believe that life here began out there...

SMF spam blocked by CleanTalk