![]() |
Quote:
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 |
Quote:
|
Quote:
PHP Code:
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. |
Quote:
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:
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? |
This is a good example of why it's bad:
PHP Code:
|
Quote:
Quote:
PHP Code:
|
Quote:
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:
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; |
Quote:
Quote:
Quote:
|
I see all these one line codes above me and I have no clue what they mean... SIGN ME UP! :D
|
Quote:
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:
In the future could they do it with commas to add more, or is there no point? Quote:
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: |
Quote:
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. |
Quote:
Quote:
Quote:
|
Sign me up, Scripting is the only thing holding behind my developing skills.
|
Quote:
PHP Code:
Quote:
-EDIT- Nevermind, I'm still using it ^.^; PHP Code:
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:
|
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:
|
I had a style...then Stefan said I should use his style lest he style my code for me x_x
so now PHP Code:
|
Quote:
|
Quote:
|
Quote:
PHP Code:
PHP Code:
PHP Code:
If it helps, think of the function as a function in math. |
Quote:
Let's start with some hypothetical weapon script: PHP Code:
And now, say this weapon is fired. This means we will be running the code: PHP Code:
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:
And of course, this step is fairly simple... So we get: PHP Code:
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). |
Quote:
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! |
Quote:
Quote:
Quote:
Quote:
|
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. |
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:
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:
The more I try to figure it out, the more everything I was just told seems to not be what I thought.. |
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. |
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!
|
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 =) |
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.. |
Quote:
|
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 |
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. :D Five weeks later as I have not been on for ... five weeks! :p I said in another post I'd be back in a month or two.. just to the forums and I kept my word. |
Testbed is gone, Stefan fixed the Developer Subscription Timers.
Something should be done about that... |
:cry:
Quote:
|
Quote:
Am in no position atm to renew it myself at all though. |
Quote:
|
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:
PHP Code:
|
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..
|
Quote:
|
ya quit being lazy and just get free grelats to get free gold every month to get rc on some nub server
|
Don't know what the super rewards are, and with UMBC I don't have time to play.
But thank you though.. |
| All times are GMT +2. The time now is 08:40 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.