This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

calling a proc from within a proc - SOLVED

Help for those learning Tcl or writing their own scripts.
Post Reply
J
John_m0wev
Voice
Posts: 2
Joined: Wed Jul 02, 2008 5:48 am

calling a proc from within a proc - SOLVED

Post by John_m0wev »

When my script starts, it goes into a proc
Upon the result of $result being either 1 or 0 it should call another proc
it aint :(
can someone put me on the right track.

Code: Select all

set sql "SELECT username FROM users WHERE username = '$sgnick' "
  putloglev d * "ircstats: executing $sql"
  set result [mysqlsel $db_handle $sql ]
  if {$result == 1} { 
  putquick "PRIVMSG #mods-lounge : Check 1  "
  disp_mods $sgnick
  } else { putlog "calling ghstcheck proc"
  ghst_check $ghostnick }
  
  proc disp_mods { sgnick } {
  blah blah


  proc ghst_check { ghostnick } {
  blah blah

the error i recieve is this -
Tcl error [regcheck]: invalid command name "ghst_check"
and
Tcl error [regcheck]: invalid command name "disp_mods"
Last edited by John_m0wev on Wed Jul 02, 2008 10:39 pm, edited 1 time in total.
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Re: calling a proc from within a proc

Post by speechles »

Code: Select all

; # up here is hopefully your bind and procedure header
  set sql "SELECT username FROM users WHERE username = '$sgnick' "
  putloglev d * "ircstats: executing $sql"
  set result [mysqlsel $db_handle $sql ]
  if {$result == 1} { 
    putquick "PRIVMSG #mods-lounge : Check 1  "
    disp_mods $sgnick
  } else {
    putlog "calling ghstcheck proc"
    ghst_check $ghostnick
  }
} ;# this is your missing closing brace, you must close the procedure
  
proc disp_mods { sgnick } {
  # blah blah
} ; # again, you forgot to close the procedure

proc ghst_check { ghostnick } {
  # blah blah
} ; # again, you forgot to close the procedure
J
John_m0wev
Voice
Posts: 2
Joined: Wed Jul 02, 2008 5:48 am

Re: calling a proc from within a proc - SOLVED

Post by John_m0wev »

Thanks Speechless
Thats solved it


} i always overlook those

many thanks, i feel daft now
Post Reply