• Visit Rebornbuddy
  • getting started writing CC's. need help with syntax

    Discussion in 'Archives' started by geoffrules, Mar 19, 2010.

    1. geoffrules

      geoffrules New Member

      Joined:
      Jan 15, 2010
      Messages:
      37
      Likes Received:
      1
      Trophy Points:
      0
      hey there guys, just need help tryin to sort the syntax for writing CC's and using visual express.
      Other then trawling other peoples CC's is there any guides for getting all the commands syntax right.
      all the (){}[] etc
      also is there a way to determine your targets class? ie druid,mage,lock etc
      thanks for your help
       
    2. CodenameG

      CodenameG New Member

      Joined:
      Jan 15, 2010
      Messages:
      38,369
      Likes Received:
      231
      Trophy Points:
      0
      well i dont know if theres any kind of guide. but heres a few tips if youve never programed before.
      1. start off small. - try finding an easy class, like a mage, and go for something simple, like pulling with fireball instead of frostbolt. baby steps are always ok, as long as your working tword a goal.
      2. learn some other language - like Html. if you can make a basic html page and follow the sourcecode, chances are you can follow just about how any programing language works. remember programing languages are made for humans, not machines. while it does get complicated, after you get used it it, you should be able to follow it almost as easly as one of those chose you own adventure books.
      3. if you open it, you close it. ALWAYS! - in C# theres never any time where you would have a Lone Bracket, (so if you open the bracket{you close it} Always).
      4. understand how the computer will execute code - Processors are magical yet simple things, They can only execute 1 Command at a time. think of your CC as a list of todo items. and a really complicated guide on how to make a sandwich, any sandwich.
      if (Me.HasBread.White && Me.HasMeat.Bologna)
      {
      Get bread
      Put meat on bread.
      put top slice of bread on
      }
      4. Always KISS.- Keep It Simple Stupid. chances are if your trying to do something, and it seems way too hard to do, chances are your just not keeping it simple. remember Simple code = fast code.

      5. design Combat for 90% of the time. - When i think of how to do combat PvP or otherwise, i think of how most Encounters work. 90% of the time your bot is going to walk up, target a mob, and start attacking the mob till its dead. once you have that down, move onto things that might not happen as much, but do happen, like handling adds. running low on health or mana, what if my pet gets killed in combat? thinking about combat is an importaint part of making a CC and that brings me to my next item.

      6. Find a human, and copy it - go on youtube and just about for whatever class your playing look for how to videos, and look how they handle combat. look at how they handle the hostile, at this point its importaint to see what spells they use and how and when they use it. for example.
      [video=youtube;KcPD7CDT7FM]http://www.youtube.com/watch?v=KcPD7CDT7FM&feature=related[/video]
      the above video, is an mage with a Pom pyro Build, and what if you pay attention plays his class to the best of his ability. and plays with that classic mage flair the class is know for. the pull, i would do something like this.
      mirror image,
      Pressance of mind.
      arcane power.
      PyroBlast.
      arcane barrage.
      slow - to keep at distance
      then after the pull.
      arcane blast. till missle barrage procts. or Arcane barrage is up again

      as you can see, if you really think critically about it, and take your time, you can make something awesome,
      hope this helps some.
       
    3. geoffrules

      geoffrules New Member

      Joined:
      Jan 15, 2010
      Messages:
      37
      Likes Received:
      1
      Trophy Points:
      0
      thanks for the help - i think im going ok, a couple of questions now.
      when writing checks if i want something to happen only if critera a and b are met, I write it as: if (critera A && criteria B) what do i use if i want something to execute if either a or b is met? ie OR instead of &&
      Also if i want to compare the spell my target is casting against a list of known spell Id's how do i write that - (Me.Target.CastingfromList) And how do I create this list?
      Sorry for all Noob Questions
      Cheers
       
    4. ski

      ski Well-Known Member

      Joined:
      Feb 12, 2010
      Messages:
      3,720
      Likes Received:
      48
      Trophy Points:
      48
      || instead of &&.

      For getting the spell they are casting you can do...

      Code:
      uint enemySpell = Me.CurrentTarget.CastingSpellId;
      
      and match it up against known spell id's or a list, like so:

      Code:
          private readonly List<uint> _frostboltEntryId = new List<uint>
          {
              5509, 5510, 5511, 5512, 9421, 19004, 19005, 19006,
              19007, 19008, 19009, 19010, 19011, 19012, 19013,
              22103, 22104, 22105, 36889, 36890, 36891, 36892,
              36893, 36894
          };
      
      (these are healthstone id's, just ripped from my cc)
      
      Then do...

      Code:
      if (_frostboltEntryId.Contains(enemySpell) && SpellMananger.CanCastSpell("Silence")){
              cast("Silence");
      }
      
      Or something.
       
    5. geoffrules

      geoffrules New Member

      Joined:
      Jan 15, 2010
      Messages:
      37
      Likes Received:
      1
      Trophy Points:
      0
      hi SKi,
      As discussed here is that first attempt.
      If you want to have a look and throw me some pointers It would be much apreciated.
      Cheers
       

      Attached Files:

      Last edited: Mar 20, 2010
    6. ski

      ski Well-Known Member

      Joined:
      Feb 12, 2010
      Messages:
      3,720
      Likes Received:
      48
      Trophy Points:
      48
      Alright, this is going to take a while...
      - You need to add a slog() method (you use slog but don't have the method in there anywhere)
      - Same as above for HaveItemCheck()
      - Same as above for NeedWeaponEnchant()
      - Same as above for all the spells
      - Same as above for ApplyWeaponEnchants()
      - Same as above for CreateHealthstone()
      - Same as above for DeleteShard()
      - Same as above for DisenchantItems()
      - Same as above for GetItemsToDisenchant()
      - Same as above for Stacker()
      - Line 493: Me.IsCasting returns bool, you have it compared to an int. Me.Casting returns spellid of the spell you're casting.
      - Line 496: Me.IsChannelling is not valid, you want Me.ChanneledCasting
      - Line 501: Me.Target is not valid, you want Me.CurrentTarget
      - Line 503: Drain Mana(); - methods shouldn't have spaces in them
      - Line 505: Need "Else If" with conditionals, also "Else" should be lowercase
      - Line 507: Dark Pact(); - methods shouldn't have spaces in them
      - Line 509: Need "Else If" with conditionals, also "Else" should be lowercase
      - Line 531: IsKnownSpell(string) is not valid, use SpellManager.KnownSpells.ContainsKey(string) or SpellManager.CanCast(string) (the former returns true if you have the spell, the latter returns true if you can actually cast it [ie not silenced, not in gcd])
      - Line 531: SpellOnCooldown is not valid, use SpellManager.CanCast(string)
      - Line 562: Me.Target.Buffs.ContainsKey(string) is not valid, use Me.CurrentTarget.Buffs.ContainsKey(string)

      For all the top ones about methods not being there, it looks like they are in the file but there's a bracket missing somewhere I think, and its erroring it out. There are a total of 118 errors. I recommend you do the following:

      - Download and Install Visual Studio 2008 Express (free)
      - Open it, and do new project
      - Choose "Class Library"
      - Right Click "References" on the right, and select "Add Reference"
      - Choose the "Browse" tab and Navigate to your HB folder
      - Select the four dll's in there and hit ok
      - Back in VS, copy all your code into Class1.cs and rename it

      That will compile your code on the fly and show you errors, as well as give you intellisense for all the functions in the dlls.
       
    7. CodenameG

      CodenameG New Member

      Joined:
      Jan 15, 2010
      Messages:
      38,369
      Likes Received:
      231
      Trophy Points:
      0
      yea, it helps when you dont do things like mismatch variable types.
      bools - True, False and it always returns something.
      int - Intiger, always is a number
      Sting - Text always will be surrounded by " "

      one thing you might want to look at is another class, warlocks are hard for beginners to code for since theres a lot of features like soulstones, and healthstones, firestones. ect. i had this CC called Bot'Nlock you might want to take a look at, i coded it to work for levels 1-20. and might be a good starting off point or at least a reference on how to do things like setup a spell, and how combat and rest looks. if your very adament about doing a warlock, then good luck to you. just keep in mind that the CC code isnt some weird scripting language, its C# so just go online, and you should be able to find tutorials on how to do just about everything you'll ever need to do.
       
      Last edited: Mar 20, 2010

    Share This Page