Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Making sense of "else" (https://forums.graalonline.com/forums/showthread.php?t=73414)

shadowjones 04-10-2007 09:57 PM

Making sense of "else"
 
No matter what I do, whenever I type in ANY text at all and it will say whats in the else command (ex: I say jswkdng I get msg saying, "text part 2")

I'm trying to use this to make seperate messages when you have already talked to him.

NPC Code:
//CLIENTSIDE
if (clientr.helloworld=1 &&(playertouchsme))
say2 Text part 1;
else
say2 text part 2;

if (playerchats&&strequals(#c,Text part 3)) {
say2 Text part 4;
clientr.helloworld=1;
}


godofwarares 04-10-2007 10:04 PM

Quote:

Originally Posted by shadowjones (Post 1298832)
No matter what I do, whenever I type in ANY text at all and it will say whats in the else command (ex: I say jswkdng I get msg saying, "text part 2")

I'm trying to use this to make seperate messages when you have already talked to him.

NPC Code:
//CLIENTSIDE
if (clientr.helloworld=1 &&(playertouchsme))
say2 Text part 1;
else
say2 text part 2;

if (playerchats&&strequals(#c,Text part 3)) {
say2 Text part 4;
clientr.helloworld=1;
}


First of all, You might want to do:

PHP Code:

//#CLIENTSIDE
if (playertouchsme)
{
if (
clientr.helloworld == 1)
{
say Whatever 1;
} else {
say Whatever 2;
}


And also, Use == for comparisons. Not =.

PHP Code:

=                     Assignment
==                    Comparison 


Lastly:
PHP Code:

//#CLIENTSIDE
not
//CLIENTSIDE 

:)

DustyPorViva 04-10-2007 10:06 PM

clientr. strings are set on the serverside, and can be read on the clientside. And if you're doing this GS1(which I assume you are by your syntax's, you have to set the string as a string, not as a variable.
setstring clientr.helloworld,1;

shadowjones 04-10-2007 10:06 PM

Quote:

Originally Posted by godofwarares (Post 1298834)
First of all, You might want to do:

PHP Code:

//#CLIENTSIDE
if (playertouchsme)
{
if (
clientr.helloworld == 1)
{
say Whatever 1;
} else {
say Whatever 2;
}


And also, Use == for comparisons. Not =.

PHP Code:

=                     Assignment
==                    Comparison 


Lastly:
PHP Code:

//#CLIENTSIDE
not
//CLIENTSIDE 

:)

wow...i didnt even notice i forgot hte # O_O...thanks a bunch ^_^

shadowjones 04-10-2007 10:24 PM

Quote:

Originally Posted by DustyPorViva (Post 1298835)
clientr. strings are set on the serverside, and can be read on the clientside. And if you're doing this GS1(which I assume you are by your syntax's, you have to set the string as a string, not as a variable.
setstring clientr.helloworld,1;

ive been using clientr.hellowworld=1; on all my scripts and they are all working fine??

DustyPorViva 04-10-2007 10:53 PM

Well I'm not that all experienced with online stuff... but that's always how I've known them to work. Is this 'working' working online on a server or offline?

cbk1994 04-11-2007 01:12 AM

clientr.var can only be set on clientside.
It can be read clientside or serverside.

TServerPlayer() I believe.

Rapidwolve 04-11-2007 02:19 AM

TServerPlayer; its not a function z.z

godofwarares 04-11-2007 03:16 AM

Quote:

Originally Posted by Rapidwolve (Post 1298990)
TServerPlayer; its not a function z.z

Its an object. Not a function.
It needs a ().

PHP Code:

TServerPlayer() 


Skyld 04-11-2007 11:17 AM

Quote:

Originally Posted by shadowjones (Post 1298838)
ive been using clientr.hellowworld=1; on all my scripts and they are all working fine??

When you do varname = value; in old GScript, it only works for integer/float values. Also I don't think it works with clientr.-style strings either.

varname = value; in the new engine is the default way of assigning values to variables; if this is working in your script for some string values, then you are probably mixing old and new GScript, which you shouldn't be doing.

DustyPorViva 04-11-2007 12:18 PM

That's what I thought, and it was really confusing me.

shadowjones 04-11-2007 04:03 PM

Quote:

Originally Posted by Skyld (Post 1299067)
When you do varname = value; in old GScript, it only works for integer/float values. Also I don't think it works with clientr.-style strings either.

varname = value; in the new engine is the default way of assigning values to variables; if this is working in your script for some string values, then you are probably mixing old and new GScript, which you shouldn't be doing.

Im only using GS1. I do get some problems using clientr though. But the problems randomly happen.
Here is what I mean:
In my start area, you have a class selection. Whichever class you say, its gives you your certain clientr.player_class=*.
I look in player information through RC and there it is, clientr.player_class=1

Then I do a seperate script, in this case for a quest. If you say something specific it gives you clientr.quest=1. Now I don't know why, but this occurs with the script quite a bit:
1. I say whats needed to trigger the script thus clientr.quest=1
2. I go to a door scripted to only open if (clientr.quest=1) and it works. Yet in player attributes on RC, it doesn't show clientr.quest=1, instead its just blank.
(First question: why does the door open if its not visible in there?)
3. I then relog and try the door again. It does not work as if I had the clientr set

Any ideas why it would be doing this?

P.S. If you need me to reword this please ask lol, it was hard typing it -_-


All times are GMT +2. The time now is 11:00 AM.

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