Current location: Hot Scripts Forums » Programming Languages » Other Languages » Why is it when I run my script on my windows computer


Why is it when I run my script on my windows computer

Reply
  #1 (permalink)  
Old 01-30-07, 10:50 PM
stormshadow's Avatar
stormshadow stormshadow is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 355
Thanks: 0
Thanked 0 Times in 0 Posts
Why is it when I run my script on my windows computer

the script automatically exits, and closes the window when it is not supposed to? is there a time limit on how long a program can run for?

Code:
#!/usr/bin/ruby
require 'open-uri'

#E-Mail and Password... replace /'s with %2f
email = "regular@email.com"
password = "*************"

#Whatever the file name is that you're using... Mining is view.fcgi (if I remember, chatbox is comm.fcgi etc.)
file_name = "view.fcgi"

#What it says in the address bar besides the email and password. Make sure a & precedes every variable
uri = "&step=pit&do=2&lvl=13"

#Don't change this...
referer = "http://a3.alienaa.com/cgi-bin/#{file_name}"
url = "http://a3.alienaa.com/cgi-bin/#{file_name}?&email=#{email}&pass=#{password}"
user_agent = "Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.1)"

#Amount of veins to mine
veins = -1
to_mine = 200

#Final URL to use in open()
goto = "#{url}#{uri}"

#Previous direction that was gone. options are: n (north), e (east), s (south), w (west)
prev_dir = ""

#Method for when it gets stuck with only one option (going east, only option west, so it can't move)
def stuck line, prev_dir
  if (prev_dir == "e" || prev_dir == "w")
      if (!(/&go=s>/ =~ line) && (!(/&go=n>/ =~ line)))
	  return true 
      end
  elsif (prev_dir == "s" || prev_dir == "n")
      if (!(/&go=w>/ =~ line) && (!(/&go=e>/ =~ line)))
          return true 
      end
  end
end

#method for finding out which to map to
def prev dir
    if (dir == "e")
	return "w"
    elsif (dir == "w")
	return "e"
    elsif (dir == "s")
	return "n"
    elsif (dir == "n")
	return "s"
    end
end


#timer vars, to change up the directions (so it doesn't get into a pattern)
set_arr = ['e','s','w','n']
rand_arr = []
trail = []
trail_moves = 0
moves = 0

def track_back prev_dir
    case prev_dir
	when "e"
	    return "w"
	when "w"
	    return "e"
	when "n"
	    return "s"
	when "s"
	    return "n"
    end
end

while (veins < to_mine)
    #1 second sleep for one connection a second
    sleep(0.10);
    goto = "#{url}#{uri}"
    open( goto, "Referer"=>referer, "User-Agent"=>user_agent ) do |site|
	line = site.read
	if (/&step=pit&mine=1/ =~ line)
	    if (/&step=pit&mine=1&shovel=1/ =~ line)
		uri = "&step=pit&mine=1&shovel=1"
		puts "Shoveled for extra ore! Sweet!"
		#veins += 1
            else 
		uri = "&step=pit&mine=1"
		puts "Mined"
		#veins += 1
	    end
	    break
	elsif ((/&leave=1/ =~ line || /&next=1/ =~ line) && (prev_dir == "" || prev_dir == "leave"))
	    if (/&leave=1/ =~ line)
		uri = "&step=pit&leave=1"
		prev_dir = "leave"
	    elsif (/&next=1/ =~ line)
		uri = "&step=pit&next=1"
		prev_dir = "next"
		trail = []
		trail_moves = 0
	    end
	    break
	else
	    if (prev_dir == "leave") #Check to see if on the wrong level
		break
	    end
	    puts prev_dir if (trail_moves <= 150)
	    moves += 1
	    if (moves > 40 )
		while (!(set_arr.empty?))
		    rand_arr.push(set_arr.delete_at(rand(set_arr.size)))
		end
		set_arr = rand_arr
		rand_arr = []
		puts "Directions Randomized!"
		moves = 0
	    end
	    if (trail_moves > 50) #Maximum amount of steps, traces back
		trace_pop = trail.pop
		uri = "&step=pit&go=#{trace_pop}"
		print "trace"
		puts trace_pop
		if (trail.empty? or /&do=1&lvl=13/ =~ line)
		    if (/&do=1&lvl=13/ =~ line)
			uri = "&step=pit&do=2&lvl=13"
		    end
		    trail_moves = 0
		    trail = []
		    prev_dir = ""
		end
		moves = 0
		break
            end
	    if (/&do=1&lvl=13/ =~ line) #Check to see if you died during the pit 
		uri = "&step=pit&do=2&lvl=13"
		prev_dir = ""
		puts "Dead, restarting"
		trail_moves = 0
		trail = []
		moves = 0
		break
	    end
	    if (prev_dir == "" || prev_dir == "next")
		uri = "&step=pit&go=s"
		prev_dir = "s"
		trail.push("n")
		trail_moves += 1
		break
	    elsif (/&go=#{prev_dir}>/ =~ line)
		uri = "&step=pit&go=#{prev_dir}"
		trail.push(track_back(prev_dir))
		trail_moves += 1
		break
	    elsif ((/&go=#{set_arr[0]}>/ =~ line) && (prev_dir != prev(set_arr[0]) || stuck(line, prev_dir)))
		uri = "&step=pit&go=#{set_arr[0]}"
		prev_dir = "#{set_arr[0]}"
		trail.push(track_back(prev_dir))
		trail_moves += 1
		break
	    elsif ((/&go=#{set_arr[1]}>/ =~ line) && (prev_dir != prev(set_arr[1]) || stuck(line, prev_dir)))
		uri = "&step=pit&go=#{set_arr[1]}"
		prev_dir = "#{set_arr[1]}" 
		trail.push(track_back(prev_dir))
		trail_moves += 1
		break
	    elsif ((/&go=#{set_arr[2]}>/ =~ line) && (prev_dir != prev(set_arr[2]) || stuck(line, prev_dir)))
		uri = "&step=pit&go=#{set_arr[2]}"
		prev_dir = "#{set_arr[2]}"
		trail.push(track_back(prev_dir))
		trail_moves += 1
		break
	    elsif ((/&go=#{set_arr[3]}>/ =~ line) && (prev_dir != prev(set_arr[3]) || stuck(line, prev_dir)))
		uri = "&step=pit&go=#{set_arr[3]}"
		prev_dir = "#{set_arr[3]}"
		trail.push(track_back(prev_dir))
		trail_moves += 1
		break
	    end
	end
    end
end
__________________
Lost-On-Earth.net - *BETA* Text Based RPG
LiquidSqueeze.com - *Under Development* Scripts, Articles, Tutorials. Help
Reply With Quote
  #2 (permalink)  
Old 02-24-09, 02:21 AM
scriptkiddy scriptkiddy is offline
New Member
 
Join Date: Feb 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Did you ever get anywhere with this script?

I used to have somthing similar working.
I know they changed "&step=pit&mine=1" to "&step=pit&mine2=1"

But now the script mines every time, using motivation but not producing scarlet.
Can you offer any help?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Raffle/Lottery Script (Very profitable!), Coded it myself. Voltaire General Advertisements 6 03-16-09 07:15 AM
want to run the script at real time jk_sameer Visual Basic 1 12-15-05 02:54 AM
web proxy script id10tn00b Script Requests 1 10-09-04 06:02 PM
security concerns new purchased script Ron_Long_Beach PHP 3 09-23-04 01:45 AM
Looking for script to run sports Leagues negotiatorx9 Script Requests 0 09-16-04 11:59 PM


All times are GMT -5. The time now is 03:40 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.