[Bot Developers] A simple waypoint navigation system. Including loading & saving! menu

User Tag List

Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    Fabolous1's Avatar Member
    Reputation
    2
    Join Date
    Nov 2007
    Posts
    25
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm getting an error adding burdakovd's save waypoint method to the point class:
    foreach statement cannot operate on variables of type 'BotTut_Nav_Waypoints.Point' because 'BotTut_Nav_Waypoints.Point' does not contain a public definition for 'GetEnumerator'

    I've been messing around with it some and can't seem to get it to work.

    I'm still trying to wrap my head around implementing this waypoint system, any help is appreciated. Thanks a lot.

    The code I'm refering to is this:

    Originally Posted by burdakovd View Post
    also you didn't describe save method, it will be something like this?
    Code:
    public void Save(string filePath)
            {
                XElement file = new XElement("WayPointList");
    
                foreach (Point p in this)
                    file.Add(p.GetXml());
    
                file.Save(filePath);
            }

    [Bot Developers] A simple waypoint navigation system. Including loading & saving!
  2. #17
    burdakovd's Avatar Member
    Reputation
    1
    Join Date
    Jun 2009
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you wish to save one Point to file, you could remove foreach completely and do saving with "file.add(this.GetXml())".

    But there is no sense in saving only one point. You will probably have some collections of Points (maybe Route or CircularQueue as in original). So you should add Save method to Route, not to Point. If your Route class implements IEnumerable - you can do "foreach(Point p in this)". Alternatively if Route class contains, for example "List<Point> Points" you could do "foreach(Point p in Points)".

    Also, if you have different routes, you aren't forced to save one route per file.

    Here is my Route class:

    Code:
    public class Route
        {
            public string From;
            public string To;
            public string Name;
            public List<WayPoint> Points;
    
            public Route(string name, string from, string to)
            {
                Points = new List<WayPoint>();
                Name = name;
                From = from;
                To = to;
            }
    
            public Route(string name)
                : this(name, null, null)
            {
            }
    
            public Route()
            {
            }
    
            public Route(XElement xml) : this(
                xml.Attribute("Name").Value,
                xml.Attribute("From").Value,
                xml.Attribute("To").Value)
            {
                foreach (XElement xpoint in xml.Descendants("Point"))
                    Points.Add(new WayPoint(xpoint));
            }
    
            public XElement GetXml()
            {
                XElement xroute = new XElement("Route",
                    new XAttribute("Name", Name),
                    new XAttribute("From", From),
                    new XAttribute("To", To));
    
                foreach (WayPoint point in Points)
                    xroute.Add(point.GetXml());
    
                return xroute;
            }
    
           
        }
    fragments of RouteManager:
    Code:
    public List<Route> Routes;
    
    public RouteManager()
            {
                Routes = new List<Route>();
            }
    
    public RouteManager(string filePath)
                : this()
            {
                if (!File.Exists(filePath))
                {
                    throw new FileNotFoundException("Could not find the specified file!", filePath);
                }
    
                XElement file = XElement.Load(filePath);
    
                IEnumerable<XElement> xroutes = file.Descendants("Route");
                foreach (XElement xroute in xroutes)
                {
                    Route route = new Route(xroute);
                    Routes.Add(route);
                }
            }
    
            public void Save(string filePath)
            {
                XElement file = new XElement("RoutesManager");
    
                foreach (Route route in Routes)
                    file.Add(route.GetXml());
    
                file.Save(filePath);
            }
    Originally Posted by Fabolous1 View Post
    I'm getting an error adding burdakovd's save waypoint method to the point class:
    foreach statement cannot operate on variables of type 'BotTut_Nav_Waypoints.Point' because 'BotTut_Nav_Waypoints.Point' does not contain a public definition for 'GetEnumerator'

    I've been messing around with it some and can't seem to get it to work.

    I'm still trying to wrap my head around implementing this waypoint system, any help is appreciated. Thanks a lot.

    The code I'm refering to is this:
    Last edited by burdakovd; 08-27-2010 at 12:58 AM.

  3. #18
    Floppixx's Avatar Member
    Reputation
    1
    Join Date
    Oct 2009
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can anyone please reupload this Waypoint System ?

  4. #19
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    This thread is like 3 to 4 years old... I dont think anyone will have it...

  5. #20
    TccX's Avatar Member
    Reputation
    1
    Join Date
    Sep 2013
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well i would be interested, too

  6. #21
    Tilp's Avatar Private
    Reputation
    1
    Join Date
    Aug 2013
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would also be very interested in the full source code for this.

    If someone could please re-upload, it would be fantastic.

    I also wanted to add, in case people are having the same issue Fabolous1 above:

    1. As previously stated: Put the Save() method in the CircularQueue() class (this inherits from Queue<T> so it already implements IEnumerable<T>)

    2. Since the type here is all T (and not Point), you have to change the foreach loop to say:

    Code:
    foreach (Point p in this.Cast<Point>())

    Thanks in advance,

    M
    Last edited by Tilp; 11-24-2013 at 06:27 PM.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 18
    Last Post: 10-19-2012, 03:46 PM
  2. WG Fish botting, Can't get detected! Other zones included!
    By Danne206 in forum World of Warcraft Guides
    Replies: 39
    Last Post: 05-05-2009, 02:32 AM
  3. [Release](Ascent)Smlwrnc's PvP Rewards System Including S3-S4 Vendors!
    By Devilsadvocate in forum WoW EMU General Releases
    Replies: 12
    Last Post: 09-02-2008, 01:22 AM
  4. [Release] A simple site ToS system
    By Sonic Waffle in forum World of Warcraft Emulator Servers
    Replies: 13
    Last Post: 08-04-2008, 10:26 AM
All times are GMT -5. The time now is 03:55 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search