TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Page 2 of 2 FirstFirst 12
Results 26 to 31 of 31

Thread: Understanding Squirrel Scripts

  1. #26
    Registered: Mar 2001
    Location: Ireland
    Post the code that you're trying to use.

  2. #27
    Registered: Jan 2012
    Location: Gèrmany
    What I want is to get a string config variable (ConfigGetRaw)
    But neither

    #Result empty
    #Result empty
    Seam to do anything with their str parameter. The return result is 1 (for success).

    EDIT: So either I'm doing something terribly wrong or something with string() is really terribly wrong. (or the functions)

    Some knowledge i (think) figured out:

    string is a class here so string("init") is a class instance
    "init" get somewhere stored in it. I can not iterate it find out where or what's the index name.
    when used for example with print(string("init")) it invokes some kinda tostring() function. (also hidden)

    Any idea how the get the variables in a class.instance?

    string and int_ref got in their class body
    a constructor func
    two empty tables __setTable and __getTable
    as well as these two functions
    __overload_constructor0 and __overload_constructor1
    Last edited by Daraan; 6th Dec 2017 at 19:53.

  3. #28
    Registered: Nov 2001
    Location: uk
    I was just half way through writing something that contains most of that.
    printing anything invokes its tostring or _tostring function (depending on what it is and whether _tostring exists, that's used to override the built in tostring on something)

    I would do a foreach on it, but instances of the string class don't seem to let you do that. (I assume you equally already tried that)

    It doesn't to me look like you're doing anything wrong if that helps at all. The rather un-squirrel like syntax of all those functions in the name of making it the same as the c++ version it's a wrapper for.

  4. #29
    Registered: Nov 2001
    Location: uk
    Having poked at some stuff not in thief, you can't find out what's in a class instance unless the class implements methods for doing that (and that's normal for squirrel rather than specific to that class which is what I wanted to find out).

    if the class has a _nexti function in it then you should be able to foreach over the instance I think, you'd not generally do that unless the class was the sort of thing that you'd want to foreach over rather than just doing it because you want to treat it like a table and see what's in it because someone else wrote it and didn't tell you how it works.

    So I'm sticking with my unhelpful answer of that I agree the documentation says you should do what you're doing, it seems consistent with the rest of the script interface documentation and as far as I can see that ought to do what you'd expect.

  5. #30
    Registered: Jan 2012
    Location: Gèrmany
    Definitely a big thank you for looking into it as well.

    I want to break it down to the two main possibilities I see at the moment:
    Either the function results and 'return' of string are not in sync like
    _tostring()->return script.slot1
    We could work around that if we knew the name of slot2

    But what I fear has the higher possibility.
    OR All the string & functions do not invoke their return part. (Maybe some typo deep inside the same function)
    Why I think that? All string & functions don't care/throw when you give them a totally wrong data type as parameters, the others specifically want a int/float_ref, vector.

  6. #31
    Registered: Sep 1999
    Location: Portland, OR
    Scripts are my weak suite because I haven't played with them at all, not even the basic ones. I've been playing in Dromed in every other aspect. I just want to thank everyone who is carving out this new opportunity in scripting. Thank you so much.

Page 2 of 2 FirstFirst 12

Posting Permissions

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