Author Topic: telling script to decide between 2 subs  (Read 2863 times)

0 Members and 1 Guest are viewing this topic.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 2998
  • Activity:
    3.4%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +205
  • Referrals: 2
    • View Profile
telling script to decide between 2 subs
« on: October 16, 2016, 04:31:38 PM »
0
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.

Offline gimlet

  • Very Super Secret
  • Global Moderator
  • *
  • *
  • Posts: 6190
  • Activity:
    3%
  • Reputation Power: 71
  • gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!
  • Gender: Male
  • Respect: +273
  • Referrals: 3
    • View Profile
Re: telling script to decide between 2 subs
« Reply #1 on: October 16, 2016, 05:22:03 PM »
0
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


Offline cybercasper

  • Full Member
  • ***
  • Posts: 228
  • Activity:
    0%
  • Reputation Power: 3
  • cybercasper has no influence.
  • Respect: +41
  • Referrals: 1
    • View Profile
Re: telling script to decide between 2 subs
« Reply #2 on: October 16, 2016, 06:32:09 PM »
0
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

Tags: