About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Code Editor Question
Author Message
aceio76 Offline
Silver Supporter

Post: #1
Code Editor Question
How do you write the following code to Esenthel Code?
Code:
struct Oooooo
{
    Str mystring;
    Oooooo(Str s) {T.mystring=s;}
};
Is it:
Code:
class Oooooo
{
    Str mystring;
    Oooooo(Str s) {T.mystring=s;}
}
So that I can use it this way:
Code:
Oooooo xxx("test");

www.thinkplaystudios.com
09-08-2011 02:24 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #2
RE: Code Editor Question
Whats wrong with using struct?
also why not use C Str &s ?
09-08-2011 02:31 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #3
RE: Code Editor Question
This is actually from C++ to Esenthel Code. No problem with structs smile I just need to know how to write it in the code editor.

www.thinkplaystudios.com
09-08-2011 02:34 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #4
RE: Code Editor Question
Oh, I was...nevermind, my eyes are getting tired didn't read Esenthel Code, only saw with Esenthel.
but yeah, that is how it should be done.
(This post was last modified: 09-08-2011 02:37 AM by Zervox.)
09-08-2011 02:36 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #5
RE: Code Editor Question
There are other ways to accomplish this, I am just trying to understand how it would be written as ES (if there is a way or not).

www.thinkplaystudios.com
09-08-2011 02:38 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #6
RE: Code Editor Question
I would imagine it is pretty much the same as in C++(close atleast)

Code:
class clasobj
{
   Str   text;
   // / set
   void set(Str   text) {T.text=text;}
}

practically ended up the same as yours, so yes this is one way,(is yours not working?)
(This post was last modified: 09-08-2011 02:43 AM by Zervox.)
09-08-2011 02:41 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #7
RE: Code Editor Question
Using:
Code:
void set(Str   text) {T.text=text;}
was the way I can compile it, but I cannot use it in this way:
Code:
Oooooo xxx("test");
I have to:
Code:
Oooooo xxx;  xxx.set("test");

This is really just an exploration of how the Code Editor would take something as simple as the above.

www.thinkplaystudios.com
09-08-2011 02:48 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #8
RE: Code Editor Question
Code:
class test
{
   Str text;
  
   test(Str s) {T.text=s; LogN(S+text);};
};

test dest("what test?");

worked for me in ES
(This post was last modified: 09-08-2011 03:27 AM by Zervox.)
09-08-2011 02:56 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #9
RE: Code Editor Question
Was it as simple as adding a semicolon to the end of the line:
Code:
test(Str s) {T.text=s; LogN(S+text);};

It looks like it works that way!

www.thinkplaystudios.com
09-08-2011 03:28 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #10
RE: Code Editor Question
test(Str s) {T.text=s; LogN(S+text);};
test(Str s) {T.text=s; LogN(S+text);}
both these works for me

I always do add ; at the end even though it is not needed but I like to have some standard to things.(even if it means some extra bits to the saved file) pfft
(This post was last modified: 09-08-2011 03:31 AM by Zervox.)
09-08-2011 03:30 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #11
RE: Code Editor Question
Wait, it still errors out. When I open the code into Visual Studio (Play | Open in Visual Studio), the line shows:
Code:
test::test(Str s) {T.text=s; LogN(S+text);}
but it should be just:
Code:
test(Str s) {T.text=s; LogN(S+text);}

www.thinkplaystudios.com
09-08-2011 03:36 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #12
RE: Code Editor Question
Hmm, only error I could see is that if I open it in visual studio through Code Editor, is that

Code:
enum VIEW_MODE
{
   VIEW_FPP,
   VIEW_TPP,
   VIEW_ISO,
   VIEW_NUM,
};

class test
{
   Str text;
  
   test(Str s) {T.text=s; LogN(S+text);}
};
is replaced with
;

;

but both play, and compiling it in Code Editor works without problem.
(This post was last modified: 09-08-2011 03:40 AM by Zervox.)
09-08-2011 03:40 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #13
RE: Code Editor Question
I think there's a bug in the conversion back when viewing with Visual Studio, although it still compiles.

www.thinkplaystudios.com
09-08-2011 03:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #14
RE: Code Editor Question
Seems so.
09-08-2011 03:43 AM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #15
RE: Code Editor Question
More info: it looks like there is a header file that it creates when opening into Visual Studio from the Code Editor, and it is correct:
Code:
test(Str s) {T.text=s; LogN(S+text);}
But in the cpp file, it repeats it again, but as:
Code:
test::test(Str s) {T.text=s; LogN(S+text);}

www.thinkplaystudios.com
09-08-2011 03:44 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply