PDA

View Full Version : alright how does it work


_Z3phyr_
10-03-2006, 01:51 AM
I see people say prefix.("varname" @ temp.towahth @ "wejthakwlh") = 1;

If this doesn't have anything to do with what I'm about to ask then just pretend I didn't metion it and answer the question anyway:


When you want to declare a value/assign/whatever... nevermind how do I do this:

this.thisismyvarONE = the variable I that I want to edit.

this.varname = "ONE";
this.("thisismyvar" @ this.varname) = 1;


^ please explain how to do because I'm doing it wrong apparently.

Yen
10-03-2006, 03:04 AM
What you're doing should work.

fowlplay4
10-04-2006, 06:38 AM
You could also do this..

function onCreated() {
this.varname = "ONE";
makevar("this." @ this.varname) = 1;
chat = "this.ONE =" SPC this.ONE;
}

Its just a matter of personal preference I guess..

xAndrewx
10-04-2006, 09:20 AM
You could also do this..

function onCreated() {
this.varname = "ONE";
makevar("this." @ this.varname) = 1;
chat = "this.ONE =" SPC this.ONE;
}

Its just a matter of personal preference I guess..

Indeed it is, I'm starting to use makevar, however I prefer to use this.("blah" @ LOLDIE); =(

Skyld
10-04-2006, 10:11 AM
Indeed it is, I'm starting to use makevar, however I prefer to use this.("blah" @ LOLDIE); =(
makevar() is untidy and I strongly dislike it when people use it. this.(@ foo) = bar; is the best way in my opinion.

_Z3phyr_
10-04-2006, 10:37 AM
this.(@ foo) = bar;


So if I'm going to start the variable's name with the value of another variable, I need to use the @ sign to start it off?

this.(@ varname) = value;

The Evil Within
10-04-2006, 01:36 PM
I was on RC when you posted this...why didn't you just ask me? Loser.

Although you wouldn't have gotten as good help, I actually like the way Skyld has it formatted better.

Skyld
10-04-2006, 05:46 PM
So if I'm going to start the variable's name with the value of another variable, I need to use the @ sign to start it off?

this.(@ varname) = value;
I think you only need it for a variable name only or if a variable name is first.
this.(@ foo @ "bar") = baz;
However, I do it out of habit even when a string is first. It is probably good practice for consistency and legibility.

Chompy
10-05-2006, 01:58 PM
I dunno why people are using makevar :p
-longer too write
-looks more complicated if you ask me, but isn't


//#CLIENTSIDE
function onCreated()
{
temp.a = "lol";
temp.(@ temp.a @ "lipop") = "hmm?";
player.chat = temp.lollipop;
}

is lesser to write then:

//#CLIENTSIDE
function onCreated()
{
temp.a = "lol";
makevar("temp." @ temp.a @ "lipop") = "hmm?";
player.chat = temp.lollipop;
}

xXziroXx
10-06-2006, 02:52 PM
Ive actually started to use makevar() instead of var.(more stuff) lately. I like it more now, and it feels more.. organized?

_Z3phyr_
10-07-2006, 02:01 PM
*shrug* anyway instead of making a new thread how about I pose another question?

How does... if (playerleaves) {... translate into GS2?

I know it ain't function onPlayerleaves() { so what is it?!

Twinny
10-07-2006, 06:35 PM
Ive actually started to use makevar() instead of var.(more stuff) lately. I like it more now, and it feels more.. organized?

I always did var.(@ some @ "thing") but when i saw makevar() I thought i was doing it the wrong way >_<

_Z3phyr_
10-09-2006, 12:26 PM
So... >_>

_Z3phyr_
10-19-2006, 02:20 AM
*9 days later*
You guys suck

excaliber7388
10-19-2006, 03:14 AM
nobody knows....

xXziroXx
10-19-2006, 10:22 AM
Playerleaves doesnt exist in GS2, but its not hard to script your own version.



//#CLIENTSIDE
function onPlayerEnters()
{
if (player.level != this.levelname && this.levelname != NULL) {
//Oh my gosh, the player changed level!
}
this.levelname = player.level;
}

Skyld
10-19-2006, 10:33 AM
player.level.name. :(

xXziroXx
10-19-2006, 10:51 AM
player.level.name. :(

*whistles*

Admins
10-19-2006, 03:33 PM
onPlayerLeaves() should work fine, you are sure it is broken ?

xXziroXx
10-19-2006, 03:40 PM
onPlayerLeaves() should work fine, you are sure it is broken ?

Its not even listed on the Wiki.. only the gs1 version of it is.

_Z3phyr_
10-20-2006, 10:11 PM
apparently it doesn't work.


Anyway lets see if yall can redeem yourselves...

Tell me what I did wrong here. Assume temp.entry is a string and that all arrays and/or variables have been declared before this script comes into play.

for (i=1;i<=13;i++) {
if (server.arrayprefix_(temp.entry @ "Suffix")[i]!=null) {
if (client.array[i]>=server.arrayprefix_(temp.entry @ "Suffix")[i]) {


I've tried saying (@[email protected]"Suffix") but that doens't work either. If that's the correct answer then maybe I mistyped something.



edit
and yes I know I can jsut say server.array >= client.array but that doesn't answer my question.

Riot
10-20-2006, 10:48 PM
onPlayerLeaves() should work fine, you are sure it is broken ?

It works fine.

apparently it doesn't work.


Anyway lets see if yall can redeem yourselves...

Tell me what I did wrong here. Assume temp.entry is a string and that all arrays and/or variables have been declared before this script comes into play.

for (i=1;i<=13;i++) {
if (server.arrayprefix_(temp.entry @ "Suffix")[i]!=null) {
if (client.array[i]>=server.arrayprefix_(temp.entry @ "Suffix")[i]) {


I've tried saying (@[email protected]"Suffix") but that doens't work either. If that's the correct answer then maybe I mistyped something.



edit
and yes I know I can jsut say server.array >= client.array but that doesn't answer my question.

You would want to do server.("arrayprefix_" @ temp.entry @ "Suffix")[i].

_Z3phyr_
10-20-2006, 11:01 PM
Roger dodger.

_Z3phyr_
12-19-2006, 12:24 AM
Okay and now how do you translate if (mousedown) to GS2 aka if (leftmousebutton) ?

Gambet
12-19-2006, 01:31 AM
Okay and now how do you translate if (mousedown) to GS2 aka if (leftmousebutton) ?


//#CLIENTSIDE
function onMouseDown() {
switch(params[0]) {
case "left":
case "right":
case "middle":
case "double": player.chat = "You have just pressed the " @ params[0] @ " mouse button!"; break;
}
}

_Z3phyr_
12-20-2006, 01:21 AM
lolz hey again yall I need help with this thing will you please help me??? how do you do this but make it work b/c something is wrongfunction onTimeout() {
for (i=0;i<=2;i++) {
player.x+=i;
}
this.setTimer(.5);
}

Gambet
12-20-2006, 01:42 AM
dirty showoffs... let's see you show me how to do this


How to make player move in a direction (equivalent to move() command except player instead of NPC)

and don't sayfunction onTimeout() {
for (i=0;i<=2;i++) {
player.x+=i;
}
this.setTimer(.5);
}


Or why don't you stop trying to hide the fact that you're asking for scripts instead of your little "let's see you show me how to do this" scam?

If you need help, ask, like a normal person.

Andy0687
12-20-2006, 09:36 AM
Or why don't you stop trying to hide the fact that you're asking for scripts instead of your little "let's see you show me how to do this" scam?

Wow what in the world are you on, its obvious he is asking for help with scripts.


If you need help, ask, like a normal person.

It appears its normal for him to ask in those more interesting ways just as its normal for you to critisize and arugue with everyone you come in contact with.

_Z3phyr_
12-20-2006, 07:07 PM
quite


anyway, what's the answer again?

Chompy
12-20-2006, 08:31 PM
quite


anyway, what's the answer again?

function onTimeout() {
for (i=0;i<=2;i++) {
player.x+=i;
}
this.setTimer(.5);
}
That would increase the player's x with 0, then by 1, and then by 2..

You could try to add a speed variable, instead of adding the variable of the loop, which is being increased,
(because of the loop speed it would be like, 2 forward, then 1, then 2 forward and 1 forward, would look weird)

To make something near the move() command, but to effect the player, I would use cos, sin and getangle

Gambet
12-20-2006, 10:00 PM
Rambling



I don't know what his intentions were, but he put it off as a challenge. Sort of like seeing if people know how to do something, without doing it the way he's done it.

That's the only reason I responded the way I did, else, I'd be glad to help.

_Z3phyr_
12-20-2006, 11:49 PM
This stufffunction onTimeout() {
for (i=0;i<=2;i++) {
player.x+=i;
}
this.setTimer(.5);
}only moves me by whatever i is set to (in this case 0 tiles), so it doesn't work (I said it because it doesn't work -- as a tip that its not the right answer).

And how about an answer in GS2? English doesn't really help me.

godofwarares
12-28-2006, 04:00 PM
*shrug* anyway instead of making a new thread how about I pose another question?

How does... if (playerleaves) {... translate into GS2?

I know it ain't function onPlayerleaves() { so what is it?!

Since GS2 is function onEVENTNAME(params) {

It would be


function onPlayerLeaves() {
// ...
}



I know it ain't function onPlayerleaves() {


It has to be :P
Playerleaves is an event, and read above :P

godofwarares
01-08-2007, 09:59 PM
This stufffunction onTimeout() {
for (i=0;i<=2;i++) {
player.x+=i;
}
this.setTimer(.5);
}only moves me by whatever i is set to (in this case 0 tiles), so it doesn't work (I said it because it doesn't work -- as a tip that its not the right answer).

And how about an answer in GS2? English doesn't really help me.

Why not just do a for loop that increses the player's X position?

Example:


function onPlayerTouchsMe()
{

for ( i = 0; i <= 2; i++ )
{

player.x++;

}

}


Makes much more sense :)