def readscriptfile(self):
        ''' Read in mobility script from a file. This adds waypoints to a
            priority queue, sorted by waypoint time. Initial waypoints are
            stored in a separate dict.
        '''
        filename = self.findfile(self.file)
        try:
            f = open(filename, 'r')
        except IOError, e:
            self.session.warn("ns-2 scripted mobility failed to load file " \
                              " '%s' (%s)" % (self.file, e))
            return
        if self.verbose:
            self.session.info(filename % "reading ns-2 script file: %s")
        ln = 0
        ix = iy = iz = None
        inodenum = None
        for line in f:
            ln += 1
            if line[:2] != '$n':
                continue
            try:
                if line[:8] == "$ns_ at ":
                    if ix is not None and iy is not None:
                        self.addinitial(self.map(inodenum), ix, iy, iz)
                        ix = iy = iz = None
                    # waypoints:
                    #    $ns_ at 1.00 "$node_(6) setdest 500.0 178.0 25.0"
                    parts = line.split()
                    time = float(parts[2])
                    nodenum = parts[3][1+parts[3].index('('):parts[3].index(')')]
                    x = float(parts[5])
                    y = float(parts[6])
                    z = None
                    speed = float(parts[7].strip('"'))
                    self.addwaypoint(time, self.map(nodenum), x, y, z, speed)
                elif line[:7] == "$node_(":
                    # initial position (time=0, speed=0):
                    #    $node_(6) set X_ 780.0
                    parts = line.split()
                    time = 0.0
                    nodenum = parts[0][1+parts[0].index('('):parts[0].index(')')]
                    if parts[2] == 'X_':
                        if ix is not None and iy is not None:
                            self.addinitial(self.map(inodenum), ix, iy, iz)
                            ix = iy = iz = None
                        ix = float(parts[3])
                    elif parts[2] == 'Y_':
                        iy = float(parts[3])
                    elif parts[2] == 'Z_':
                        iz = float(parts[3])
                        self.addinitial(self.map(nodenum), ix, iy, iz)
                        ix = iy = iz = None
                    inodenum = nodenum
                else:
                    raise ValueError
            except ValueError, e:
                self.session.warn("skipping line %d of file %s '%s' (%s)" % \
                                  (ln, self.file, line, e))
                continue
        if ix is not None and iy is not None:
            self.addinitial(self.map(inodenum), ix, iy, iz)
dataset/ETHPy150Open coreemu/core/daemon/core/mobility.py/Ns2ScriptedMobility.readscriptfile/swapped operands of `%`