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
  #46  
Old 05-16-2007, 05:49 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Andy0687 View Post
Stuff
I didn't get mad or upset about that. :O Also, that would have been the first time I attempted to learn. Not the second, in which I was successful.

You'll also notice James, that I had good reasoning behind the things I said. If I have an attitude it's because of personal reasons, and that isn't anything to discuss here and you're both ( and rapidwolve ) right that I shouldn't be taking it out on people.

And, what I'm saying now is stemming from other encounters with Switch involving him acting like a brass-assed monkey.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #47  
Old 05-16-2007, 06:36 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by killerogue View Post
Not the second, in which I was successful.
According to whom?
__________________
- Zidane / Zidaya
Reply With Quote
  #48  
Old 05-16-2007, 06:38 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Deadly_Killer View Post
According to whom?
Good one!

But in terms of success, I mean being able to understand and use gscript, somewhat effectively I guess.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #49  
Old 05-16-2007, 07:17 AM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by killerogue View Post
Good one!

But in terms of success, I mean being able to understand and use gscript, somewhat effectively I guess.
__________________
- Zidane / Zidaya
Reply With Quote
  #50  
Old 05-16-2007, 07:51 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I try to teach lots of people GS2 who choose to come to me and it usually works rather well. I PERSONNALY believe the best way to start teaching it is to explain the following:
- How a script is read (compiled together and all the functions are stored to be run when "called")
- The 2 different things you can do in a gs2 script (call functions and set variables)
- How functions work (Also: calling built-in functions [such as onCreated()] and redefining built-in functions [such as function show() {}])
- The 4 variable types: (Float, String, Object, Array)

I believe the last of those things to be the MOST important to actually grasp the concepts of gs2 coding. I am a GUI man though, so my ideas may just be biased as I use objects a lot.

If anyone wants to try to make a guide like such, feel free!
I should get around to actually making one sometime (when I'm not so swamped D: ).
__________________
Do it with a DON!
Reply With Quote
  #51  
Old 05-16-2007, 08:19 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Thought I'd do my best to explain objects simply, and a few things of what you can do with them.

This Lesson One, focuses mainly on using text files with objects.

PHP Code:
// Lesson 1: Objects and How They Work

// Today we're going to make objects and use a few object functions!
// Objects must be created by making TStaticVars like below:

// temp.objName = new TStaticVar();

// Keep in mine, the capitalization in my var name is just a stylistic
// choice and has no effect on the outcome of the script. Tho, it's
// a good idea to make sure you've got all the capitalization correct 
// when using TStaticVars() and things like it!

// Let's Begin!

function onCreated()
{
  
temp.newObj = new TStaticVar(); // Here we create the object.
  
  // Below we will define some variables of the new object
  // It being a created object, we can create as many vars
  // as we want for the damn thing. :)
  
  
temp.newObj.personOne   "Stan";
  
temp.newObj.personTwo   "Zero";
  
temp.newObj.personThree "Twinny";
  
temp.newObj.personFour  "James";
  
  
// With the newly created variables above, there are a number 
  // of things you can do with the information stored in each variable
  // in the object.
  
  // Let's look at a few!
  
  // * - Files - * \\
  // Here we will save the vars into a text file:
  
  // temp.newObj.saveVars("textfilepath/textfilename.txt", 0);
  
  // Keep in mind saveLines is another form of saving variables
  // from objects into text files. However it saves each var line
  // for line. I'm not too big on explanations right now as I don't
  // use saveLines often.
  
  // The first param for saveVars() is pretty obvious. :p
  // The second param however, decides whether the file is overwritten,
  // or merely if the file is just added onto!
  
  
  // Having saved these informations into a text file, we can then later
  // receive this information through a command we shall learn in the next
  // lesson, dubbed: loadVars();
  
  /* Special Practice Notes:
        1. Things like saveVars(), or loadVars() are object only functions.
           Meaning they can only be attached onto the tail of an object that
           has, or in the case of loadVars sometimes, doesn't have information in it.
  */
}

// Lesson 1: Objects and How They Work, cont.

  // Now that you understand the basics of objects and how you can understand the 
  // uses and storing of informations inside of them. Let's look a bit deeper
  // our target for this lesson is loadVars.
  
  // Now, when you first create an object, it usually has nothing in it.
  // Of course that applies to IF you create the object first, but in my opinion,
  // it's always best to clearly state out the new static variable assignment.
  
  //Like before loadVars is am object only function, let's take a look at it's use.
  
  
function onStuff()
  {
    
// Again we create the object.
  
    
temp.newObj = new TStaticVar();
    
    
// Now we load the vars from a text file, consider your test text file is named
    // test.txt. And it contains the 5 names from before. We simply do this:
    
    
temp.newObj.loadVars("test.txt");
    
    
// But what if you wanted to get the information from an object through a script?
    // We certainly can't just yank it out now can we? Of course not!
    
    // There's only one sure shot thing that can get us the variables we want, 
    // and it's an object function! Aptly named, getDynamicVarNames().
    
    // Dynamic variables are variables that never stay the same and could change
    // at any time they or the person controlling them wishes for them to.
    
    // Now the way to access the dynamic variables is a bit more difficult than the talk
    // that's been going on around here. We're going to use a "for each" look,
    // to go through the dynamic var names of an object.
    
    // The for each loop allows us to apply a variable name to each piece of information
    // in an array. So let's do something like this:
    
    
for (temp.oVtemp.newObj.getDynamicVarNames()) // In case you were wondering, getDynamicVarNames returns an array allowing for a for each loop to have it's way with the text file/
    
{
      
temp.someArray.add(temp.oV);
    }
    
// We can now echo all the information from the dynamic variables in the object because
    // the for each loop going through the values, added each value to "temp.someArray" one value
    // at a time.
    
    // Now that array contains all the information from the object. A simple way to echo all this info.
    // to RC. Like so:
    
    // echo(temp.someArray);
  

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.

Last edited by killerogue; 05-16-2007 at 08:32 AM..
Reply With Quote
  #52  
Old 05-16-2007, 08:45 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
The problem with that as being a starting tutorial Stan is, You don't exactly explain what a function or object IS.
__________________
Do it with a DON!
Reply With Quote
  #53  
Old 05-16-2007, 09:19 AM
Pimmeh Pimmeh is offline
Rgesitreed Uesr
Pimmeh's Avatar
Join Date: May 2007
Location: Utrecht, the Netherlands
Posts: 1,586
Pimmeh has a spectacular aura about
Send a message via AIM to Pimmeh Send a message via MSN to Pimmeh
I think the most important thing for me, and I think others as well, is to have a list of thingies that I can pull out of my sleeve while scripting... I learned the very basics (compared to dontblock;drawoverplayer shizzle from GS1) from Chandler (cool guy btw ) but I really should find someone to learn the more complex things like setting a UI or a staffblock that you can spawn with a mouseclick if you have a certain weapon ready.
But the most important thing is how the heck I can be able to UNDERSTAND what is happening in really important scripts. This helped me a lot with GS1.
__________________
Oh, Death,
No wealth, no ruin, no silver, no gold
Nothing satisfies me but your soul
Reply With Quote
  #54  
Old 05-16-2007, 12:56 PM
Crono Crono is offline
:pluffy:
Join Date: Feb 2002
Location: Sweden
Posts: 20,000
Crono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond reputeCrono has a reputation beyond repute
gscript 2 is just more confusing for nublets (hell it confuses me). experiment offline with gscript 1 to learn the basics then move on to gscript 2.

im sure im one of the few here who has this opinion though
__________________
Reply With Quote
  #55  
Old 05-16-2007, 01:56 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
Quote:
Originally Posted by Rapidwolve View Post
Yeah I know, I am a regular user of your wiki. Was getting ready to contribute more functions but it was down.
It seems to be back up now!

http://skyld.vip.graal.net/
__________________
Skyld
Reply With Quote
  #56  
Old 05-16-2007, 02:14 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Skyld View Post
It seems to be back up now!

http://skyld.vip.graal.net/
Yay!
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #57  
Old 05-16-2007, 02:20 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
I personally just think it depends the type of person. GS2 was a ton easier to understand for me then GS1 was.

GS2 is easier for people that are in the mindset of object oriented coding. Otherwise, it seems a ton harder then GS1.
__________________
Do it with a DON!
Reply With Quote
  #58  
Old 05-16-2007, 09:06 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Quote:
Originally Posted by Gerami View Post
gscript 2 is just more confusing for nublets (hell it confuses me). experiment offline with gscript 1 to learn the basics then move on to gscript 2.

im sure im one of the few here who has this opinion though
I also anyone who wants to learn how to GScript should start with GS1, this way they can get all the practice they want and its offline so they can't do any harm to a server. Converting from GS1 to GS2 is really easy, so once you got GS1 down you pretty much have GS2 down, atleast thats how it was for me.

Quote:
Originally Posted by Skyld View Post
It seems to be back up now!

http://skyld.vip.graal.net/
Yay
Reply With Quote
  #59  
Old 05-16-2007, 09:25 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by DustyPorViva View Post
Sadly I find the wiki lacking one thing(I've yet to see skyld's though), and that is actually what goes in commands. All it tells you is if it's a floating, integer, or string. That doesn't really help much...

Anyways, for Switch:
PHP Code:
function onCreated() 
{
  
player.chat "Stuff.";

function onCreated() // This is a function. Before GS2, things like this were called in events. Basically, if it happened, execute any code in the parenthesis. In GS1, it would be if (created) {}, but all that changed in GS2. Events were translated into their own functions. So basically this means, when the NPC is created, execute everything in the parenthesis.

{...} // As explained above, parenthesis are closed around any amount of commands executed when an event is called. All commands must be executed with an event/function and closed inside parenthesis.

player.chat = "Stuff."; // player.* is associated with anything for the player. This can be player.hearts, for their hearts, player.ap, for their ap, player.x, for their x coordinate, and so on. So, taking that, and taking the knowledge that = is assign, means that you are assigning something to the player's chat, which means you'll force them to say something. "Stuff." is a string. A string is alphanumerical. That means anything not a variable, floating value, integer, has to be enclosed in quotes, or else it won't be assigned. If you want to get basic, text has to be in quotes. And lastly, the semi-colon has to be after every command. Anytime you do 'something' end it with a semi-colon before you move onto the next thing.
Except what's CREATED mean, then?

Quote:
Originally Posted by Rapidwolve View Post
The world would be a better place if there were more people like you.
Definitely
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #60  
Old 05-16-2007, 09:28 PM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
CREATED is when the weapon is first initialized or updated.
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 02:03 PM.


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