Hooks

Discussion in 'Development Questions' started by Kjenriquez, Mar 12, 2015.

  1. Kjenriquez

    Kjenriquez Level 1

    Joined:
    Jan 29, 2015
    Messages:
    14
    I Am using TShock API Version 1.16,

    and i have a question, where do you find the list of Hooks,
    cause i am trying to make a Word Filter plugin,
    and i am trying to make it have a config,

    so i have 2 questions:
    1.) LIST OF HOOKS, 2.) CREATING CONFIG FILE.

    So can anyone help?
     
  2. Olink

    Olink Nyx Developer, Occasional TShock Developer
    Banned

    Joined:
    Jul 21, 2011
    Messages:
    1,397
    1) https://tshock.atlassian.net/wiki/display/TSHOCKPLUGINS/Home
    2) Developing for out of date TShock is not desirable, supported, or recommended.
    3) Or maybe use the search features of the forums to find the very helpful thread in the Development Resource subforums explaining how to make plugins.
    4) Or maybe reading the code of the 20+ free and open source plugins that these forums offer.
    5) Or even looking at the code that has the hooks and seeing what exist, luckily they are all bundled in one convenient file.
     
    • Agree Agree x 1
  3. Kjenriquez

    Kjenriquez Level 1

    Joined:
    Jan 29, 2015
    Messages:
    14
    I've been looking at the source codes of the plugins;
    AutoBoss+, HouseRegions, EssentialsPlus, Essentials-SignCommands
    and whenever i try to do something like this line of code;
    ServerApi.Hooks.ServerChat.Register(this, OnChat)
    it always says "The name 'OnChat' doesnt exist in the current context"

    And i know that 1.17 TShock is out, but im using 1.16 TShock because most of the plugins like HouseRegions, is using that APIVersion, i dont know what will happen if i download and then tamper with tshock's source code and set;
    "public static readonly Version ApiVersion = new Version(1, 17, 0, 0);" to "public static readonly Version ApiVersion = new Version(1, 16, 0, 0);"

    if it works, i will put that as an excuse of my TShock API version... lol
    i have two more things to say, does anybody know how to make your plugin have a config file?,
    and to Olink is it ok if i do the thing above with the source code thingy?
     
  4. nicatronTg

    nicatronTg Shank / hakusaro
    TShock Founder TShock Admin

    Joined:
    Jul 21, 2011
    Messages:
    716
    My example code (LoginWarp) is good to look at because it's simplistic in what it does: https://github.com/nicatronTg/LoginWarp/blob/master/LoginWarp/LoginWarp/LoginWarp.cs

    Most of the older plugins will work fine if you upgrade the version.
     
  5. Kjenriquez

    Kjenriquez Level 1

    Joined:
    Jan 29, 2015
    Messages:
    14
    Ok thx, i still cant figure out the Hooks problem though :/ did you guys remove the ServerApi.Hooks.[HookType].Register(this, [OnType]) function?
     
  6. nicatronTg

    nicatronTg Shank / hakusaro
    TShock Founder TShock Admin

    Joined:
    Jul 21, 2011
    Messages:
    716
    If you're still having problems getting started, it's probably better if you join Slack over the weekend, a lot of plugin developers hang out there.
     
  7. Kjenriquez

    Kjenriquez Level 1

    Joined:
    Jan 29, 2015
    Messages:
    14
    lol, it just happened that you posted that reply to my reply before i was done editing it, i might go find out where or what slack is, ok i found out what it was, but i dont know where to find it i might keep looking, i still dont know where to find it though, i cant find the banner on the right hand side of furom;
    "ShoutBox and slack"
     
  8. Olink

    Olink Nyx Developer, Occasional TShock Developer
    Banned

    Joined:
    Jul 21, 2011
    Messages:
    1,397
    Sorry m80, but we don't provide support to people who can not write software. You are better of using google and some sort of tutorial to learn how to write C#. Your error has nothing to do with TShock, it is a compiler issue brought about by your lack of knowledge. Our product is not new-developer-friendly, and if we helped you learn C# it would be a waste of our time.

    Sorry.
     
  9. Kjenriquez

    Kjenriquez Level 1

    Joined:
    Jan 29, 2015
    Messages:
    14
    Oh ok thx for helping, i will go learn C# more :)
     
  10. Kjenriquez

    Kjenriquez Level 1

    Joined:
    Jan 29, 2015
    Messages:
    14
    Oh wait, you guys did remove OnChat function!, it even does it with other plugins when i try to update the referenced files D:<
     
  11. Kjenriquez

    Kjenriquez Level 1

    Joined:
    Jan 29, 2015
    Messages:
    14
    Anyway, you guys can close the thread now cause the 2 questions that this furom topic is about have been answered :/
     
  12. nicatronTg

    nicatronTg Shank / hakusaro
    TShock Founder TShock Admin

    Joined:
    Jul 21, 2011
    Messages:
    716
    Like I said, Slack is the better way to get in contact with us.
     
  13. Olink

    Olink Nyx Developer, Occasional TShock Developer
    Banned

    Joined:
    Jul 21, 2011
    Messages:
    1,397
    • Agree Agree x 2
  14. Ratismal

    Ratismal Level 1

    Joined:
    Apr 16, 2015
    Messages:
    13
    Sorry if this is late, unneeded, or unhelpful, but OnChat refers to a function that you create yourself. It essentially means that upon the ServerApi.Hooks.ServerChat event, it runs the OnChat function. This is your issue and has nothing to do with TShock.