Filled [REQUEST] Run a Command and Display Text Written in a .TXT File

Discussion in 'Archived: Plugin Requests' started by billytheDOLPHIN, Jun 5, 2014.

  1. Offline

    billytheDOLPHIN

    Name: CmdTxt

    Description: If you have a .txt folder named lets say derp.txt you would run the command /cmdtxt derp.txt and it would read all the information you have written down in the file. Please make it also so that each line in the text document is a new line in game meaning its not just written out as one large text string so you can format.

    Commands: /cmdtxt (args)

    Permissions: cmdtxt.use (use the /cmdtxt (args))
     
  2. Offline

    skore87

    So you basically want macros?
     
  3. Offline

    unrealdesign

    So you just want it to be able to read a text file in a certain folder and paste it to console?
     
  4. Offline

    billytheDOLPHIN

    The .txt file will be in the plugins folder always. And i want it to send the text to the player running the command

    idk sure? can it do what i posted above?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
  5. Offline

    unrealdesign

    Sure I'll make that. Give me 5 minutes
     
  6. Offline

    billytheDOLPHIN

    Awesome thanks!
     
  7. Offline

    unrealdesign

    Do you want permissions?
     
  8. Offline

    skore87

    You... really don't know what a macro is?
     
  9. Offline

    billytheDOLPHIN

    Does it look like I know how to use google?

    No its fine if all players can run it

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
  10. Offline

    unrealdesign

    Alright sorry it took so long. I had to run to the store real fast. But here is the file you requested. I didn't test it but it's so simple I doubt there is a bug.

    Commands:
    /cmdTxt <filename>.txt

    DL LINK: https://www.fragzone.org/downloads/CmdTxt.jar

    I wasn't sure if you wanted color codes in there so I didn't add them. If you want them I can add them.

    Anything else?

    skore87 What he wants done in this plugin is not a macro.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
  11. Offline

    billytheDOLPHIN

    Yes i do need color codes, and formating codes.
     
  12. Offline

    skore87

    lol... I guess you don't know what a macro is either then.
     
  13. Offline

    billytheDOLPHIN

    1. Macro
      Computer science
    2. A macro in computer science is a rule or pattern that specifies how a certain input sequence should be mapped to a replacement output sequence according to a defined procedure.
     
  14. Offline

    unrealdesign

    Indeed and in this situation he only wants a single action performed; show what's in a text file to a user. So please, learn what a word is before you use it :).

    Also, my internet was down for awhile, so I'll upload the new jar in a second.
     
  15. Offline

    billytheDOLPHIN

    Tell me when you have update the download with the color and formatting codes :D
     
  16. Offline

    unrealdesign

    Updated! Use the same link and it will be the updated version.
     
  17. Offline

    billytheDOLPHIN

    Thanks tons!!! :D <3

    Actually the color and format codes still don't work :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
  18. Offline

    skore87

    billytheDOLPHIN unrealdesign I would say I'm shocked that you don't see the underlying ability of the plugin you're asking but I shouldn't expect anything less from this forum. It is a macro whether you pick the wrong definition of the word or not.

    Whats funnier yet is the place you got that definition even explains what I'm talking about...
     
  19. Offline

    wowzersam

  20. Offline

    billytheDOLPHIN

    Wikipedia lol. I'm aware now it is a macro :)
     
  21. Offline

    unrealdesign


    Trolls are going to be trolls. If you can't explain your reasoning for why you are using macro correctly and we aren't, then you are by definition wrong. If you look the word up in a dictionary, it is the exactly what billytheDOLPHIN explained before. It isn't a macro because if you are calling this a macro, anything that does more than one thing at a time is macro, so me simply talking is a macro because I'm doing more than one thing at a time just for me to breathe. In the CURRENT example, the task he wants done in the plugin I made ISN'T a macro, because it is doing ONE TASK. Macros require TWO OR MORE tasks to be done in sequence by a single command. YES, my programming uses macros, but the PLUGIN isn't a macro in itself.
     
  22. Offline

    skore87

    unrealdesign I'm not being a troll. This plugin really is implementing macros. A macro can be a single task too btw. Each of the text files, in the way they are being used, are considered macros.
     
  23. Offline

    billytheDOLPHIN

    Has the plugin been fixed yet? the color and format codes aren't working:(
     
  24. Offline

    unrealdesign

    It works for me? Are you using &? Try re-downloading it.


    How can you have a pattern or sequence (macro) with only 1 event? I'd just consider that a single event, not a macro.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
  25. Offline

    skore87

    unrealdesign Instead of the user typing countless lines of text or commands you have them do it once and all they need to do is call on it. Thus a macro.

    Also I was under the impression that the OP wanted this line-by-line and not one large message? I took a look at the code and saw it was a single message.

    In the event that you're not familiar with line-by-line reading there is an example at stack overflow.
     
  26. Offline

    wowzersam

    http://dev.bukkit.org/bukkit-plugins/mcdocs/
     
  27. Offline

    unrealdesign

    Well obviously it is line-by-line. That is the only way in coding you can read from a file. I 100% agree that the CODING OF THE PLUGIN is 100% a macro. The actions it performs is 100% a macro. Reading from the predefined file of text is 100% a macro. But in the essence of a GAMING MACRO this isn't a macro. In a game, a macro is something that performs two or more actions. So this plugin has ONE JOB. Yes that job is made up of small parts, but the OUTPUT is a single thing. The PROCESS IS a macro, but the JOB is not a macro. That's like playing wow or something and pressing '1' that casts a spell and saying that's a macro. No, that's a bind. If you press '1' and it casts spells on '2' and '3' ALSO, then that's a macro. Do you get what I mean?

    billytheDOLPHIN Sorry, I had an error on my dedicated server. It should be fixed NOW.

    https://www.fragzone.org/downloads/CmdTxt.jar

    But as wowzersam posted already, that plugin will work too. It just has a lot more shit and will take up more RAM.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 30, 2016
  28. Offline

    skore87

    I'm sorry you're having such a hard time grasping the concept... Maybe you should go pay attention at school. The command is executing several messages from one file; this is a macro.

    Oh and... reading line-by-line is not the only way. It is clearly the preferred method for the majority of tasks but it is definitely not the only way.
     
  29. Offline

    unrealdesign

    Except I'm not taking each line and sending it to the user. I'm taking THE WHOLE TEXT of the file and sending it to the user. That's why I'm saying the code is a macro. I'm doing ONE .sendMessage() of the WHOLE message in the '.txt' file. So if you're having trouble understanding how I coded it, I'll past the part of the code that turns the text file into a SINGLE STRING.

    Code:java
    1.  
    2. public String readFile(String fileName) throws IOException {
    3. BufferedReader br = new BufferedReader(new FileReader("plugins/CmdTxt/"+fileName));
    4. try {
    5. StringBuilder sb = new StringBuilder();
    6. String line = br.readLine();
    7.  
    8. while (line != null) {
    9. sb.append(line);
    10. sb.append("\n");
    11. line = br.readLine();
    12. }
    13. return sb.toString();
    14. } finally {
    15. br.close();
    16. }
    17. }
    18.  
     
  30. Offline

    skore87

    unrealdesign Maybe you should read the first post :oops:

     

Share This Page