HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: [Solved] FPS Camera Callback "Script Error"  (Read 2049 times)

rjhanes

  • General Accounts
  • *
  • Posts: 16
    • View Profile
[Solved] FPS Camera Callback "Script Error"
« on: Jul 22, 16, 07:07:19 PM »

Hello, HE community I am having an issue for the FPS Camera I have followed the entire Tutorial and every time I put this command in the console "call fps_camera_callback startfps_camera." I receive a script error and the camera does change its viewport. This is the script error: SCRIPT ERROR: Function [STARTFPS_CAMERA.] not found in script [FPS_Camera_Callback]. I am not sure what to do and I figured someone else would know if I did something wrong here. I made a new script with this code:

 function PushAndActivateFPS_CameraLayer()
  PushCmdLayer("FPS_Camera")
  ActivateCmdLayer("FPS_Camera", true)
.
 
function DeactivateFPS_CameraLayer()
  ActivateCmdLayer("FPS_Camera",false)
  ActivateCamera( "GAME" )
.
 
function SetupFPS_Camera()
  camera as NodeRef = AddCamera("FPS_Camera")
 
  character as NodeRef = GetPlayerCharacterNode()
  character_position as Vector3
  GetNodePosition( character, character_position )
  SetCameraPosition( "FPS_Camera", character_position )
  character["Render"] = false
 
  SetCameraFollow( "FPS_Camera",character )
  SetCameraOffset( "FPS_Camera", 0.0 )
  FreeLook( "FPS_Camera", true )
  ActivateCamera( "FPS_Camera")
.
 
function onmouseleaveviewport()
  println("Left viewport in fps_camera")
.
 
function OnMouseClick(lmb as Boolean, rmb as Boolean, mmb as Boolean, mb4 as Boolean, mb5 as Boolean) as Boolean
  println("Click")
  return false
.
 
function onMouseMove(mx as Integer, my as Integer, dx copies Integer, dy copies Integer) as Boolean
  println("Moving the mouse")
  if (GetTweakableBoolean("GameInvertMouseX")) or $INPUT._InputGameInvertMouseX
    dx = dx * -1
  .
  if (not GetTweakableBoolean("GameInvertMouseY")) and ( not $INPUT._InputGameInvertMouseY )
    dy = dy * -1
  .
 
  fx as Float = dx
  fy as Float = dy * -1
 
  if $INPUT._InputGameMouseSensitivity > 0
    fx = fx * $INPUT._InputGameMouseSensitivity
    fy = fy * $INPUT._InputGameMouseSensitivity
  .
  camera as NodeRef = GetActiveCamera()
  RotateNode(camera,fy,fx,0)
 
  return true
.
 
 
 
function StartFPS_Camera()
  PushAndActivateFPS_CameraLayer()
  SetupFPS_Camera()
.

Again I have no idea what I did wrong in the script for the console to give me this error and not change my viewport.
« Last Edit: Jul 22, 16, 09:48:25 PM by rjhanes »
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: FPS Camera Callback "Script Error"
« Reply #1 on: Jul 22, 16, 09:31:48 PM »

Hello rjhanes,

Lets take a look, first off, I need you to make sure that the error you posted:

Quote
SCRIPT ERROR: Function [STARTFPS_CAMERA.] not found in script [FPS_Camera_Callback]

is exactly what the console prints out.

Reason being is this:

Quote
Function [STARTFPS_CAMERA.]

The "." period after CAMERA should not appear in the error printout unless perhaps you typed it rather than copy/pasted the error in your post.  Otherwise, is it possible you entered the period into your console command?

your console command should read as follows:

call fps_camera_callback startfps_camera

as you correctly noted above in quotes.  That might seem silly to consider, but in order to check it out, need to verify even the simplest of possiblities first :D

Next, double check to make sure the script did in fact compile without errors, and submitted okay:
try to compile it again, and re submit, notice the message at the bottom of the script editor and make sure the
submit was successful, and that a MERGE wasn't called for.

Let us know if none of that helps out then we can dig deeper

rjhanes

  • General Accounts
  • *
  • Posts: 16
    • View Profile
Re: FPS Camera Callback "Script Error"
« Reply #2 on: Jul 22, 16, 09:40:36 PM »

Thank you so much ToY-Krun umm this is the exact error: Client Script Error
SCRIPT ERROR: Function [STARTFPS_CAMERA] not found in script [FPS_Camera_Callback]
Time:07/22/2016 21:37:25
Call trace:
starting method/function STARTFPS_CAMERA
starting me[id=0 invalid]

Im not too sure if that'll help I mean I have copied and pasted the entire code and I still have only gotten this. I also re-compiled with no errors so lol not too sure whats going on.
Logged

rjhanes

  • General Accounts
  • *
  • Posts: 16
    • View Profile
Re: FPS Camera Callback "Script Error"
« Reply #3 on: Jul 22, 16, 09:48:02 PM »

I got it! Haha I forgot to submit the script so lol I was just compiling without submitting and that's what was causing the issue lol
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: [Solved] FPS Camera Callback "Script Error"
« Reply #4 on: Jul 22, 16, 10:24:54 PM »

Great!  while the most common errors are the simple ones, at least theyre easy to fix ! :P


Glad you got it working