Results 1 to 9 of 9

Thread: Define something as something else..

  1. #1
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default Define something as something else..

    How do I define something as another thing..

    Example:

    Define Not as !.. So instead of typing if not function.. I can type if !function..

    or Define Begin as { and End as }.. or even Define "and" as &&;

    How do I do this?

    Code:
    I tried: //LOLOL fail bad.. {$ifdef !} ! = Not; {$endif}

    Last edited by Brandon; 07-09-2011 at 02:51 AM.
    I am Ggzz..
    Hackintosher

  2. #2
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    wat

    Can you explain using examples from another well-established programming language? I don't know what you're trying to do.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  3. #3
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Example in C++:
    Code:
    #define REPEAT do{
    #define UNTIL( condition ) }while(!(condition));
    That redefines the do while loop into a Repeat Until loop.. same thing really just different words..
    Basically instead of typing:
    Code:
    do{
        //Stuff here
    }while(! condition here);
    
    //I can type
    Repeat
        //stuff here
    Until(condition here);
    Well I want to redefine Begin, end, Not, And.. so that I can type {, }, !, &&..

    So instead of typing:

    Code:
      
    
    Begin //Stuff here End;

    I would type:
    Code:
    {
       //Stuff here
    }
    Last edited by Brandon; 07-09-2011 at 03:04 AM.
    I am Ggzz..
    Hackintosher

  4. #4
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    AFAIK thats not possible because then you'd be changing reserved words in the language.

  5. #5
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    You could probably make a script converter. Code it in that language then run a convert script and it would replace those and run.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  6. #6
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think what Narcle said is the easiest route. It would also make it easier for everyone to read the script after you've made it.
    The truth finally came out...


  7. #7
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    Are you looking for {$IFNDEF}?

    E: Nevermind lol.

  8. #8
    Join Date
    Jan 2011
    Location
    Denver, CO
    Posts
    1,351
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    The only problem with using a convert script is that in the end he won't be able to run it in Simba.

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

    Default

    It could prob be added, tho it is not currently a feature of Simba.

    Basicly we would need to add a compiler directive like so.
    Code:
    {$R a(...) b(...)}
    and the Preprocesser will replace all occurrences of a() with b() before compiling.

    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

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
  •