Author Topic: More pvm discussion about my script! :)  (Read 1896 times)

0 Members and 1 Guest are viewing this topic.

Scrripty

  • Guest
More pvm discussion about my script! :)
« on: July 26, 2009, 05:51:51 PM »
0
Alright.  I have a main gosub section in my script.  I don't feel it's the OPTIMAL way to do things.  I need some discussion from some better scripters to sort out a better way to do things.  Here's my dillema:

Code: [Select]
gosub CounterAttack
gosub ls
gosub CurseWeapon
gosub CounterAttack
gosub ls
gosub Evasion

Ok so you can guess what that does.  Basically my question is:  I understand that ONLY subbing out when certain conditions are met can really speed up a script, but I've noticed that too many if's can really bog things down also.  Here's a pretty quick sub that seems to work fast as all get out.

Code: [Select]
 sub ls
    menu get 13 ;Lightning Strike;Primary:Secondary
    if #menures = #true
    {
      menu get 14 ; WS Mana Check
      if #menures = #true
      {
        menu get specials
        if #menures = 1
        {
           if #mana > ( #maxmana * !LSManaPercentage ) / 10
              gosub lsSpecial
           return
        }
        menu get specials
        if #menures = 2
        {
           if #mana > ( #maxmana * !LSManaPercentage ) / 10 && #mana >= !PrimaryMana
              gosub execPrimary
           return
        }
        menu get specials
        if #menures = 3
        {
           if #mana > ( #maxmana * !LSManaPercentage ) / 10 && #mana >= !SecondaryMana
              gosub execSecondary
           return
        }
      return
      }
    menu get specials
    if #menures = 1
    {
       gosub lsSpecial
       return
    }

    if #mana >= !PrimaryMana
    {
      menu get specials
      if #menures = 2
      {
        gosub execPrimary
        return
      }
    }

    if #mana >= !SecondaryMana
    {
      menu get specials
      if #menures = 3
      {
        gosub execSecondary
        return
      }
    }
    }
  return

Maybe what I'm getting at is, is there a better way to organize those subs, maybe sub out to Lightning Strike from INSIDE the subs themselves?  Or instead of having a ls sub after every casting sub... is there a more efficient way to do it?  Just throwing subs in like that doesn't seem to hurt the script speed much, but I'm sure there's a better way.  One of the problems I'm forseeing, is putting an LS sub after every skill/spell/potion sub WORKS, but I don't want it to read those subs if those options aren't CHECKED, so should I put the ls gosub INSIDE the actual spell subs themselves?  Just looking for discusion on the best way to do things here.  Make it more efficient.  LS hits a LOT the way I have it, but it's not the optimal way for sure.  Anyone with some insight, or that has access to the script in the special project section can take a look for sure.  Give me some ideas.  This can really be the end all be all of pvm scripts with a little work imho. :)

Also, I'm considering doing some selectable tactics on the menu.  So say, if you want a certain emergency heal option, you just select it from the menu and it will do that option.  If anyone has input and what they'd like in a dropdown menu for hemergency healing options, or maybe when you get attacked, how you start off your attack, have that selectable...  basically you select that option, and it plays that sub first, or when your health is low, let me know, and I'll consider putting that in.  Sounds like a great option tho for a pop out menu. :)  Easy to install too.  All the subs are there for it, just need to make a option on the menu and sub out to it first/last, or in an emergency.  Easy.
« Last Edit: July 26, 2009, 05:57:08 PM by Scrripty »

Tags: