Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-13-2006, 01:37 PM
Wryoko Wryoko is offline
Registered User
Join Date: Mar 2006
Posts: 18
Wryoko is on a distinguished road
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?
Reply With Quote
  #2  
Old 03-13-2006, 07:44 PM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
Quote:
Originally Posted by Wryoko
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?
There is the ever popular obj.chat var, but for showtext() it's basically like it was before, and if you need further help with that, I point you to the Wiki, that's what it's there for
__________________
Who has time for life these days?
Reply With Quote
  #3  
Old 03-13-2006, 09:28 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Wryoko
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?
Take a dive into object oriented programming and then you might be able to better understand ;P
Reply With Quote
  #4  
Old 03-14-2006, 03:15 AM
Wryoko Wryoko is offline
Registered User
Join Date: Mar 2006
Posts: 18
Wryoko is on a distinguished road
Quote:
Originally Posted by jake13jake
Take a dive into object oriented programming and then you might be able to better understand ;P
Oh I have. I learned enough java to go through a script and understand the overall flow. I've printed out tutorials from Wiki and have been studying them for about four or five days now. However I learn better when I see a script, that isn't out dated and that I'm able to tweak and chop up to use in other scripts. I know it seems as if I'm just another one of those people looking for an easy script for their server, but I'm honestly trying to learn how to do this on my own.

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.
Reply With Quote
  #5  
Old 03-14-2006, 03:16 AM
Wryoko Wryoko is offline
Registered User
Join Date: Mar 2006
Posts: 18
Wryoko is on a distinguished road
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.
Reply With Quote
  #6  
Old 03-14-2006, 03:35 AM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by Wryoko
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.
You could probably do that directly on the wiki too.
Reply With Quote
  #7  
Old 03-14-2006, 04:06 AM
Wryoko Wryoko is offline
Registered User
Join Date: Mar 2006
Posts: 18
Wryoko is on a distinguished road
Quote:
Originally Posted by jake13jake
You could probably do that directly on the wiki too.
Uh I got it from wiki. Well the newly implemented commands are together and all but the old ones aren't as much as I'd like.
Reply With Quote
  #8  
Old 03-14-2006, 04:17 PM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
Quote:
Originally Posted by Wryoko
Oh I have. I learned enough java to go through a script and understand the overall flow.
Think java without the datatypes, and without privitized vars. The new engine is fun =)
__________________
Who has time for life these days?
Reply With Quote
  #9  
Old 03-14-2006, 08:11 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Aye, when learning Java, I was in awe at how much GS2 resembled it.
Reply With Quote
  #10  
Old 03-14-2006, 10:24 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
I prefer C++ because it's not as strongly typed, although I'd prefer the Java syntax.
Reply With Quote
  #11  
Old 03-15-2006, 04:18 AM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
Quote:
Originally Posted by jake13jake
I prefer C++ because it's not as strongly typed, although I'd prefer the Java syntax.
I dunno, I'd argue that they're both equally typed, and perhaps C++ would beat it out a bit considering that it runs at a much lower level and has access to things such as pointers etc. Java sucks =(
__________________
Who has time for life these days?
Reply With Quote
  #12  
Old 03-15-2006, 06:34 AM
Zero Hour Zero Hour is offline
Stiff Upper Lip
Zero Hour's Avatar
Join Date: Oct 2006
Location: Nova Scotia, Canada
Posts: 0
Zero Hour is on a distinguished road
Send a message via AIM to Zero Hour
Quote:
Originally Posted by Projectshifter
I dunno, I'd argue that they're both equally typed, and perhaps C++ would beat it out a bit considering that it runs at a much lower level and has access to things such as pointers etc. Java sucks =(
Call me a newb, and paint me green - but couldn't you make some sort of mad C++ DLL that java could use?
__________________
Reply With Quote
  #13  
Old 03-15-2006, 08:31 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
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.
Reply With Quote
  #14  
Old 03-16-2006, 01:34 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally Posted by Zero Hour
Call me a newb, and paint me green - but couldn't you make some sort of mad C++ DLL that java could use?
You can!

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.
Reply With Quote
  #15  
Old 03-17-2006, 12:41 AM
Projectshifter Projectshifter is offline
The David
Projectshifter's Avatar
Join Date: Apr 2002
Location: USA
Posts: 912
Projectshifter is an unknown quantity at this point
Send a message via ICQ to Projectshifter Send a message via AIM to Projectshifter Send a message via MSN to Projectshifter Send a message via Yahoo to Projectshifter
Quote:
Originally Posted by jake13jake
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.
I dislike using the term platform independent because it implies that you have the Java VM installed, but by the same token you can use GTK+ or SDL/OpenGL etc and have the same level of platform independency as you have with Java. Granted you'd have different binaries for each platform, but at the same time they are actually executable and don't require it to feed everything through the Java VM.

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.
__________________
Who has time for life these days?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 07:53 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.