Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Updating script support, taking requests
Bridge Offline
Posting Freak

Posts: 1,971
Threads: 25
Joined: May 2012
Reputation: 128
#27
RE: Updating script support, taking requests

(08-28-2013, 05:44 PM)Javist Wrote:
Quote: Can you make the if-else function that the parameter could turn Integers to Bools and vice-versa?
Quote:Could you rephrase this? Not sure I understand exactly.
Well.. i may mistake here, but i think, he's probably talked about the C-like "feature".
if(1), while(1), bool b = 0 ..etc.
In this case, something like this one can become handy Smile
Spoiler below!
bool toBool(int i)
{
    return i;
}
bool toBool(const char* str)
{
    return str==NULL || strlen(str);
}
int fromBool(bool b)
{
    return b;
}


Isn't toBool(const char* str) broken? I don't see how it could ever return "strlen(str)" the way it's structured at the moment. Also, what is the purpose of such a function? There's no way for it to judge whether strings are true or not so how would it actually decide what value to convert strings to? The other functions look equally useless to me (in a nutshell, integers greater than zero become 1 and integers equal to zero become 0, right?) - although I'm not familiar with AngelScript per se so maybe this is a useful operation.
08-28-2013, 09:05 PM
Find


Messages In This Thread
RE: Updating script support, taking requests - by Bridge - 08-28-2013, 09:05 PM



Users browsing this thread: 3 Guest(s)