Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324

    FREE ACTION PLUGIN: Timer

    Timer Action Plugin
    by ShadowUK

    You'll need to go to your AutoPlay Media Studio folder and navigate to Data/Actions then put this file in that folder.

    Now you've installed the Actions, it's time to install the functions!

    Go to: AutoPlay Media Studio/Data/Includes and open _notification_messages.lua

    Append at the bottom the following:
    Code:
    Timer = {}
    
    Timer.OldTimerCode = Application.GetPageScript(this, "On Timer")
    
    function Timer.Create(Name, Delay, Repeats, Function)
    	if (type(Function) == "function") then
    		error("string expected, got function! ("..assert(tostring(Function))..")");
    	elseif (type(Function) == "number") then
    		error("string expected, got number! ("..assert(tostring(Function))..")");
    	elseif (type(Function) == "table") then
    		error("string expected, got table! ("..assert(tostring(Function))..")");
    	elseif (type(Function) == "nil") then
    		error("attept to local global callback function (a nil value)");
    	end
    	
    	function DoThink()
    		if (Occurrences == Repeats) then
    			Page.StopTimer()
    			Occurrences = nil
    		end
    	end
    	
    	if (Repeats ~= 0) then
    		Occurrences = 0
    		Application.SetPageScript(this, "On Timer", Timer.OldTimerCode.."\r\n"..Function.."\r\nOccurrences = Occurrences + 1\r\nDoThink()");
    		Page.StartTimer(Delay * 1000)
    	elseif (Repeats == 0) then
    		Application.SetPageScript(this, "On Timer", Timer.OldTimerCode.."\r\n"..Function);
    		Page.StartTimer(Delay * 1000)
    	end
    end
    
    function Timer.Simple(Delay, Function)
    	if (type(Function) == "function") then
    		error("string expected, got function! ("..assert(tostring(Function))..")");
    	elseif 	(type(Function) == "number") then
    		error("string expected, got number! ("..assert(tostring(Function))..")");
    	elseif 	(type(Function) == "table") then
    		error("string expected, got table! ("..assert(tostring(Function))..")");
    	elseif 	(type(Function) == "nil") then
    		error("attept to local global callback function (a nil value)");
    	end
    		
    	Application.SetPageScript(this, "On Timer", Timer.OldTimerCode.."\r\n"..Function.."\r\nPage.StopTimer()\r\nApplication.SetPageScript(Application.GetCurrentPage(), \"On Timer\", \"\")")
    	Page.StartTimer(Delay / 1000)
    end
    Save the file and off you go! Plugin installed!

    Later down the line, I should consider creating an automatic plugin installer if I can't be bothered to use the real plugin method.

  2. #2
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    neat concept... Nice outa-the-box thinking

  3. #3
    Join Date
    Jul 2002
    Location
    Just South of Reality
    Posts
    778
    This has great potential; however after install:

    Error
    Startup, Line 790: Argument 1 must be type string.


    This was on the compile of an existing project before ever using the Timer function.

  4. #4
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Yeh, I seem to find this as well. I need to find out how to fix it first, I may have corrupted something in the core code.

    Edit:

    Nothing wrong with the code, But It might be the Actions file. In the mean time while I get this fixed please don't download it yet.
    Last edited by ShadowUK; 03-28-2008 at 12:35 AM.

  5. #5
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Well, you can always use the code as normal. While I get working on this again.

  6. #6
    Join Date
    Jul 2007
    Posts
    1,512
    Quote Originally Posted by ShadowUK View Post
    Well, you can always use the code as normal. While I get working on this again.
    i am keeping a eye this hope it becomes working soon so i can mirror it for you

  7. #7
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    ShadowUK, this is only creating a branch within the current Page Timer, correct? If you have a "timer function" that is costly in time, the functions below them will be delayed that much longer, correct?

  8. #8
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    It's an alternative to Application.Sleep, And I think I messed up in the XML, I'll be recoding this again.

Similar Threads

  1. Free WindowEx Action Plugin
    By reteset in forum AutoPlay Media Studio 7.5
    Replies: 88
    Last Post: 01-30-2011, 10:40 AM
  2. FREE ACTION PLUGIN: Assert
    By ShadowUK in forum AutoPlay Media Studio 7.5
    Replies: 17
    Last Post: 02-22-2009, 05:36 AM
  3. Somebody can give me the Timer Action Plugin??
    By Vancete in forum AutoPlay Media Studio 6.0
    Replies: 3
    Last Post: 11-18-2008, 11:59 AM
  4. Who have the Timer Action Plugin ?
    By CrazyFrog in forum AutoPlay Media Studio 6.0
    Replies: 13
    Last Post: 04-07-2007, 08:22 AM
  5. SUF6.0.0.2 -- installer hangs.
    By jassing in forum Setup Factory 6.0
    Replies: 4
    Last Post: 12-19-2001, 11:28 PM

Tags for this Thread

Posting Permissions

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