ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Ketchup on December 10, 2015, 07:32:13 AM

Title: Sub issue
Post by: Ketchup on December 10, 2015, 07:32:13 AM
I have an issue with this sub setting off the sound (alarm) no matter what I try to edit, why does my alarm keep going off even though my %Alerts are not being triggered?

Basically I use lame 3.0 and have added this sub into it, except the alarm goes off constantly when I add more than 1 %Alert
Code: [Select]
set %ALERTS 3
set %ALERT1 Wiggles
set %ALERT2 Razor
set %ALERT3 Deathstar
set %stamPer ( #MAXSTAM * %stamPercMod ) / 100
set !jindex #jindex + 1
set %playerspotted #false

sub playercheck
     set !nextjinedxend #jindex
    if !jindex <= !nextjinedxend
    {
       for !ji !jindex !nextjinedxend
       {
           scanjournal !ji
           for %number 1 %alerts
           if %alert . %number in #journal
           {
                   set %playerspotted #true
                   break
           }
       }
       set !jindex !nextjinedxend + 1
    }
    if %playerspotted
    {
       while #true
       {
           sound alarm
       }
    }
    sleep 10
    return




Title: Re: Sub issue
Post by: Endless Night on January 01, 2016, 10:23:17 AM
The only error I can see is that the inner most For loop does not have { }   

Code: [Select]
set %ALERTS 3
set %ALERT1 Wiggles
set %ALERT2 Razor
set %ALERT3 Deathstar
set %stamPer ( #MAXSTAM * %stamPercMod ) / 100
set !jindex #jindex + 1
set %playerspotted #false

sub playercheck
    set !nextjinedxend #jindex
    if !jindex <= !nextjinedxend
      {
      for !ji !jindex !nextjinedxend
         {
           scanjournal !ji
           for %number 1 %alerts
            {
             if %alert . %number in #journal
                   {
                   set %playerspotted #true
                   break
                   }
           }
         }
       set !jindex !nextjinedxend + 1
       }
    if %playerspotted
      {
       while #true
       {
           sound alarm
       }
      }
    sleep 10
return