+ Reply to Thread
Page 2 of 37 FirstFirst 123412 ... LastLast
Results 11 to 20 of 361

Thread: E2 User Defined Functions

  1. #11
    http://somone77.net somone77's Avatar
    Join Date
    Jun 2008
    Location
    <Smart ass location>
    Posts
    614

    Default Re: Colonel Thirty Two's Wiremod Addons

    Quote Originally Posted by initrd.gz View Post
    No, you give the inputs to the virtualized program via passing a table to the exec function, and get outputs by calling Code:getOutputs(). Inputs and outputs in virtualized code are defined by the @inputs, ect syntax in the code string.

    EDIT: Example static code:
    Code:
    String = "@inputs Stuff:vector \n"+
    "entity():applyForce(stuff)"
    
    Code = virtCompile(String)
    Args = table()
    Args["Stuff",vector] = vec(0,0,1000)
    Code:exec(Args)
    Thank you very much, I find this a great way to protect dupes using this and the File functions or Http functions. I don't know how efficient this will be so I'll have to try it.


    No matter how many Z's you put after Plz, you still spell as well as a piece of cheese.

    http://somone77.net

  2. #12
    Wire Sofaking Tasuit's Avatar
    Join Date
    Jan 2009
    Location
    Sønderjylland, Denmark
    Posts
    582
    Blog Entries
    9

    Default Re: Colonel Thirty Two's Wiremod Addons

    You, sir, are brilliant!
    I've been waiting so long for this to happen, and bam, out of nowhere, you come and upload this!
    Please, have my babies! They carry cookies!
    +rep'ed!

    Creator of the Unofficial servers

  3. #13
    Ursus maritimus Drunkie's Avatar
    Join Date
    Feb 2009
    Location
    Canada
    Posts
    5,662
    Blog Entries
    1

    Default Re: Colonel Thirty Two's Wiremod Addons

    Can a wire dev review this and check if its worthy of being added to the official SVN?

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

    Default Re: Colonel Thirty Two's Wiremod Addons

    Quote Originally Posted by Drunkie View Post
    Can a wire dev review this and state whether or not it is official SVN worthy?
    Well, this is still in development, so better not put it in Official SVN until I implement calling a variable.

  5. #15
    Wire Sofaking jacoby6000's Avatar
    Join Date
    Feb 2008
    Location
    behind you when you aren't looking
    Posts
    792

    Default Re: Colonel Thirty Two's Wiremod Addons

    HOLY SHIZNIT, IT WORKS!!!
    Code:
    if(first())
    {
        runOnTick(1)
        findIncludePlayerProps(owner())
    }
    ColorEnts = function("Entities:array")
    {
        EC = Entities:count()
        for(I=1,EC)
        {
            Entities[I,entity]:setColor(hsv2rgb(360/EC*I,1,1))
        }
    }
    
    if(findCanQuery())
    {
        findByClass("*")
        Ents = array()
        Ents = findToArray()
        ColorEnts:call(Ents)
    }
    <3

    EDIT:also, dont forget to put functions in if(first()) I think it makes it more efficient, though im not sure.. Better safe than soz though

    EDIT2:nvm, if first was fail :3
    Last edited by jacoby6000; 05-16-2010 at 02:17 PM.
    Quote Originally Posted by Garrysmod View Post
    Warning: You're trying to render in the wrong place. This doesn't play nice with multi-core rendering, so we're not going to let you draw here.
    I'm not stupid!
    In [his] experience that was a sentence never to be uttered except to prove its own inaccuracy
    --Orson Scott Card

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

    Default Re: Colonel Thirty Two's Wiremod Addons

    Quote Originally Posted by jacoby6000 View Post
    EDIT:also, dont forget to put functions in if(first()) I think it makes it more efficient, though im not sure.. Better safe than soz though

    EDIT2:nvm, if first was fail :3
    Yes, put it in if(first()), but don't forget to persist the function variables.

  7. #17
    Wire Sofaking jacoby6000's Avatar
    Join Date
    Feb 2008
    Location
    behind you when you aren't looking
    Posts
    792

    Default Re: Colonel Thirty Two's Wiremod Addons

    Quote Originally Posted by initrd.gz View Post
    Yes, put it in if(first()), but don't forget to persist the function variables.
    ahhk, didnt know i had to do that :3
    Quote Originally Posted by Garrysmod View Post
    Warning: You're trying to render in the wrong place. This doesn't play nice with multi-core rendering, so we're not going to let you draw here.
    I'm not stupid!
    In [his] experience that was a sentence never to be uttered except to prove its own inaccuracy
    --Orson Scott Card

  8. #18
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,652

    Default Re: Colonel Thirty Two's Wiremod Addons

    It seems like a variable for the function doesn't seem like the best way to accomplish this. Perhaps just do something along the lines of
    Code:
    function("string name", parameters) {...}
    and then call("string name")

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

    Default Re: Colonel Thirty Two's Wiremod Addons

    I could do that, or I could make it work like functions from other languages, which is what I did.

  10. #20
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,652

    Default Re: Colonel Thirty Two's Wiremod Addons

    Er...

    C++:
    returntype name(parameters) {...}

    Lua:
    function name(parameters) {...}

    Neither of those start with the name of the function, and neither of them involve defining a variable (except C++ defining the type)

+ Reply to Thread
Page 2 of 37 FirstFirst 123412 ... LastLast

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