egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Proc Finish?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
jnc_xavier
Voice


Joined: 20 Aug 2011
Posts: 4
Location: India

PostPosted: Sat Aug 20, 2011 8:57 am    Post subject: Proc Finish? Reply with quote

when i execute this file i get the error as said below. plz help
Code:

#Create a ns simulator
set ns [new Simulator]

#Open the NS trace file
set tracefile [open out1.tr w]
$ns trace-all $tracefile

#Open the NAM trace file
set namfile [open out1.nam w]
$ns namtrace-all $namfile

#===================================
#        Nodes Definition       
#===================================
#Create 3 nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]

#===================================
#        Links Definition       
#===================================
#Createlinks between nodes
$ns duplex-link $n0 $n1 100.0Mb 10ms DropTail
$ns queue-limit $n0 $n1 50
$ns duplex-link $n0 $n2 100.0Mb 10ms DropTail
$ns queue-limit $n0 $n2 50

#Give node position (for NAM)
$ns duplex-link-op $n0 $n1 orient right-down
$ns duplex-link-op $n0 $n2 orient right-down

#===================================
#        Agents Definition       
#===================================

#===================================
#        Applications Definition       
#===================================

#===================================
#        Termination       
#===================================
#Define a 'finish' procedure
proc finish {}
{
    global ns tracefile namfile
    $ns flush-trace
    close $tracefile
    close $namfile
    exec nam -a out1.nam &
    exit 0
}

$ns at 10.0 "finish"

$ns run

ERROR THAT SHOWS UP:
Quote:

wrong #args: should be "proc name args body"
while executing
"proc finish {}"
(file wired2node.tcl line 71)

_________________
Jan Xavier
Back to top
View user's profile Send private message Yahoo Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Aug 20, 2011 9:07 am    Post subject: Reply with quote

In tcl, all arguments must be on the same line (though each argument may contain newlines)
Thus, this is incorrect:
Code:
proc finish {}
{
...

The proper code would look like this:
Code:
proc finish {} {
...

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
jnc_xavier
Voice


Joined: 20 Aug 2011
Posts: 4
Location: India

PostPosted: Sat Aug 20, 2011 9:27 am    Post subject: Reply with quote

but that too aint working. could u plz help
_________________
Jan Xavier
Back to top
View user's profile Send private message Yahoo Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Aug 20, 2011 9:32 am    Post subject: Reply with quote

Changing the definition of "finish" into this:
Code:
proc finish {} {
  global ns tracefile namfile
  $ns flush-trace
  close $tracefile
  close $namfile
  exec nam -a out1.nam &
  exit 0
}

Should sort the posted error message. Please post any new error messages you get.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
sh.minaee
Voice


Joined: 02 Mar 2014
Posts: 1

PostPosted: Sun Mar 02, 2014 2:17 am    Post subject: Reply with quote

I've did that, but this time i have this error :
ns: finish: wrong # args: should be "close channelId"
while executing
"close $tracefile # close tracefile"
(procedure "finish" line 5)
invoked from within
"finish"
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Mar 02, 2014 11:16 am    Post subject: Reply with quote

Remove the comment (# close tracefile) from your code...
Or prefix the # with a ;
Such as this:
Code:
...
close $tracefile ;# close tracefile

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber