PenUltima Online

It is currently Sat Aug 30, 2008 5:50 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: help with controlscript
PostPosted: Wed Nov 29, 2006 2:31 pm 
Offline

Joined: Sun Feb 05, 2006 4:35 pm
Posts: 160
Location: Poland
Code:
use uo;
use os;

include ":igrzyska:igrzyska";
include ":igrzyska:initializer";

program kamien(item)

    var forced;
   
    var stonepid := SetObjProperty(item, "StonePid", GetPid());
   
    while(item)
        StoneSay(Systime_GetHour() + " : " + Systime_GetMinute() );

        if(CheckIgHour())
            if(!CheckIfActiveIg())
                RunIg();
            endif
        endif

        forced := Cint(GetGlobalProperty("ForceIg"));
        if(forced)
            RunIg();
        endif
       
        if(!item)
            break;
        endif
        sleep(60);
    endwhile


endprogram


When that item is created, script loops four times every sixty seconds. Is there any way to make control script to loop once a time?. It happens even after server restart.

_________________
Shutdown();


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 2:59 pm 
There's nothing wrong with the script you've posted that would make it run four times every sixty seconds. There has to be some anomaly in how your item is created - of course, not knowing what any of the functions you've included there do, we can't know for sure.... but unless you have the script listed four times as a control script, or something...


As for it happening after shard restart... did you read the docs? A control script is supposed to run every time the shard starts. That's the purpose. If you only want the script to run when the item is first created, you use an OnCreate script.

Check out the itemdesc documentation for how and which scripts to define, and then check out the scripts documentation for what each script is supposed to do (and what parameters it gets. In these cases, both Control and OnCreate get passed an item reference, of course)


Top
  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 6:02 pm 
Offline

Joined: Sun Feb 05, 2006 4:35 pm
Posts: 160
Location: Poland
Thank you for help, now im using start.src in package to start that script, to create item and createscript like you said.

_________________
Shutdown();


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl