Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - ElementCoder

Pages: 1 ... 35 36 [37] 38 39 ... 46
541
Gaming Discussion / Re: Nothin' but Duke Nukem
« on: November 06, 2012, 11:50:51 am »
Why is he so awesome? Google "Hail to the king" and this is the first image you see :P

542
Computer Programming / Reading files and processing contents
« on: November 06, 2012, 11:34:32 am »
I have a txt file with a few names of channel operators in it and I want to use it for my bot, so that if a command is ordered, first it checks if that person is op.
The txt file simply has each name on a seperate line. If I run the isOp() method in main outside of anything, it works fine. I can print out the names, check them, do whatever I want. But for some reason when using it in the bots class, it won't work.
It is supposed to return true when the name is found but the check in line 51 (isOp(sender)) doesn't seem to work. My name is in the file, but yet it does not enter the if statement. Am I doing something terribly wrong here?
Code: [Select]
package bot;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

import org.jibble.pircbot.PircBot;

public class HelpBot extends PircBot{
public HelpBot(){
this.setName("AmA");
}

public void onJoin(String channel, String sender, String login, String hostname, String message){
if (!(sender.equalsIgnoreCase(this.getNick()))){
sendMessage(channel, "Hello "+sender+"! Enjoy your stay here :)");
}else{
sendMessage(channel, sender+" is up and running again :)");
}
}
public void onMessage(String channel, String sender, String login, String hostname, String message){
//Operator commands. Settings etc.
if (message.startsWith("!")){
//Owner only commands (me :P)
if (sender.equals("@tikker") || sender.equals("tikker")){
if (message.equalsIgnoreCase("!stop")){
System.out.println("Stopping AmA :(");
sendMessage(channel, "Out of fuel, all systems shutting down :(");
this.disconnect();
System.exit(0);
}
if (message.equalsIgnoreCase("!test")){
sendMessage(channel, "====== Running tests now ======");
sendMessage(channel, "====== Starting message test...");
sendMessage(channel, "Hello World!");
sendMessage(channel, "====== Starting PM test...");
sendMessage("Franz24", "Hi I'm AmA! Don't be scared, this is a test. Not some sort of attack :)");
sendMessage("Gorok", "Hi I'm AmA! Don't be scared, this is a test. Not some sort of attack :)");
sendMessage("Agent321", "Hi I'm AmA! Don't be scared, this is a test. Not some sort of attack :)");
sendMessage("tousent", "Hi I'm AmA! Don't be scared, this is a test. Not some sort of attack :)");
sendMessage("tikker", "Hi I'm AmA! Don't be scared, this is a test. Not some sort of attack :)");
sendMessage(channel, " ");
sendMessage(channel, "Tests succesfully ran");
sendMessage(channel, "====== Stopping tests ======");
}
}
//Regular OP commands
if (message.contains("!nick")){
System.out.println("Person "+sender+" tried to order !nick.");
try {
if (isOp(sender) == true){
System.out.println(sender+" changed AmA's nick.");
String newNick = message.substring(6);
this.changeNick(newNick);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
if (message.equalsIgnoreCase("!topic")){
try {
if (isOp(sender)){
String newTopic = message.substring(8);
this.setTopic(channel, newTopic);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
//User commands. Questions etc.
if (message.startsWith(">")){
if (message.equalsIgnoreCase(">AmA")){
sendMessage(sender, "I'm "+this.getNick()+" the question bot. I'm here to help you with questions about Galaxy55 :) I'm created by tikker. Should there be any trouble, contact him.");
}
if (message.equalsIgnoreCase(">wiki")){
sendMessage(sender, "The wiki can be found at http://www.galaxy55wiki.com");
}
}
}

public void onPing(String sourceNick, String sourceLogin, String sourceHostname, String target, String pingValue) {
sendMessage(sourceNick, "PONG");
System.out.println("Received PING from "+sourceNick+" sent PONG");
}

/*
* User defined methods
*/
//Checks if a name is listed in ops.txt
public static boolean isOp(String name) throws FileNotFoundException{
File opsFile = new File(System.getProperty("user.dir")+"\\src\\ops.txt");
Scanner scan = new Scanner(opsFile);
String line = scan.nextLine();

while (scan.hasNextLine() && line != name){
line = scan.nextLine();
System.out.println(line);
if (name == line){
System.out.println(line);
System.out.println(line == name);
return true;
}
}
return false;
}
}



543
News / Re: Internet on the TI-Nspire thanks to Linux and USB !
« on: November 03, 2012, 02:15:04 pm »
Yeah true if they saw a dongle or something they would definitively take that away for a while. That or if someone had a Nspire Navigator connected (and managed to hack it).
How could that possibly be noticed :P
Cheating for us is nearly impossible, calculators are simply not allowed anywhere near the exam room :P

544
News / Re: Internet on the TI-Nspire thanks to Linux and USB !
« on: November 03, 2012, 12:51:50 pm »
This is beyond everything,  ;D ;D ;D ;D ;D

[edit]it actually surprised me a bit there wasn't a rickroll involved :P

545
Computer Projects and Ideas / Re: MC land - a little minecraft clone
« on: November 02, 2012, 06:54:51 am »
Yay a website :D The update sounds great, gonna try this when I get back home.

546
TI-Nspire / Re: Calling all Linux Kernel developers!
« on: November 02, 2012, 06:52:13 am »
Took some time to write them all out in a text file :) It can be found in the attachment or here. Please notify when something is wrong :)

547
TI-Nspire / Re: Calling all Linux Kernel developers!
« on: November 02, 2012, 04:52:58 am »
I see, so what does the cmdline do?
Also found out how to get the | key so ls | less can be used :D shift + flag does the trick (flag is in the lower right corner, below the ?! button) Scrolling can be done with b and f and exiting with q (sorry if someone else already found this, I thought it could be useful)

548
TI-Nspire / Re: Calling all Linux Kernel developers!
« on: November 02, 2012, 04:42:08 am »
Two questions:
What is the build login for. I just enter root and it works but are there other locations we can login to as well?
Does it matter what cmdline you set?

549
Lua / Re: The animal crossing team.
« on: November 02, 2012, 04:33:21 am »
Well as long as updates keep coming, I'm glad. I'd really like to see this project finished.

550
News / Re: Linux enables USB on the TI-Nspire
« on: November 01, 2012, 04:59:44 pm »
Lol ElementCoder, in my case I just ended up with too many of them (while my I/O cables kept vanishing or breaking).

This is really awesome. I wonder how easy it would be to add mouse support? (for those who hate the touchpad)
For me it is the exact opposite, I had a lot and they keep disappearing.

551
News / Re: Linux enables USB on the TI-Nspire
« on: November 01, 2012, 02:56:39 pm »
This is awesome. Too bad my usb cables seem to all have dissappeared...

552
TI-Nspire / Re: Calling all Linux Kernel developers!
« on: October 31, 2012, 02:36:56 pm »
wow 0.0 now i really want to find a mini usb to female usb cable to plug in harddrives in my nspire :D

553
News / Re: 1st dumping of a TI-Nspire CAS+ Boot1
« on: October 31, 2012, 02:33:39 pm »
Wow great job :thumbsup:
[offtopic]So how does a dump like this go like steps etc. Could I find guides to this stuff somewhere?[/offtopic]

554
Introduce Yourself! / Re: Well hello there
« on: October 30, 2012, 04:59:09 pm »
Welcome to omni :) Glad to see you also joined here. I liked TI RPG 2 very much and am wondering what more you will bring to us.
Welcome here! We're have a shortage on peanuts (DJ_O needs to order them more) so I won't be giving any additional peanuts. I hope you have a fun time here. :)
Found some :D !peanuts
I just went to the storage and there was only this bag left D:
There special, take good care of them :)
!peanuts.

555
TI-Nspire / Re: Calling all Linux Kernel developers!
« on: October 30, 2012, 05:05:42 am »
It works fine on a normal CX, though if using nover too it seems to fail. To me it always fails if I have my nspire overclocked. It hangs on the "keyboard p2/ mouse" message (don't know the exact message, but that one)

Pages: 1 ... 35 36 [37] 38 39 ... 46