+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: E2 Preprocessor?

  1. #1
    The gnome inside your E2

    initrd.gz has a spectacular aura about initrd.gz has a spectacular aura about initrd.gz has a spectacular aura about initrd.gz's Avatar
    Join Date
    Oct 2009
    Location
    Did you not read the text above my avatar?
    Posts
    1,597
    Blog Entries
    2

    Default E2 Preprocessor?

    I noticed that #ifdef and #else were highlighted in the syntax highlighter in E2. I messed around with it, but there is no #define statement, nor does "#ifdef shootTo" work. How exactly does it work?

    Edit: maybe this should go in the Expression Help section
    E2 User Defined Functions v2
    Quote Originally Posted by SuperLlama View Post
    If only Garry was as awesome and smart and anti-idiotic as Notch is. Then maybe we'd have a chance.

  2. #2
    Lurker Venompapa is on a distinguished road Venompapa's Avatar
    Join Date
    Feb 2008
    Location
    Slovakia
    Posts
    180

    Default Re: E2 Preprocessor?

    Quote Originally Posted by initrd.gz View Post
    I noticed that #ifdef and #else were highlighted in the syntax highlighter in E2. I messed around with it, but there is no #define statement, nor does "#ifdef shootTo" work. How exactly does it work?

    Edit: maybe this should go in the Expression Help section
    Here one example for this:

    Code:
    @outputs Player:entity
    
    #ifdef findPlayerBySteamID()
        Player = findPlayerBySteamID("STEAMID")
    #else
        #use this if the "findPlayerBySteamID" function does not exist
        N = findByClass("player")
        
        for(I=1, N){
            if(findResult(I):steamID() == "STEAMID"){
                Player = findResult(I)
                break
            }
        }
    

  3. #3
    Wirererer OmicroN will become famous soon enough OmicroN's Avatar
    Join Date
    Apr 2008
    Location
    Frozen Hell (aka Michigan)
    Posts
    144

    Default Re: E2 Preprocessor?

    you forgot your #endif

    I have been using these for a little while and I think it's a neat idea, especially for when i'm using chips that mix non-offical and official code.
    Code:
    #ifdef propSpawn()
    propSpawn(S,V,1/0)
    #else
    concmd("gm_spawn "+S)
    #endif
    

  4. #4
    billywitchdoctor.com Whosdr has a spectacular aura about Whosdr has a spectacular aura about Whosdr has a spectacular aura about Whosdr's Avatar
    Join Date
    Dec 2008
    Posts
    2,120

    Default Re: E2 Preprocessor?

    I noticed a few odd things too.
    #toggle would become Toggle.
    .siht daer ot gniyrt emit detsaw ev'uoY

  5. #5
    Wire Sofaking Rybec will become famous soon enough Rybec's Avatar
    Join Date
    Apr 2008
    Location
    Denver
    Posts
    654

    Default Re: E2 Preprocessor?

    #Button becomes Button, #Slider becomes Slider
    #admin becomes Admin.

    That #ifdef thing should be documented. I might go back and rework some of my stuff that uses external functions to give them alternatives.

  6. #6
    The gnome inside your E2

    initrd.gz has a spectacular aura about initrd.gz has a spectacular aura about initrd.gz has a spectacular aura about initrd.gz's Avatar
    Join Date
    Oct 2009
    Location
    Did you not read the text above my avatar?
    Posts
    1,597
    Blog Entries
    2

    Default Re: E2 Preprocessor?

    #gc4 becomes GCombat C4
    hmm...

    Anyway, thanks.
    One other question: Does it preprocess when you upload the chip or after every execution? (Basically, when you rightclick on the chip, can you see the #ifdef code?)
    E2 User Defined Functions v2
    Quote Originally Posted by SuperLlama View Post
    If only Garry was as awesome and smart and anti-idiotic as Notch is. Then maybe we'd have a chance.

  7. #7
    Wire Sofaking Unsmart will become famous soon enough Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Slovakia OR BANland
    Posts
    1,169

    Default Re: E2 Preprocessor?

    Code:
    #ifdef entity:shootTo(vector,number,number,number)
    print("YOUR SERVER OWNZ")
    #else
    print("YOUR SERVER SUCKS")
    #endif
    

  8. #8
    Wire Sofaking Rybec will become famous soon enough Rybec's Avatar
    Join Date
    Apr 2008
    Location
    Denver
    Posts
    654

    Default Re: E2 Preprocessor?

    Quote Originally Posted by initrd.gz View Post
    #gc4 becomes GCombat C4
    hmm...
    Perhaps it's class names.

  9. #9
    Wire Sofaking vexx21322 has a little shameless behaviour in the past vexx21322's Avatar
    Join Date
    Dec 2008
    Location
    Co, united states
    Posts
    405

    Default Re: E2 Preprocessor?

    Wait so #ifdef is a hidden function to see if a certain function exists?
    Have you checked HERE first?

  10. #10
    Wire Sofaking Unsmart will become famous soon enough Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Slovakia OR BANland
    Posts
    1,169

    Default Re: E2 Preprocessor?

    Quote Originally Posted by vexx21322 View Post
    Wait so #ifdef is a hidden function to see if a certain function exists?
    1.its NOT a function
    2.its NOT hidden
    3.NOT exactly, it tells the E2 if the function exists, not YOU. read my example to see what I mean.
    Last edited by Unsmart; 02-12-2010 at 05:29 AM.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots