Results 1 to 6 of 6

Thread: Creating a Option for my script?

  1. #1
    Join Date
    Jan 2009
    Location
    Tacoma,Wa
    Posts
    338
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Question Creating a Option for my script?

    Hello, well I got a Fletching script that I made and I was going to add a option for different types of logs to cut so I was going to do this:

    SCAR Code:
    procedure LogsToCut;
    begin
    if LogsType := 'Willow' then
    Do WillowCut;
    end;

    Then add
    SCAR Code:
    LogsType := 'Willow'
    In the declare players. Then I would just create a bunch of procedures for each log. But I do not know if this will work because I just made this up and I do not know if that procedure will even work. Also I want to know if there is a better way to do something like this.

  2. #2
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    well Players is a type that doesn't include "LogsType" in it so you can use "Strings[0]" instead so here

    Your declare players will look something like this
    Code:
    procedure DeclarePlayers;
    begin
      with Players[0] do
      begin
        ... //other players crap like nick and pass
        Strings[0] := 'Willow'; //Logtype here =)
        ... // maybe some other varables
      end;
    end;
    then too use that "Strings[0]" you can do

    Code:
    case LowerCase(Players[CurrentPlayer].Strings[0]) of
      'willow', 'willows': CutWillows;
      'someothertree', 'alias': CutOtherTree;
      else
        CutTheElseTree;
    end;
    Updated to case because of Frements post =)
    Last edited by Dgby714; 07-14-2010 at 04:12 PM.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  3. #3
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    SCAR Code:
    case Players[CurrentPlayer].Strings[0] of
    ...
    end;

    Use cases.
    There used to be something meaningful here.

  4. #4
    Join Date
    Jan 2009
    Location
    Tacoma,Wa
    Posts
    338
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by Dgby714 View Post
    well Players is a type that doesn't include "LogsType" in it so you can use "Strings[0]" instead so here

    Your declare players will look something like this
    Code:
    procedure DeclarePlayers;
    begin
      with Players[0] do
      begin
        ... //other players crap like nick and pass
        Strings[0] := 'Willow'; //Logtype here =)
        ... // maybe some other varables
      end;
    end;
    then too use that "Strings[0]" you can do

    Code:
    case LowerCase(Players[CurrentPlayer].Strings[0]) of
      'willow', 'willows': CutWillows;
      'someothertree', 'alias': CutOtherTree;
      else
        CutTheElseTree;
    end;
    Updated to case because of Frements post =)
    "CutTheElseTree;" What? Why would you cut a tree that has already been listed? Wouldn't be:

    SCAR Code:
    case LowerCase(Players[CurrentPlayer].Strings[0]) of
      'willow', 'willows': CutWillows;
      'someothertree', 'alias': CutOtherTree;
      else
         TerminateScript;
    end;

    Also it would look like this correct?:

    SCAR Code:
    procedure KindOfLogs;
    begin
    if not LoggedIn then Exit;
    case LowerCase(Players[CurrentPlayer].Strings[0]) of
      'tree', 'trees': CutTrees;
      'oak', 'oaks': CutOaks;
      'willow', 'willows': CutWillows;
      'maple', 'maples': CutMaples;
      'yew', 'yews': CutYews;
      'magic', 'magics': CutMagics;
      else
         TerminateScript;
       end;
    end;
    Last edited by ffcfoo; 07-14-2010 at 04:30 PM.

  5. #5
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Yes and you can add as many aliases as you need =)

    like for a normal tree it could be

    Code:
    'tree', 'trees', 'normal': CutTrees;
    and yes you can put anything in the else thing, I just make it cut normal trees if people don't set it. (I also add a little warning that they didn't set it!)

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

  6. #6
    Join Date
    Jan 2009
    Location
    Tacoma,Wa
    Posts
    338
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Quote Originally Posted by Dgby714 View Post
    Yes and you can add as many aliases as you need =)

    like for a normal tree it could be

    Code:
    'tree', 'trees', 'normal': CutTrees;
    and yes you can put anything in the else thing, I just make it cut normal trees if people don't set it. (I also add a little warning that they didn't set it!)
    Okay I understand.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •