![]() |
Simple command Questions
I'm new to Gscripting and now that theres a second version.. Well I'm very lost =X
Anyway, I'm trying to get a npc to display a simple line of text so that I may use it for other scripts. However, the ones I've tried won't work online. I need to figure this out so I can learn how to use classes and make basic programs like a calculator. So what command should I use o.o showtext(); and if so could you provide a usage example? |
Quote:
|
Quote:
|
Quote:
What I was planning on doing, was using that basic script hopefully provided to me, and use it to make a class. Basically, I'm trying to store a few variables (name, age, and a list of items; the different kinds of vars) and provide functions that would allow me to call for the display of them. Eventually I would provide functions to allow me to change the vars in game and create instances of that template. I'm just trying to get used to the overall format and usage. |
I've also taken the list of updated commands and have been organizing them in a logical order; like the packages in java. That way I'll be able to remember them with ease.
|
Quote:
|
Quote:
|
Quote:
|
Aye, when learning Java, I was in awe at how much GS2 resembled it.
|
I prefer C++ because it's not as strongly typed, although I'd prefer the Java syntax.
|
Quote:
|
Quote:
|
Java's arrays are like a class with a read-only size variable. You can't go out of bounds in a Java array. The size variable is nice, but you can make a list class in C++ that would be better than a Java array because in C++ you can override certain operators and in Java you can't override any operators. In Java you can't have two derived class types and in C++ you can. Java is more strongly typed to better guard against security holes. Java has the built in garbage collector thing and C++ doesn't. Java's syntax has a much nicer structure and promotes readability more than C++. In my opinion, Java's library overstates readability in the sense that it makes things less readable sometimes, but any programmer can do that. Also, Java is platform independent. My thumb is bleeding.
|
Quote:
Java methods can be declared "native" which means that they are not implemented in Java but in an external library, in regular machine code. You can then have a program generate a C header file with the C counterparts to the native function's declaration, and then you can implement the functions. The implementation can be in C++ (as long as you do the whole extern "C" thing or in Pascal or ASM or whatever as long as the functions use the expected calling conventions. Yeah, it is not generally something you want to do all the time, even if you have an existing C++ library, you need to write special wrappers in C and in Java to be able to use it from Java. |
Quote:
Java is basically simpler than C++, and it has a ****ton of pre-written libraries, which is both good and bad. Personally if you're going to write something that you're going to use or distribute I think it makes much more sense to do it in C/C++ if you are capable. Also about the Arrays, Java has ArrayLists I believe which do not have to be defined as a certain length. I think the concept of arrays that cannot change sizes is kind of defeating. It has a few practical uses but it seems to be more of a hassle than it is worth. 99.9% of the time that I use arrays it's dynamic and I am not sure of how many elements it has to it. I just don't like Java overall, I hardly show up to my Java class anymore =/ My professor was going to let me test out of both of the java programming classes we have here but she wasn't going to give me credits. Oh well, easy A's are easy A's. |
Projectshifter, ArrayLists are obviously dynamically allocated and mutable with the class doing the memory allocation for you. Normal arrays must have a predetermined length, and you cannot change that length. It's like having String and StringBuffer, and I don't like having to type out StringBuffer.
|
Quote:
C++ arrays are as unresizable as Java arrays. |
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 11:16 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.