Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Looking for... (https://forums.graalonline.com/forums/showthread.php?t=134256592)

Scouser 10-21-2009 09:06 PM

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

Imperialistic 10-21-2009 09:35 PM

Quote:

Originally Posted by Scouser (Post 1532813)
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

Scouser 10-21-2009 09:44 PM

Quote:

Originally Posted by Imperialistic (Post 1532849)
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.

Imperialistic 10-21-2009 09:57 PM

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.

Scouser 10-21-2009 10:31 PM

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.

Imperialistic 10-21-2009 10:32 PM

Yeah, just wait for an experinced scripter to come on the forums, I'm sure he/she will help you with stuff like that.

Scouser 10-21-2009 10:40 PM

k, thanks.

sssssssssss 10-22-2009 12:41 AM

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

Switch 10-22-2009 01:06 AM

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.

fowlplay4 10-22-2009 01:16 AM

Quote:

Originally Posted by Scouser (Post 1532913)
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);



Scouser 10-22-2009 04:29 PM

Ahh thanks Jerret, thanks for that
onPlayerEnters() tip aswell very helpfull.

Door 10-22-2009 04:31 PM

Someone called?

Crono 10-22-2009 06:25 PM

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 (Post 1533202)
Someone called?

hide(); // Hides Door

Scouser 10-22-2009 06:49 PM

: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.

fowlplay4 10-22-2009 07:42 PM

Quote:

Originally Posted by Scouser (Post 1533238)
: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.

Scouser 10-22-2009 08:25 PM

Thanks Jerret!
Now ill just go inspect the Code Gallary on the wiki then :O

Switch 10-23-2009 02:45 AM

Quote:

Originally Posted by Scouser (Post 1533238)
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.

Scouser 10-25-2009 02:10 PM

Thanks switch, shining a light on my day!


All times are GMT +2. The time now is 02:55 AM.

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