ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Crisis on October 16, 2016, 04:31:38 PM

Title: telling script to decide between 2 subs
Post by: Crisis on October 16, 2016, 04:31:38 PM
I am a bit stumped on this. I am trying to have the script look at a list and if there isn't anything in the pack from that list, it goes to one sub, if there is, then it goes to a different sub

Code: [Select]
sub breakortoss
  finditem %garbage C_ , #Backpackid
  if findcont =< 0
     {
      gosub breakstuff
     }
   else gosub clearpackgarbage
return

I have not tested this as I am sure it is wrong but my mind is rusty and I could use some help.
Title: Re: telling script to decide between 2 subs
Post by: gimlet on October 16, 2016, 05:22:03 PM
I am a bit stumped on this. I am trying to have the script look at a list and if there isn't anything in the pack from that list, it goes to one sub, if there is, then it goes to a different sub

Code: [Select]
sub breakortoss
  finditem %garbage C_ , #Backpackid
  if findcont =< 0
     {
      gosub breakstuff
     }
   else gosub clearpackgarbage
return

I have not tested this as I am sure it is wrong but my mind is rusty and I could use some help.

Well - I am not a pro but I would write it like this

Code: [Select]
sub breakortoss
  finditem %garbage C_ , #Backpackid
  if findcont > 0
          gosub clearpackgarbage
    else
     {
     gosub breakstuff
     }

return

Title: Re: telling script to decide between 2 subs
Post by: cybercasper on October 16, 2016, 06:32:09 PM
i forsure am not an expert but could u do this too

Code: [Select]
sub breakortoss
  finditem %garbage C_ , #Backpackid
  if findcont =< 0
     {
      gosub breakstuff
     }
   else
     {
      gosub clearpackgarbage
     }
return

gimlet is probably right but im pretty sure i have seen some written like that as well but im a noob