Results 1 to 3 of 3

Thread: [Script] Alarms MOD - Walk to/from PZ

  1. #1
    Spider
    Join Date
    Mar 2017
    Location
    England
    Posts
    29

    [Script] Alarms MOD - Walk to/from PZ

    Bored, used my limited scripting skills to mod the original alarms script with the ability to move to a safe location when player is on screen, then face a defined direction, wait your desired amount of time and if selected, rerurn to your afk location and direction. This also prevents friends from pushing you around if they're on your safelist.

    Code:
    -- ALARMS: v.1.0.0 + MOD BY JASONROX
    
    local alarms = {
    	{
    		-- CREATURE ON SCREEN
    		pauseBot  = false,
    		playSound = false,
    		logout    = false,
    		safeList  = {'Rick Sanchez', 'Morty Smith'},
    		
    		check = function(list) return maroundignore(7, true, unpack(list)) > 0 end
    	},
    	{
    		-- PLAYER ON SCREEN
    		playSound = false,
    		pauseBot  = false,
    		logout    = false,
    		
    			gotoPZ    = false,     -- Goto safe location while player on screen?
    			PZx       = 00000,    -- Safe location X
    			PZy       = 00000,    -- Safe location Y
    			PZz       = 0,        -- Safe location Z
    			Look      = 1,        -- Face direction = N:0 / E:1 / S:2 / W:3
    		
    			leavePZ   = false,     -- Leave safe location after?
    			WaitPZ    = '1000',  -- Dealy before leaving safe location
    			MaxPeople = 0,        -- Known People on screen (Prevents loop, 0 = Nobody else, and so on)
    			RPZx      = 00000,    -- AFK location X
    			RPZy      = 00000,    -- AFK location Y
    			RPZz      = 0,        -- AFK location Z
    			RLook     = 2,        -- Face direction = N:0 / E:1 / S:2 / W:3
            
    		safeList  = {'Rick Sanchez', 'Morty Smith'},
    
    		check = function(list) return paroundignore(7, true, unpack(list)) > 0 end
    	},
    	{
    		-- GM DETECTED
    		playSound = false,
    		pauseBot  = false,
    		logout    = false,
    
    		check = function() 
    			for _, c in ipairs(getcreatures()) do 
    				if c.name:match('CM ') or c.name:match('GM ') then 
    					return true 
    				end
    			end
    			return false
    		end
    	},
    	{
    		-- DISCONNECTED
    		playSound = false,
    		pauseBot  = false,
    
    		check = function() return not getonline() end
    	},
    	{
    		-- MESSAGE
    		playSound = false,
    		pauseBot  = false,
    		logout    = false,
    		default   = false,
    		private   = false,
    		safeList  = {'Rick Sanchez', 'Morty Smith'},
    
    		check = function(list, default, priv) 
    			for _, m in ipairs(getnewmessages()) do
    				if m.sender ~= getname() and ((m.mode == MSG_DEFAULT and default) or (m.mode == MSG_PRIVATE and priv)) and not table.find(list, m.sender:lower()) then
    					return true
    				end
    			end
    			return false
    		end
    	},
    	{
    		-- PLAYER ATTACKING
    		playSound = false,
    		pauseBot  = false,
    		safeList  = {'Rick Sanchez', 'Morty Smith'},
    
    		check = function(list) 
    			for _, cre in ipairs(getcreatures()) do
    				if cre.isplayer and cre.blacksquare and not table.find(list, cre.name:lower()) then
    					return true
    				end
    			end
    			return false
    		end
    	},
    	{
    		-- MONSTER ATTACKING
    		playSound = false,
    		pauseBot  = false,
    		safeList  = {'Rick Sanchez', 'Morty Smith'},
    
    		check = function(list) 
    			for _, cre in ipairs(getcreatures()) do
    				if cre.ismonster and cre.blacksquare and not table.find(list, cre.name:lower()) then
    					return true
    				end
    			end
    			return false
    		end
    	},
    	{
    		-- ITEMS BELOW
    		playSound = false,
    		pauseBot  = false,
    		logout    = false,
    		items 	  = {
    			{name = 'cheesee', min = 5},
    			{name = 'meat', min = 10},
    		},
    
    		check = function(items) 
    			for _, i in ipairs(items) do
    				if itemcount(i.name) <= i.min and getonline() then
    					return true
    				end
    			end
    			return false
    		end
    	},
    	{
    		-- HPPC BELOW
    		playSound = false,
    		pauseBot  = false,
    		logout    = false,
    		below     = 50,
    
    		check = function(hppc) return gethppc() <= hppc and getonline() end
    	},
    	{
    		-- MPPC BELOW
    		playSound = false,
    		pauseBot  = false,
    		logout    = false,
    		below     = 50,
    
    		check = function(mppc) return getmppc() <= mppc and getonline() end
    	},
    	{
    		-- PLAYER STATES (POISONED, BURNED etc.)
    		playSound = false,
    		pauseBot  = false,
    		logout    = false,
    		flags	  = {STATE_POISON, STATE_FIRE, STATE_ENERGY},
    
    		check = function(flags) 
    			for _, s in ipairs(flags) do 
    				if getplayerstate(s) then 
    					return true 
    				end
    			end
    			return false 
    		end
    	}
    }
    
    auto(10)
    
    for _, alarm in ipairs(alarms) do
    	if alarm.safeList then
    		table.lower(alarm.safeList)
    	end
    
    	if alarm.check(alarm.safeList or alarm.items or alarm.below or alarm.flags, alarm.default, alarm.private) then
    		if alarm.playSound then
    			playsoundflash()
    		end
    
    		if alarm.gotoPZ then
    			wait(1000)
    			walk(alarm.PZx, alarm.PZy, alarm.PZz)
    			wait(100)
    			turn(alarm.Look)
    		end
    		
    		if alarm.pauseBot and not ispaused() then
    			pausebot(true)
    		end
    
    		if alarm.logout and getonline() and not (getplayerstate(STATE_COMBAT) or getplayerstate(STATE_PZBLOCK)) then
    			logout()
    		end
    	end
    	
    	if alarm.leavePZ and paround() <= alarm.MaxPeople  then
    		wait(alarm.WaitPZ)
    		walk(alarm.RPZx, alarm.RPZy, alarm.RPZz)
    		turn(alarm.RLook)
    	end
    
    end
    Last edited by jasonrox; 02-10-2017 at 07:57 PM.

  2. #2
    Is it possible to use it with your moded rune maker ? to make runes next to your house, and if someone is on your screen hes entring house ?

  3. #3
    Spider
    Join Date
    Mar 2017
    Location
    England
    Posts
    29
    yea i was using it with the rune mod and it worked fine

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •