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

Thread: E2 Preprocessor?

  1. #1
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,672
    Blog Entries
    5

    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

  2. #2
    Wirererer Venompapa's Avatar
    Join Date
    Feb 2008
    Location
    Slovakia
    Posts
    179

    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
    Pizza is good... OmicroN's Avatar
    Join Date
    Apr 2008
    Location
    Frozen Hell (aka Michigan)
    Posts
    560

    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's Avatar
    Join Date
    Dec 2008
    Posts
    2,300

    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's Avatar
    Join Date
    Apr 2008
    Location
    Denver
    Posts
    648

    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
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,672
    Blog Entries
    5

    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?)

  7. #7
    Wire Sofaking Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Belgium OR BANland
    Posts
    1,965

    Default Re: E2 Preprocessor?

    Code:
    #ifdef entity:shootTo(vector,number,number,number)
    print("YOUR SERVER OWNZ")
    #else
    print("YOUR SERVER SUCKS")
    #endif
    New server IP: 89.238.160.17:27018
    Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
    Unsmart: I doubt the intelligence of some people.
    Drunkie: Nobody could have said that any better than Unsmart.

    Unsmart: Solece, I totally did your mom yesterday
    Solece: Who hasnt

    Divran: there are more retarded people than there are clever people in this world

  8. #8
    Wire Sofaking Rybec's Avatar
    Join Date
    Apr 2008
    Location
    Denver
    Posts
    648

    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's Avatar
    Join Date
    Dec 2008
    Location
    Co, united states
    Posts
    424

    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's Avatar
    Join Date
    Dec 2008
    Location
    Belgium OR BANland
    Posts
    1,965

    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 06:29 AM.
    New server IP: 89.238.160.17:27018
    Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
    Unsmart: I doubt the intelligence of some people.
    Drunkie: Nobody could have said that any better than Unsmart.

    Unsmart: Solece, I totally did your mom yesterday
    Solece: Who hasnt

    Divran: there are more retarded people than there are clever people in this world

+ Reply to Thread
Page 1 of 2 12 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