AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Function error - I gotta have a typo...

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
valenfor



Joined: 26 Feb 2005
Posts: 20

PostPosted: Tue May 03, 2005 8:27 pm    Post subject: Function error - I gotta have a typo... Reply with quote

Given this function below, this is included at the top of my main script. This file has ONLY functions and global variables (defined outside of function). No lables are used in this file that contains this function.

When executing my program it always gives:

Error: Return's parameter should be blank except inside a function.
Line#400: Return 0

Checked functions above and below and commented this one out etc but seem to be getting this error a lot in my last few tests.
Code:
; This one will load, save or delete a ability record.
dataAbilUpdate(mode, confirm)
{
   ; required to set paths
   global fAbilitiesData
   
   ; the structure as it is now.
   global g_AbilName
   global g_AbilDesc
   global g_AbilCastTime
   global g_AbilRecoveryTime
   global g_AbilRecastTime
   global g_AbilEffects
   
   ; check the mode to see what to do
   if(mode = "load")
   {
      IniRead, g_AbilDesc, %fAbilitiesData%, %g_AbilName%, AbilDesc
      IniRead, g_AbilCastTime, %fAbilitiesData%, %g_AbilName%, AbilCastTime
      IniRead, g_AbilRecoveryTime, %fAbilitiesData%, %g_AbilName%, AbilRecoveryTime
      IniRead, g_AbilRecastTime, %fAbilitiesData%, %g_AbilName%, AbilRecastTime
      IniRead, g_AbilEffects, %fAbilitiesData%, %g_AbilName%, AbilEffects
      
      Return 0
   }             
   else if (mode = "save")
   {
      IniWrite, %g_AbilDesc%, %fAbilitiesData%, %g_AbilName%, AbilDesc
      IniWrite, %g_AbilCastTime%, %fAbilitiesData%, %g_AbilName%, AbilCastTime
      IniWrite, %g_AbilRecoveryTime%, %fAbilitiesData%, %g_AbilName%, AbilRecoveryTime
      IniWrite, %g_AbilRecastTime%, %fAbilitiesData%, %g_AbilName%, AbilRecastTime
      IniWrite, %g_AbilEffects%, %fAbilitiesData%, %g_AbilName%, AbilEffects
      
      Return 0
   }
   else if (mode = "delete")
   {
      ; are we really deleting?
      if (confirm > 0)
      {
       ; here we need to send up a confirmation msgbox and
       ; only delete if set to true.
      
      }
      else
      {
          IniDelete, %fAbilitiesData%, %g_AbilName%
         Return 0
      }
   }
   Return 1
}
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Tue May 03, 2005 9:00 pm    Post subject: Reply with quote

This could be a bug but I'll need some way to reproduce it. Perhaps you e-mail the script(s) to support@autohotkey.com

If you have time, simplify the scripts to be as tiny as possible while still being able to produce the error.

Thanks.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group