Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-21-2009, 09:06 PM
Scouser Scouser is offline
Registered User
Join Date: Oct 2009
Posts: 63
Scouser is an unknown quantity at this point
Looking for...

Hey, so im looking for a few things to do with Scripting.
The main thing im looking for is a teacher. Well not so much a teacher but some one to give me a step by step guide of what i should do. I.E: Script this, if you have any problems talk to me via AIM/MSN. Really somebody to tell me what to do, and what ive done wrong.
The other thing i was looking for is an all in one scripting guide for a beggining scripter with the new scripting language.
I already read through that GraalWiki thing on scripting and a few other things but i didnt really pick up on what the hell they were talking about and how i could put that into an everday script like a gun system, disabling swords, lighting effects etc etc.
If anybody would like to help me with these things you can post here or talk on aim to me via: luke10050
By the way i read through the Gscript2 for Dummies guide!
Thanks
-Luke

Last edited by Scouser; 10-21-2009 at 09:34 PM.. Reason: no need for that
Reply With Quote
  #2  
Old 10-21-2009, 09:35 PM
Imperialistic Imperialistic is offline
graal player lord
Imperialistic's Avatar
Join Date: Apr 2007
Location: Florida
Posts: 1,094
Imperialistic is a jewel in the roughImperialistic is a jewel in the rough
Quote:
Originally Posted by Scouser View Post
Hey, so im looking for a few things to do with Scripting.
The main thing im looking for is a teacher. Well not so much a teacher but some one to give me a step by step guide of what i should do. I.E: Script this, if you have any problems talk to me via AIM/MSN. Really somebody to tell me what to do, and what ive done wrong.
The other thing i was looking for is an all in one scripting guide for a beggining scripter with the new scripting language.
I already read through that GraalWiki thing on scripting and a few other things but i didnt really pick up on what the hell they were talking about and how i could put that into an everday script like a gun system, disabling swords, lighting effects etc etc.
If anybody would like to help me with these things you can post here or talk on aim to me via: luke10050

Thanks
-Luke
I'm not a scripter but I have tried to learn using Twinny's guide.. It's less complicated and more simple maybe you can make some use of it:
http://gs2.graalstudios.com/index.php?page=basic

Also, I'm pretty sure people will not just simply give out scripts for you, but if you build something, even something as simple as a door, there are plenty of helpful scripters willing to give you advice and etc.

If you need any visual help, I would refer to the Code Gallery:
http://forums.graalonline.com/forums...play.php?f=179
__________________
" It's been swell, but the swelling's gone down. "
Reply With Quote
  #3  
Old 10-21-2009, 09:44 PM
Scouser Scouser is offline
Registered User
Join Date: Oct 2009
Posts: 63
Scouser is an unknown quantity at this point
Quote:
Originally Posted by Imperialistic View Post
I'm not a scripter but I have tried to learn using Twinny's guide.. It's less complicated and more simple maybe you can make some use of it:
http://gs2.graalstudios.com/index.php?page=basic

Also, I'm pretty sure people will not just simply give out scripts for you, but if you build something, even something as simple as a door, there are plenty of helpful scripters willing to give you advice and etc.

If you need any visual help, I would refer to the Code Gallery:
http://forums.graalonline.com/forums...play.php?f=179
I didnt mean give scripts out, i ment tell me what to make and like how to make it. Like in all of these scripting guides they give u stuff like variables, strings, and the math stuff, but i have no idea how id use it. I just mean i like wanted somebody to go to, to ask these quistions instead of repeatedly having to wait for a few hours for a decent reply. And thanks ill have a look at twinnys guide later.
Reply With Quote
  #4  
Old 10-21-2009, 09:57 PM
Imperialistic Imperialistic is offline
graal player lord
Imperialistic's Avatar
Join Date: Apr 2007
Location: Florida
Posts: 1,094
Imperialistic is a jewel in the roughImperialistic is a jewel in the rough
Maybe I can give you a simple example. (but I'm mostly generalized to levels)

Okay lets say we want to create a door correct?

I'm going to piece it together.

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
this.setShape(13232);
  
this.setImg("block.png");

This is basically creating the door and setting the image there.


Now, to make the door dissappear when you say "open" this is what you'll have to do:

PHP Code:
function onPlayerChats()
{
    if (
player.chat == "open")
    {
      
hide();
   }
 } 
I'm not much of a scripter, but that pretty much shows examples of what different stuff does.
__________________
" It's been swell, but the swelling's gone down. "
Reply With Quote
  #5  
Old 10-21-2009, 10:31 PM
Scouser Scouser is offline
Registered User
Join Date: Oct 2009
Posts: 63
Scouser is an unknown quantity at this point
Okay i get that, but would there be a way to like set a timer for that?
like every 60 seconds it opens for 2 seconds etc etc.
Really i just want to explore possibilities and what i might need.
Reply With Quote
  #6  
Old 10-21-2009, 10:32 PM
Imperialistic Imperialistic is offline
graal player lord
Imperialistic's Avatar
Join Date: Apr 2007
Location: Florida
Posts: 1,094
Imperialistic is a jewel in the roughImperialistic is a jewel in the rough
Yeah, just wait for an experinced scripter to come on the forums, I'm sure he/she will help you with stuff like that.
__________________
" It's been swell, but the swelling's gone down. "
Reply With Quote
  #7  
Old 10-21-2009, 10:40 PM
Scouser Scouser is offline
Registered User
Join Date: Oct 2009
Posts: 63
Scouser is an unknown quantity at this point
k, thanks.
Reply With Quote
  #8  
Old 10-22-2009, 12:41 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
The best way I started learning (and keep learning) is looking at the graal wiki. Look around at some of the codes posted up here. See how they work. If you dont know what something is, usually you can search it on the graal wiki and find out.

http://www.graal.net
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #9  
Old 10-22-2009, 01:06 AM
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
Trial and error and perhaps knowing some basics of another scripting language can help greatly, then looking through the code gallery and asking yourself what some line of code does.
__________________
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
  #10  
Old 10-22-2009, 01:16 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Scouser View Post
Okay i get that, but would there be a way to like set a timer for that?
like every 60 seconds it opens for 2 seconds etc etc.
Really i just want to explore possibilities and what i might need.
This is it basically, the script you're looking for is pretty basic and one you can learn from too.

PHP Code:
function onCreated() {
  
setimg("door.png");  // Sets Image as a Door
  
setTimer(60);        // Begins Timer
}

function 
onTimeout() {
  
hide();   // Hides Door
  
sleep(2); // Pauses Script for 2 Seconds
  
show();   // Shows Door
  
setTimer(60); // Continues Timer

The above is unoptimized code and will continue running while there are no players in the level which should be avoided, usually through a small snippet like the following (in the same script).

PHP Code:
function onPlayerEnters() {
  
// Check if a player just entered and the level was empty before
  
if (players.size() == 1setTimer(60);
}

function 
onTimeout() {
  if (
players.size() < 1) return; // Halts script because there are no players in the level.
  // Other Code
  
setTimer(60);

__________________
Quote:
Reply With Quote
  #11  
Old 10-22-2009, 04:29 PM
Scouser Scouser is offline
Registered User
Join Date: Oct 2009
Posts: 63
Scouser is an unknown quantity at this point
Ahh thanks Jerret, thanks for that
onPlayerEnters() tip aswell very helpfull.
Reply With Quote
  #12  
Old 10-22-2009, 04:31 PM
Door Door is offline
Empress Door the Unhinged
Door's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 849
Door is a splendid one to beholdDoor is a splendid one to beholdDoor is a splendid one to beholdDoor is a splendid one to behold
Someone called?
__________________
Reply With Quote
  #13  
Old 10-22-2009, 06:25 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
Scouser randomly coding away will also help you learn, just do some basic random things and you'll learn from experience.

Quote:
Originally Posted by Door View Post
Someone called?
hide(); // Hides Door
__________________
Reply With Quote
  #14  
Old 10-22-2009, 06:49 PM
Scouser Scouser is offline
Registered User
Join Date: Oct 2009
Posts: 63
Scouser is an unknown quantity at this point
:O
Hmm, so i know this is the rookiest question uve probably heard but...
If i was to make a script like Jerret's, would that script be put into 1 of the NPC's in an actual level via graal level editor? or would it be added via a weapon on the RC.
I was also wondering on how you would setup a command such as
if i wanted a GUI to pop up when i say /gang or whatever.
like a trigger i guess.
Reply With Quote
  #15  
Old 10-22-2009, 07:42 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Quote:
Originally Posted by Scouser View Post
:O
Hmm, so i know this is the rookiest question uve probably heard but...
If i was to make a script like Jerret's, would that script be put into 1 of the NPC's in an actual level via graal level editor? or would it be added via a weapon on the RC.
I was also wondering on how you would setup a command such as
if i wanted a GUI to pop up when i say /gang or whatever.
like a trigger i guess.
Weapon scripts are primarily for Systems and so on like GUIs.

Commands in weapon scripts can be done using:

PHP Code:
//This also works on the serverside
//#CLIENTSIDE
function onPlayerChats() {
  if (
player.chat == "/command") {
    
player.chat "."// Clears Chat 
    
doWhatever();      // Performs Command
  
}

or (my preferred way for weapon scripts)

PHP Code:
//This only works on the clientside.
//#CLIENTSIDE
function ChatBar.onAction() {
  if (
ChatBar.text == "/command") {
    
ChatBar.text ""// Deletes Text from ChatBar
    
doCommand();       // Performs Command
  
}

The door script I posted above would typically go in a class script and you would have the level scripts join that class if you plan on re-using it multiple times.

If you're unaware of class scripts or how to use them, you can get away with just putting the script in a level npc.
__________________
Quote:

Last edited by fowlplay4; 10-22-2009 at 08:42 PM..
Reply With Quote
  #16  
Old 10-22-2009, 08:25 PM
Scouser Scouser is offline
Registered User
Join Date: Oct 2009
Posts: 63
Scouser is an unknown quantity at this point
Thanks Jerret!
Now ill just go inspect the Code Gallary on the wiki then :O
Reply With Quote
  #17  
Old 10-23-2009, 02:45 AM
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 Scouser View Post
I was also wondering on how you would setup a command such as
if i wanted a GUI to pop up when i say /gang or whatever.
like a trigger i guess.
http://graal.net/index.php/Creation/...iControls_List should be of use and using the Client RC's GUI Creator should help you better understand.
__________________
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
  #18  
Old 10-25-2009, 02:10 PM
Scouser Scouser is offline
Registered User
Join Date: Oct 2009
Posts: 63
Scouser is an unknown quantity at this point
Thanks switch, shining a light on my day!
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 01:48 AM.


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