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
  #81  
Old 05-05-2011, 12:54 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Devil_Lord2 View Post
Hey Chompy, on the Graal news / F1 page it says:

"If you wish to participate, simply click here to fill out the submission form. (Be sure to include your email for contact information.) "


And when I click the link, it takes me to a

"Page not found

The page you request is not available on GraalOnline. We take in note to try to correct the problem. Please, back to home page

(Click here if your browser does not automatically forward you)
"

Page.


I don't know if it was linked bad, or not created yet, but I thought you should know..

I have nothing to do with that form

I add people who pm me here on the forums pretty fast, all depending on if I'm sleeping or not
__________________
Reply With Quote
  #82  
Old 05-05-2011, 01:24 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by oo_jazz_oo View Post
I dont see a huge problem in using one line codes without brackets for certain instances.
PHP Code:
function check(xy) {
  if (
== y) return true;

Like in that instance. Does it really make it any more readable...any more efficient...any more anything by adding the brackets?
Yes, it makes it more readable, and it makes it easier to expand upon, especially if some parts of the code aren't properly indented. There are tons of arguments for this on stackoverflow and other programming sites—check them out.
__________________
Reply With Quote
  #83  
Old 05-05-2011, 01:26 AM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
Quote:
Originally Posted by oo_jazz_oo View Post
I dont see a huge problem in using one line codes without brackets for certain instances.
PHP Code:
function check(xy) {
  if (
== y) return true;

Like in that instance. Does it really make it any more readable...any more efficient...any more anything by adding the brackets?
Bad example because if you're going to take shortcuts, take the best shortcut.

PHP Code:
function check(xy) {
  return 
temp.== temp.y;

In general, I try to always include brackets for one-line statements. Consistency not only improves readability (imo), but it makes your code a lot less error-prone.

If you start saying "oh, well in this instance is it really a problem?" your styling is probably very confusing and inconsistent, and you're much more likely to **** up.
__________________
Reply With Quote
  #84  
Old 05-05-2011, 01:31 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by oo_jazz_oo View Post
I dont see a huge problem in using one line codes without brackets for certain instances.
PHP Code:
function check(xy) {
  if (
== y) return true;

Like in that instance. Does it really make it any more readable...any more efficient...any more anything by adding the brackets?
On first site I would say it was a mistake, and fix it to have brackets..
I agree not to teach like this, but if you are the only one ever going to touch your scripts.. I suppose it doesn't matter if it works for you.. lol

But if someone in the future may have to go over it.. Again it could confuse them... I'm not totally experienced in programming, so I don't know, others may be able to pick it up what it means faster.. Even if I did pick it up, I'd take the time to fix it towards a common style for others and myself in case I look at it again in the future.




Quote:
Originally Posted by salesman View Post
PHP Code:
function check(xy) {
  return 
temp.== temp.y;

This would return true if true? and if it isn't the same, it would still return false?


I'm only wondering because I would do:
this.variable = 0;
if (this.variable == 1){
dostuff();
}

I use 0 and 1.. and later on if I need to I can increase it if I want it to be 2, 3, or 4.. but even if it stays on and off, true or false, I still use 0 and 1.. should I start doing true and false for those special things that only use true or false?
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #85  
Old 05-05-2011, 01:36 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
This is a good example of why it's bad:

PHP Code:
function whatever()
  for (
aallplayers)
    
with (a)
      if (
player.account == "wat")
       do(
player); 
If you want to obscure your code and make it much harder for others to maintain then carry on with bad practices such as that.
__________________
Quote:
Reply With Quote
  #86  
Old 05-05-2011, 01:37 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Devil_Lord2 View Post
On first site I would say it was a mistake, and fix it to have brackets..
I agree not to teach like this, but if you are the only one ever going to touch your scripts.. I suppose it doesn't matter if it works for you.. lol

But if someone in the future may have to go over it.. Again it could confuse them... I'm not totally experienced in programming, so I don't know, others may be able to pick it up what it means faster.. Even if I did pick it up, I'd take the time to fix it towards a common style for others and myself in case I look at it again in the future.
It is good practice to always format well, even if you're the only person who is going to see it. You will generally make less mistakes.


Quote:
This would return true if true? and if it isn't the same, it would still return false?
It will return the result of the statement.

PHP Code:
echo(== 1); // echoes true
echo(== 0); // echoes false
echo("a" == "a"); // echoes true
echo((2) == 7); // echoes true 
__________________
Reply With Quote
  #87  
Old 05-05-2011, 01:56 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by cbk1994 View Post
It is good practice to always format well, even if you're the only person who is going to see it. You will generally make less mistakes.
I only meant if 'he' wanted to do it, and no one else would see it, he can go ahead.. Not saying everyone in general should do it lol.. I took the time in changing Stefans 2001 baddy script styling it correctly. D:

If I didn't I don't think I'd ever have figured out what it was doing..
But I agree.. It is kind of like doing a turn single at a turn or stop sign even if there is no one else there to see.. Still a good habit to keep/practice..



Quote:
Originally Posted by cbk1994 View Post
It will return the result of the statement.

PHP Code:
echo(== 1); // echoes true
echo(== 0); // echoes false
echo("a" == "a"); // echoes true
echo((2) == 7); // echoes true 
Oh I see.. So would this be a good thing inside a class / function for ... w/e the function might do.. assuming the point is to be true or false... Also, can you return more then one thing, for instance maybe X and Y? or would you have to return X and Y in an array with X and Y in it?

I usually do this. variables so they work through the whole script D: and have not made any real functions that needed to be in classes and used everywhere, but I would like to make a bush system.. and other things..

One more thing... xD returns do not return temp. variables? I've had a problem with this and had to make the temp. a this. to pass it back x.x;
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #88  
Old 05-05-2011, 02:05 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Devil_Lord2 View Post
Oh I see.. So would this be a good thing inside a class / function for ... w/e the function might do.. assuming the point is to be true or false...
Not sure what you're asking.

Quote:
Also, can you return more then one thing, for instance maybe X and Y? or would you have to return X and Y in an array with X and Y in it?
You can only return one value. Use arrays for returning multiple.

Quote:
One more thing... xD returns do not return temp. variables? I've had a problem with this and had to make the temp. a this. to pass it back x.x;
Functions return values, not variables. You can assign them to whatever variable you want to.
__________________
Reply With Quote
  #89  
Old 05-06-2011, 08:21 AM
reyalS reyalS is offline
Freelancer
reyalS's Avatar
Join Date: Jan 2011
Location: New Orleans
Posts: 11
reyalS will become famous soon enough
I see all these one line codes above me and I have no clue what they mean... SIGN ME UP!
__________________
~reyalS
Reply With Quote
  #90  
Old 05-06-2011, 09:29 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by cbk1994 View Post
Not sure what you're asking.
For instance, I guess function onPlayerGrabs(){ }
could be made a class that could return true and make the if statement work..

if (onPlayerGrabs()){} "I think could work assuming it is joined to the class"
could return true or false.. I don't know how it works really...

Quote:
Originally Posted by cbk1994 View Post
You can only return one value. Use arrays for returning multiple.
Oh I see.. thanks ^.^;
In the future could they do it with commas to add more, or is there no point?


Quote:
Originally Posted by cbk1994 View Post
Functions return values, not variables. You can assign them to whatever variable you want to.
I've had a function go through all players, and didn't accept externals.
I had it as:
variable
temp.count = 0;

a lot of script...

return temp.count
and
return count

which kept becoming 0 or null... in the end I set it to this.count = temp.count and it finally worked with:

return this.count

I couldn't get it to pass the temp. variable D:
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #91  
Old 05-06-2011, 10:53 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is just really niceTricxta is just really nice
Quote:
Originally Posted by reyalS View Post
I see all these one line codes above me and I have no clue what they mean... SIGN ME UP!
You should take a little time and just try put everything in context. No one taught me gs2 yet I seem to find it pretty easy when I do give it a crack every once in a while apart from the lack of documentation -_-

Hint: == is equals while = is assign

sooo if 1 equals 1 its true, pretty simple stuff lol. Also im not even sure if some of the commands in the above code are legitimate such as do(player) o.0 but oh well good luck.
Reply With Quote
  #92  
Old 05-06-2011, 12:15 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Devil_Lord2 View Post
For instance, I guess function onPlayerGrabs(){ }
could be made a class that could return true and make the if statement work..

if (onPlayerGrabs()){} "I think could work assuming it is joined to the class"
could return true or false.. I don't know how it works really...
That would be an event, not a statement. GS2 is event-based, so you do things after an event happens, unlike GS1 where you use if-statements for events, lol.

Quote:
Oh I see.. thanks ^.^;
In the future could they do it with commas to add more, or is there no point?
There is no reason to, arrays make more sense.

Quote:
I've had a function go through all players, and didn't accept externals.
I had it as:
variable
temp.count = 0;

a lot of script...

return temp.count
and
return count

which kept becoming 0 or null... in the end I set it to this.count = temp.count and it finally worked with:

return this.count

I couldn't get it to pass the temp. variable D:
Do you have the script? You must have been doing something else wrong.
__________________
Reply With Quote
  #93  
Old 05-06-2011, 01:41 PM
LUKEEE LUKEEE is offline
^ That's me!
LUKEEE's Avatar
Join Date: Feb 2011
Location: Australia
Posts: 40
LUKEEE is on a distinguished road
Sign me up, Scripting is the only thing holding behind my developing skills.
__________________

Proud Graalian since 2009

GRAAL PC


CLASSIC IPHONE
Reply With Quote
  #94  
Old 05-06-2011, 09:09 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by cbk1994 View Post
That would be an event, not a statement. GS2 is event-based, so you do things after an event happens, unlike GS1 where you use if-statements for events, lol.
I don't know D: It was an example I got a while ago from Thor, I was going to make a movement system like he did but I didn't quite understand it. I asked and he said functions can give true and false and be used in statements..

PHP Code:
if(movement.isAttemptingMove()){
  
setani("walk");
  return;

Quote:
Originally Posted by cbk1994 View Post
Do you have the script? You must have been doing something else wrong.
I don't offhand but I think it was either on twinnys page or somewhere on the forum.. I think I can find it. I was having the problem with getting more playercount than there were on the actual server.. found something to overcome it, but it still listed RC's lol


-EDIT-
Nevermind, I'm still using it ^.^;


PHP Code:
function getPlayerCount(){
  
temp.count 0;
    for (
temp.plallplayers ){
      
temp.count += (! pl.isExternal );    
    }
 
this.count count;
 return 
this.count;

if I did this.chat = count; or temp.count inside the function it would give back the correct number.

if I did this.chat = count; or temp.count outside the function it would give back the 0 or null. "I mean inside the same statement / function it is being called in"

Eventually I kept it and settled for this. but now that I think about it, this. isn't really returning because it's global in the script clientside, isn't it? lmao


>.> Further clarification..
PHP Code:
function onWa****(){
  
getPlayerCount();
  for(
i=0;i<allplayers.size();i++){
    
triggeraction(x,y,"door",allplayers[i]);
    
sleep(.1);
  }
}
function 
getPlayerCount(){
  
temp.count 0;
    for (
temp.plallplayers ){
      
temp.count += (! pl.isExternal );    
    }
 
this.count count;
 return 
this.count;

__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #95  
Old 05-06-2011, 10:15 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Not going to quote your post since it's too long.

The problem is that functions return values, not variables. You have to assign that value to a variable.

PHP Code:
temp.count this.getPlayerCount();

echo(
"count: " temp.count); 
__________________
Reply With Quote
  #96  
Old 05-06-2011, 10:35 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I had a style...then Stefan said I should use his style lest he style my code for me

so now

PHP Code:
function onCreated() {
  
this.var = "blah";
  
this.message format("Hi there, %s", (player.ismale "sir!" "ma'am!"));
  for (var : 
player.getvarnames())
    
doNothing(var);

I think he asked me to lose the braces if there was only one line in the block...either way I'm doing it now =]. I tend to go for the 'less lines the better' look =]
Reply With Quote
  #97  
Old 05-06-2011, 11:11 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Twinny View Post
PHP Code:
function onCreated() {
  
this.var = "blah";
  
this.message format("Hi there, %s", (player.ismale "sir!" "ma'am!"));
  for (var : 
player.getvarnames())
    
doNothing(var);

Looks good to me, except no braces on the for statement. Nice work Stefan .
__________________
Reply With Quote
  #98  
Old 05-07-2011, 04:12 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by cbk1994 View Post
Not going to quote your post since it's too long.

The problem is that functions return values, not variables. You have to assign that value to a variable.

PHP Code:
temp.count this.getPlayerCount();

echo(
"count: " temp.count); 
I don't get it...
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #99  
Old 05-07-2011, 04:36 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Devil_Lord2 View Post
I don't get it...
Imagine you're using a default function like degtorad(degrees). You use it like this:

PHP Code:
temp.radians degtorad(180);
echo(
temp.radians); 
The function degtorad returns the degrees given as a radian. You then have to assign it to a variable to use it elsewhere in the script. It works the same way when you create your own functions:

PHP Code:
function onCreated() {
  
temp.playerCount this.getPlayerCount();
}

function 
getPlayerCount() {
  
temp.count allplayers.size();
  return 
temp.count// this statement controls what the function returns

Another example of a function:

PHP Code:
function onCreated() {
  
temp.mean this.getMean(5283);
  echo(
"mean: " temp.mean);
}

function 
getMean(temp.n1temp.n2) {
  return ((
temp.n1 temp.n2) / 2);

You see here how you don't even have to assign the return value to a variable. Essentially, the interpreter reads that line of code, sees that it needs to use the getMean function, evaluates that function and places the return value in place of that statement.

If it helps, think of the function as a function in math.
__________________
Reply With Quote
  #100  
Old 05-07-2011, 04:47 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Devil_Lord2 View Post
I don't get it...
You should think in terms of expressions. When a script runs, it evaluates/reduces expressions.




Let's start with some hypothetical weapon script:
PHP Code:
function test(temp.x) {
  return 
temp.x+2;
}

function 
onWeaponFired() {
  
temp.this.test(10);
  echo(
temp.x);


And now, say this weapon is fired. This means we will be running the code:
PHP Code:
  temp.this.test(10);
  echo(
temp.x); 
Let's see what happens...

Step 1
On the first line, we need to call the test function with the value 10. When a function is run, we can replace the spot it was called at with the value it returns.

So, after test runs, this is what we have:
PHP Code:
  temp.12;
  echo(
temp.x); 
Step 2
And of course, this step is fairly simple...

So we get:
PHP Code:
  echo(12); 
Step 3
That code will be executed and will display 12 in the F2 console.



This method of evaluating scripts by hand can be very useful when trying to understand how one works (though it's normally done in your head).
Reply With Quote
  #101  
Old 05-07-2011, 05:07 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Quote:
Originally Posted by WhiteDragon View Post
Let's start with some hypothetical weapon script:
PHP Code:
function test(temp.x) {
  return 
temp.x+2;
}

function 
onWeaponFired() {
  
temp.this.test(10);
  echo(
temp.x);

I get up to here so far, excluding why this. is in front of a function... probably because I've never seen it before.. I would understand it without this. in front. Can it use that?

I thought

whatever = 6
return whatever

just returns 6 in whatever to the function that called it.. if it were a number, array, string, variable, or float, it would be inside whatever.. in this case 6..

-WILL EDIT-
Still trying to figure out the geometry/radians type post.. I haven't seen or used it at all.. If I read it a few times I might understand it :x


Okay, at first I wasn't reading "Degree to Radius" but I get it now..
I've taken Trig, Geometry, and Algebra 2 ... Can't say I remember any of it, and stating something math-wise confused the hell out of me and I was missing the point of the function lol

Yeah I get it now.. I love math, but it isn't my strong suit..
I got out of Computer Science because of my C Programming class..
My friend would find the scripts on the internet, and I'd change them towards what we needed... the final we had a third person trying to help and I missed a few classes and didn't understand it at all.. I passed but it wasn't enough for me to feel like I knew what I was doing really >.>

I'm more into art, but I'd still like to be able to know this.. seems easier to learn with the community here.

But yes I get you both.. I've always seen return ??? but never how it was used lol..
Thank you both!
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #102  
Old 05-07-2011, 05:29 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Devil_Lord2 View Post
I get up to here so far, excluding why this. is in front of a function... probably because I've never seen it before.. I would understand it without this. in front. Can it use that?
This this is slightly confusing to explain without a core understanding of how code evaluates. If you were to not write it, it would just be there implicitly, and sneak around in the background until it jumps out and confuses you. It's definitely important to learn about this (and the related concept of "objects") before you start seriously coding though.


Quote:
Originally Posted by Devil_Lord2 View Post
I thought

whatever = 6
return whatever

just returns 6 in whatever to the function that called it.. if it were a number, array, string, variable, or float, it would be inside whatever.. in this case 6..
It's best to throw away this idea rather than try to patch it up to something correct. It's somewhat close, but far away enough that'd it be faster to ignore it.


Quote:
Originally Posted by Devil_Lord2 View Post
Still trying to figure out the geometry/radians type post.. I haven't seen or used it at all.. If I read it a few times I might understand it :x
He was just giving examples rather than an explanation of how to think about each example. Look at Chris's post to try and learn by observation. Look at mine if you want a walkthrough.


Quote:
Originally Posted by Devil_Lord2 View Post
But yes I get you both.. I've always seen return ??? but never how it was used lol..
Thank you both!
Reply With Quote
  #103  
Old 05-07-2011, 05:31 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Please work on shortening your posts, it's tempting to just ignore them because they're so laborious to read.

The degree/radians conversion was just an example of a standard function built into the language.

The reason you prefix it with this is because it is a function of that object. When you use this as the prefix for a variable, it is set only for that object (that script). You don't have to use this as a prefix for variables, but you should since it clearly shows which object the function belongs to—it's only natural since variables require the prefix. As WhiteDragon said, don't worry about this yet. Focus on understanding variables and functions, then work on object orientation.
__________________
Reply With Quote
  #104  
Old 05-07-2011, 06:05 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
I mean I understand 'this.' is for the npc's or as you say object's script. like this.number...
Which keeps everything in the npc.. so nothing outside can 'control' it.. possibly a class or something.. "slightly unsure what could change it but I get its for that npc"

but sticking this. on a function sounds absurd o.o;
I mean, you can't create a function this.dostuff(){} can you?



Quote:
Originally Posted by WhiteDragon View Post
It's best to throw away this idea rather than try to patch it up to something correct. It's somewhat close, but far away enough that'd it be faster to ignore it.
As for returning a number, I will forget it now that I know you can do
this.number = function();
where the return is in the function...
I don't quite know where I got return ??? only passes it to the statement calling it lol..

I'm learning a lot today.. Thor taught ... tried to teach me indexing, but he logged off before I could get the history.. xD

I'm almost done finishing two threads on the learning site. I'd like to do variables, arrays, prefixes, and symbol type things in part B.. Mind if I post both here and see what you guys think soon?

I'd like it to be like go through a series of example type things, and hopefully others would learn from them...



Why does this work?
PHP Code:
function onWeaponFired(){
  
newFunction();
  
player.chat var2;
}
function 
newFunction(){
  
temp.var2 4;
  return 
var2;

I thought this was doing exactly what temp.count was not doing? D:
The more I try to figure it out, the more everything I was just told seems to not be what I thought..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz




Last edited by Devil_Lord2; 05-07-2011 at 08:45 AM..
Reply With Quote
  #105  
Old 05-11-2011, 05:18 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Unsure how the double posting "etiquette" that I have heard about a few times on her directed onto others, but I cannot edit my post.

I'm unsure why my testbed access now says on my RC

"Your IP is not listed in the ip ranges."

So I cannot actually do the assignments and test them until this is fixed.. I'm using the same wifi but for some reason my internet failed twice yesterday... could have something to do with it.. I'll message Chompy or Clockworks in hope to get this fixed.


The main reason that I am posting is to one: Restate the learning classes have already started and we are on assignment two, Zues is currently busy / not home right now from what I was told. He didn't mention when he would be back though..

You can start on the assignments here.
Scripting School
Just sign up, post your assignments on the forum, and ask for help if you need it!
Everyone is nice and willing! :] I'll also post the link to everyone who has said they'd like to join in previous posts on this thread.

And I have been working on some information that should help starting people in the Learning GS2 and would love critiques on it, how I can improve or what I should take off. I believe so far it has the common information new people should know.

I need to do some examples on B and C still. A and D should be done for the most part.
Learning GS2 Link

Please private message me here on the Graal forums and let me know what I should do, if there is anything I am missing, or anything needing change.
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #106  
Old 06-09-2011, 07:04 PM
Twilikari Twilikari is offline
Registered User
Twilikari's Avatar
Join Date: Nov 2010
Location: America
Posts: 86
Twilikari is on a distinguished road
Is it to late to sign up? The link didn't work, but if it's NOT too late, I'd love to sign up!
Reply With Quote
  #107  
Old 06-10-2011, 04:35 PM
dJgYsI dJgYsI is offline
Registered User
Join Date: Jun 2009
Posts: 1
dJgYsI is on a distinguished road
I would love to have RC on TESTBED, im new in gscript and the level editor suxx for script testing. Is it possible to get RC?
Also Im interested in this school project =)
Reply With Quote
  #108  
Old 07-19-2011, 02:27 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Sorry, the person who started it did not quite keep it going, players lost interest, and I tried to help but no one would fix my IP Adress for Graal. I've sent three messages but they were all ignored..

Too busy now, I wouldn't be able to help if I tried, and all my knowledge of GS2 went down the drain anyway. But, I could recommend the player who helped me the most if you'd like. I don't think you would find him on here though since he tends to stay away from forums, and others..

As for the school project, is is essentially dysfunctional if not dead, seeing as I was the last posts on it.. However some of the references I wrote could be helpful.. but without tutorials it won't get you very far without previous knowledge of programming. :[

Sorry..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #109  
Old 07-19-2011, 03: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 dJgYsI View Post
I would love to have RC on TESTBED, im new in gscript and the level editor suxx for script testing. Is it possible to get RC?
Also Im interested in this school project =)
First semi-related reply to this is 5 weeks after? Lol, Testbed is as actively managed as ever I see.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #110  
Old 07-20-2011, 08:06 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
Looks like this fell through!

Sounded like it was going to be a giant blind leading the blind ordeal anyway.

You can find a link to my guide here: fp4's scripting guide
__________________
Quote:
Reply With Quote
  #111  
Old 08-04-2011, 01:21 AM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Well I don't have access to Testbed, no longer have access to ZeroG's server with an RC, no longer have much interests working with Graal lol.. I never played on the PC servers, only developed. If someone wants to finally fix my IP for Testbed, I might help out ZeroG or Ohkay. I hear he is doing something with pets, something that sparks my interests..

And yes you are right. Five weeks later as I have not been on for ... five weeks!
I said in another post I'd be back in a month or two.. just to the forums and I kept my word.
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #112  
Old 08-04-2011, 01:57 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
Testbed is gone, Stefan fixed the Developer Subscription Timers.

Something should be done about that...
__________________
Quote:
Reply With Quote
  #113  
Old 08-07-2011, 10:19 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve


Quote:
Originally Posted by fowlplay4 View Post
Testbed is gone, Stefan fixed the Developer Subscription Timers.

Something should be done about that...
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #114  
Old 08-07-2011, 11:18 PM
Clockwork Clockwork is offline
ᶘ ᵒᴥᵒᶅ...ᶘ ಠᴥಠᶅ❤...ℳℴℯ
Clockwork's Avatar
Join Date: Feb 2007
Location: Pennsylvania
Posts: 2,071
Clockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant futureClockwork has a brilliant future
Quote:
Originally Posted by fowlplay4 View Post
Testbed is gone, Stefan fixed the Developer Subscription Timers.

Something should be done about that...
I had a thread up for the majority of, I believe a month, asking for donations from people to keep it up. Only received one donation from a certain gentleman. After the billing date passed though, I returned the donation and let it die, was surprised it was still up, and has assumed stefan kept it up for everyone. Guess not. :o

Am in no position atm to renew it myself at all though.
__________________
Reply With Quote
  #115  
Old 08-07-2011, 11:22 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 Clockwork View Post
Am in no position atm to renew it myself at all though.
And you shouldn't. Testbed was barely used by anyone for the longest amount of time.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #116  
Old 08-07-2011, 11:34 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
Someone could take on the daunting (and redundant) task of developing a GS2 Interpreter so players can test their scripts without actually needing level or NC access on a server.

Even if it only had the basic functionality to do "weapon" scripts like this:

PHP Code:
function onActionServerSide() {
  if (
params[0] == "test") {
    echo(
"Hello world!");
  }
}

//#CLIENTSIDE
function onCreated() {
  
triggerserver("gui"this.name"test"); 

or..

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.math 1+1+2;
  echo(
"The result is: " temp.math);

It would lower the barrier of entry, and allow people to get their feet a little wet.
__________________
Quote:

Last edited by fowlplay4; 08-07-2011 at 11:53 PM..
Reply With Quote
  #117  
Old 08-16-2011, 10:32 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
I wish there were more testing classic servers, since I can no longer use RC elsewhere and have no desires or funds to renew a gold account. Oh well..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #118  
Old 09-03-2011, 03:21 PM
furry_mougle furry_mougle is offline
big heart
furry_mougle's Avatar
Join Date: Aug 2011
Posts: 42
furry_mougle is an unknown quantity at this point
Quote:
Originally Posted by Devil_Lord2 View Post
I wish there were more testing classic servers, since I can no longer use RC elsewhere and have no desires or funds to renew a gold account. Oh well..
That's why Unixmad blessed us with Super Rewards!
__________________
Quote:
Originally Posted by ffcmike View Post
But make sure to change beer.png to Orange Juice.
pay bills to play graal
Reply With Quote
  #119  
Old 09-03-2011, 08:26 PM
Rave_J Rave_J is offline
Graal Developer
Join Date: Feb 2006
Location: Texas
Posts: 848
Rave_J can only hope to improve
Send a message via AIM to Rave_J Send a message via MSN to Rave_J Send a message via Yahoo to Rave_J
ya quit being lazy and just get free grelats to get free gold every month to get rc on some nub server
__________________
Graal Developer
Reply With Quote
  #120  
Old 10-06-2011, 07:56 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Don't know what the super rewards are, and with UMBC I don't have time to play.
But thank you though..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



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 09:39 AM.


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