Syntax error

Description: Report bugs of SMBX-38A here.
Moderators: Yoshi021, Lx Xzit, 5438A38A, Semi-moderatos, Moderators

Super Mario Player M
Topic author, Duke
Duke
Avatar
Super Mario Player M
Topic author, Duke
Duke
Age: 18
Reputation: 25
Posts: 138
Joined: 23 Jun 2016
Location: The sewers (fixing teh pipes bro)
Tencent QQ

Post #1by Super Mario Player » 12 Dec 2017, 17:38

Hello there... I guess it's been a long time since the last time I went on the forum :bye:

Anyway, I'm getting the same error again and again in my script:
1 errors detected compiling the scripts.
Scripts with errors are disabled.
Error '37' occured compiling the script!
Invalid custom function detected in the logic statements.
Error in script 'Homing' line 11: script 1


Here's the script:
Spoiler

Code: Select all

with npc(sysval(param1))
   
   val(dy)=(Char(1).Y-.Y)
   val(dx)=(Char(1).X-.X)
   
   val(dt)=dr(val(dx),val(dy))/val(v)
   
   .Ysp=val(dy)/val(dt)
   .Xsp=val(dx)/val(dt)
   
   Script dr(ddx As Double, ddy As Double, Return Double) '<---This is the faulty line
      return sqr(Param(ddx)^2 + Param(ddy)^2)
   End Script
   
end with

Does anyone have an idea about why this script won't work?

Thanks in advance!
My current project:
Spoiler
The Legend of Zelda: The Curse of the Wise Men
Image

The Tower of Challenges

Languages I speak (if you want to PM me):
Spoiler
Image Image Image

Click to see my YouTube channel
Image

BlackBlex
Passerby
Passerby
BlackBlex
Passerby
Passerby
Reputation: 0
Posts: 2
Joined: 20 Nov 2017

Post #2by BlackBlex » 12 Dec 2017, 22:13

You can not put a script inside any function

Code: Select all

with npc(sysval(param1))
   
   val(dy)=(Char(1).Y-.Y)
   val(dx)=(Char(1).X-.X)
   
   val(dt)=dr(val(dx),val(dy))/val(v)
   
   .Ysp=val(dy)/val(dt)
   .Xsp=val(dx)/val(dt)
   
end with

   Script dr(ddx As Double, ddy As Double, Return Double)
      return sqr(Param(ddx)^2 + Param(ddy)^2)
   End Script

Super Mario Player M
Topic author, Duke
Duke
Avatar
Super Mario Player M
Topic author, Duke
Duke
Age: 18
Reputation: 25
Posts: 138
Joined: 23 Jun 2016
Location: The sewers (fixing teh pipes bro)
Tencent QQ

Post #3by Super Mario Player » 12 Dec 2017, 23:44

Oops... :facepalm: I didn't think of that x)
Thanks for your help, now it's working fine. :good:
My current project:
Spoiler
The Legend of Zelda: The Curse of the Wise Men
Image

The Tower of Challenges

Languages I speak (if you want to PM me):
Spoiler
Image Image Image

Click to see my YouTube channel
Image


Return to “Bug reports”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest