PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
help with controlscript

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help 096
Display posts from previous:   

Author Message
qrak



Joined: 05 Feb 2006
Posts: 160
Location: Poland

PostPosted: Wed Nov 29, 2006 6:31 pm    Post subject: help with controlscript Reply with quote

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.

Author Message
Marilla



Joined: 02 Feb 2006
Posts: 329

PostPosted: Wed Nov 29, 2006 6:59 pm    Post subject: Reply with quote

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)

Author Message
qrak



Joined: 05 Feb 2006
Posts: 160
Location: Poland

PostPosted: Wed Nov 29, 2006 10:02 pm    Post subject: Reply with quote

Thank you for help, now im using start.src in package to start that script, to create item and createscript like you said.

Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help 096 All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty