Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Server (https://forums.graalonline.com/forums/forumdisplay.php?f=14)
-   -   GetNPC + this. variables (https://forums.graalonline.com/forums/showthread.php?t=19246)

Faheria_GP2 12-20-2001 06:41 AM

GetNPC + this. variables
 
okay, when you do

with(getNPC(name)) {
this.var=1;
}

is that for the NPC that called the "with" or the NPC recieving the with? I have a feeling that it's for the recieving NPC, because stefan mentioned something about doing that...but i don't remember for sure now

Saga2001 12-20-2001 09:55 AM

reciveing.
 
its the recieving one.

Faheria_GP2 12-20-2001 10:08 AM

thanks...I thought that was the case, but wanted to make sure...

Saga2001 12-20-2001 11:51 PM

watch
 
watch me gain post counts.
:p

Warcaptain 12-21-2001 07:25 AM

for setting variable to npc calling 'name'
NPC Code:

with (getnpc(name)){
variable=value;
}



for setting variable to npc: 'name'
NPC Code:

with (getnpc(name)){
this.variable=value;
}


Faheria_GP2 12-21-2001 07:50 AM

you are smart :D

TB3 01-02-2002 08:29 PM

Yay
 
Ummm yeah it for recieving db npc im pretty sure i havent used it though i do use with (npcs.[i]) {} or with (npcs.[-1]) to get just placed npcs from control npc

Admins 01-08-2002 09:24 PM

Ok here the correct version:

NPC Code:

tempvar = this.varfrom;
with (getnpc(name)) {
this.varto = tempvar;
}



The this. variable always belongs to
the current active npc, which is the npc
with the name 'name' when you do the
second assignment.
Currently there is no way to access the
this. vars of the executing npc.

TDK_RC6 02-17-2002 12:27 PM

Quote:

Originally posted by Stefan
Ok here the correct version:

NPC Code:

tempvar = this.varfrom;
with (getnpc(name)) {
this.varto = tempvar;
}



The this. variable always belongs to
the current active npc, which is the npc
with the name 'name' when you do the
second assignment.
Currently there is no way to access the
this. vars of the executing npc.

is there anyway you can pass this.strings from the calling npc to the receiving npc??

Spanko 02-17-2002 07:08 PM

Quote:

Originally posted by TDK_RC6


is there anyway you can pass this.strings from the calling npc to the receiving npc??

triggeraction ;P

TDK_RC6 02-17-2002 09:56 PM

but how do you trigger db npcs??


wait, nm, im stupid, they have a x and y

thanks grim

mikepg 02-18-2002 02:37 AM

Quote:

Originally posted by Stefan
Ok here the correct version:

NPC Code:

tempvar = this.varfrom;
with (getnpc(name)) {
this.varto = tempvar;
}



The this. variable always belongs to
the current active npc, which is the npc
with the name 'name' when you do the
second assignment.
Currently there is no way to access the
this. vars of the executing npc.

Why not implement something like "that.var" when using with(getnpc) {}
So, it controls the "this." var of the other npc. That would be usefull.

Falcor 02-18-2002 02:58 AM

I found a somesort of primitive way tpo get a this.string to the other npc. and that is by tokenizing it.

tokenize "#s(this.strfrom)"
with(getnpc(name)) {
setstring this.strto,#t(0);
}
It works in any sence =\

TDK_RC6 02-18-2002 03:13 AM

Quote:

Originally posted by Falcor
I found a somesort of primitive way tpo get a this.string to the other npc. and that is by tokenizing it.

tokenize "#s(this.strfrom)"
with(getnpc(name)) {
setstring this.strto,#t(0);
}
It works in any sence =\

ahh, i feel even stupider now

i must not be thinking clearly, thanks falados

Loriel 03-02-2002 01:07 AM

Quote:

Originally posted by TDK_RC6
is there anyway you can pass this.strings from the calling npc to the receiving npc??
*grabs Stefan's example
Quote:

Originally posted by Stefan
NPC Code:

setstring tempstring,#s(this.stringfrom);
with (getnpc(name)) {
setstring this.stringto,#s(tempstring);
setstring tempstring,;
}





All times are GMT +2. The time now is 12:53 AM.

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