Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   this.owner (https://forums.graalonline.com/forums/showthread.php?t=20888)

SSRobgeta 01-11-2002 06:25 AM

this.owner
 
Bah. I fell stupid, but how would I do this? Like if on 2001 for mining. (This.owner)

Shard_IceFire 01-11-2002 09:13 AM

here's a SIMPLE example..
NPC Code:

if (playertouchsme) {
if (this.owned==0) {
sleep 0.05;
this.owned=1;
setstring server.rockowner1,#a;
timeout=0.05;
}
if (this.owned==1) {
if (strequals(#a,#s(server.rockowner1))) {
say2 Hey owner, wassup?;
}
if (!strequals(#a,#s(server.rockowner1))) {
say2 You're not my owner!;
}
}
}
if (playerenters||timeout) {
message #s(server.rockowner1);
timeout=0.05;
}


I think that would work...maybe.

SSRobgeta 01-11-2002 06:35 PM

Quote:

Originally posted by Shard_IceFire
here's a SIMPLE example..
NPC Code:

if (playertouchsme) {
if (this.owned==0) {
sleep 0.05;
this.owned=1;
setstring server.rockowner1,#a;
timeout=0.05;
}
if (this.owned==1) {
if (strequals(#a,#s(server.rockowner1))) {
say2 Hey owner, wassup?;
}
if (!strequals(#a,#s(server.rockowner1))) {
say2 You're not my owner!;
}
}
}
if (playerenters||timeout) {
message #s(server.rockowner1);
timeout=0.05;
}


I think that would work...maybe.

K thanks.

Shard_IceFire 01-11-2002 09:41 PM

=D no prob.
Lemme know if ya need more help via forum PM.

SSRobgeta 01-12-2002 03:38 AM

Quote:

Originally posted by Shard_IceFire
=D no prob.
Lemme know if ya need more help via forum PM.

K i will.

TDO2000 01-12-2002 06:08 AM

Um why should u use server-strings for this?

use save-vars and playerid:
NPC Code:

if(playertouchsme){
//New Owner
if(save[0] <=0){
save[0]=playerid;
}
//If Owner nice message
if(save[0]==playerid){
say2 Hey Boss;
}
//if not Owner not so nice
if(save[0]<>playerid){
say2 Go away bastard;
}
}


for showing the owner's name I would use messagecodes, showcharacter and an empty gani (without showcharacter I always had problems with messagecodes, they didn't work the right way)

lordhelmut 02-04-2002 12:37 PM

Quote:

Originally posted by TDO2000
Um why should u use server-strings for this?

use save-vars and playerid:
NPC Code:

if(playertouchsme){
//New Owner
if(save[0] <=0){
save[0]=playerid;
}
//If Owner nice message
if(save[0]==playerid){
say2 Hey Boss;
}
//if not Owner not so nice
if(save[0]<>playerid){
say2 Go away bastard;
}
}


for showing the owner's name I would use messagecodes, showcharacter and an empty gani (without showcharacter I always had problems with messagecodes, they didn't work the right way)

arent save vars local?

nyghtGT 02-04-2002 01:48 PM

Quote:

Originally posted by Kaimetsu
Is there any logical reason not to use this.strings?
thats what i was thinking ...

TDO2000 02-04-2002 07:15 PM

Quote:

Originally posted by Kaimetsu
Is there any logical reason not to use this.strings?
He just didn't use them in the script... he used server vars and me HATES server vars if u can do it another way ^_^

Androk2k1 02-04-2002 08:14 PM

umm I made it simpler for Pot Making... I always make it simpler... but mine is close to first version... though I didn't finish reading it...

jeff335 02-04-2002 10:05 PM

Yah, this.strings are the obvious way to do this -_-

TDK_RC6 02-04-2002 10:42 PM

Quote:

Originally posted by TDO2000
NPC Code:

if(save[0]<>playerid){


does that mean less than or greater than??

i never knew you could use that

thats helps a lot if it is true

Saga2001 02-04-2002 11:51 PM

Quote:

Originally posted by TDK_RC6


does that mean less than or greater than??

i never knew you could use that

thats helps a lot if it is true

ain't it great?
learning new things that is.

Saga2001 02-05-2002 12:11 AM

Quote:

Originally posted by Kaimetsu
So... basically a weird version of "!="? I prefer the more comprehensive "not equal to".
I'm with him...

TDK_RC6 02-05-2002 01:29 AM

it would help with some syntax of mine

LiquidIce00 02-05-2002 03:13 AM

or <>
can be !string1=string2

nyghtGT 02-05-2002 03:54 AM

Quote:

Originally posted by Kaimetsu


Is it worth pointing out that Graal strings can't be compared in that way, and that "==" would be more appropriate?

*agrees*

TDK_RC6 02-05-2002 04:20 AM

wouldn't you use !strequals(stringwhatever,stringwhatever2)
??


another question about <>, i guess i thought about it wrong, you cant specify a rang with that can u??

Saga2001 02-05-2002 01:25 PM

lol
i think he meant vars but was tired.

i am not sure if
!var1==var2 would work. o it wouldn't, because the var1 becomes false...

TDO2000 02-05-2002 06:21 PM

<> just means that the first var has to be bigger or smaller then the second

um lets show it another way:

if(var1<>var2) message Oki;

if var 1 and var2 are the same nothing will happen
if they aren't the same the NPC will say "Oki"

or lets say it's the opposite of ==

TDO2000 02-05-2002 06:48 PM

Quote:

Originally posted by Kaimetsu


Yes, we all understand this. It's just that most of us prefer the arguably superior "!=".

hmmm I shouldn't read that fast :(
but what u prefer is sure the best way ;) *rofl*


All times are GMT +2. The time now is 01:56 AM.

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