help with controlscript

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 096.
Note: Core 096 is no longer officially supported.
Post Reply
qrak
Grandmaster Poster
Posts: 198
Joined: Sun Feb 05, 2006 4:35 pm

help with controlscript

Post by qrak »

Code: Select all

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.
Marilla

Post by Marilla »

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)
qrak
Grandmaster Poster
Posts: 198
Joined: Sun Feb 05, 2006 4:35 pm

Post by qrak »

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