Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   join problems (https://forums.graalonline.com/forums/showthread.php?t=56995)

Slash-P2P 01-11-2005 12:19 AM

join problems
 
I have some serverside local NPCs using a class on the server for house furniture where you can drag it with your mouse to move it. The dragging part is done, but I'm having a problem with 1 little thing...The join part. As of now, the local npcs set the string thiso.obj_archetype (also tried this.) to the type of furniture it is (bed, chair, etc...).

I don't think its possible to do join #s(string); But here's what I have now:
PHP Code:

if (created || initialized) {
  
// Object Archetypes
  
if (strequals(#s(thiso.obj_archetype),chair)) setimg amz_chair.png;
  
if (strequals(#s(thiso.obj_archetype),bed)) setimg element_bed1.png;
  
join ph_#s(thiso.obj_archetype);


Heres something else I tried...
PHP Code:

if (created || initialized) {
  
// Object Archetypes
  
if (strequals(#s(thiso.obj_archetype),chair)) {
    
setimg amz_chair.png;
    
join ph_chair;
  }
  if (
strequals(#s(thiso.obj_archetype),bed)) {
    
setimg element_bed1.png;
    
join ph_bed;
  }


That just makes it only join the bed script...

Can anyone help?

falco10291029 01-11-2005 12:31 AM

First of all, as you should know, thiso.string is only used when using the "with" command. Also, make suyre the script is serversided, you cant use this.string clentsided. I would use the bottom script, and just change the string names to this.whatever.

Projectshifter 01-11-2005 12:34 AM

Try diong a sendtorc or such to verify that it's actually going into that bracket and verifying it, if not, it's not joining simply because your code is faulty. Make sure it works and let me know, I would be willing to bet that is your problem.

Slash-P2P 01-11-2005 12:36 AM

Quote:

Originally Posted by falco10291029
First of all, as you should know, thiso.string is only used when using the "with" command. Also, make suyre the script is serversided, you cant use this.string clentsided. I would use the bottom script, and just change the string names to this.whatever.

Tried it. Wasn't working. I said above that its all serverside.

Quote:

Originally Posted by Projectshifter
Try diong a sendtorc or such to verify that it's actually going into that bracket and verifying it, if not, it's not joining simply because your code is faulty. Make sure it works and let me know, I would be willing to bet that is your problem.

I verified it was doing the right join stuff with showimg @@@. I had 3 NPCs and all of them showed the right data. It's all a problem with the join command.

Evil_Trunks 01-11-2005 12:44 AM

it probably is joining them both when the NPC is created

i dont think join acts like a normal command

Slash-P2P 01-11-2005 12:48 AM

Quote:

Originally Posted by Evil_Trunks
it probably is joining them both when the NPC is created

i dont think join acts like a normal command

Thats what I was thinking.

PHP Code:

if (created || initialized) {
  
// Object Archetypes
  
if (strequals(#s(this.obj_archetype),chair)) {
    
setimg amz_chair.png;
    
join ph_chair;
  }
  if (
strequals(#s(this.obj_archetype),bed)) {
    
setimg element_bed1.png;
    
join ph_bed;
  }


That's what I'm using right now. It only joins the bed. I guess join isn't a normal command...

falco10291029 01-11-2005 12:48 AM

Quote:

Tried it. Wasn't working.
Well using the wrong string name definitely won't help :rolleyes:

Slash-P2P 01-11-2005 12:50 AM

Quote:

Originally Posted by falco10291029
Well using the wrong string name definitely won't help :rolleyes:

The string name is correct. The script works (up until the join command) fine with this. or thiso. string prefixes.

Tolnaftate2004 01-11-2005 02:17 AM

Quote:

Originally Posted by Slash-P2P
That's what I'm using right now. It only joins the bed. I guess join isn't a normal command...

I think that it is joining both, but whatever commands are in the bed class are overriding those of the chair class. The join command will execute, regardless of if the if statement it is nested in is true. I think the joins are executed before the rest of the script is run. Therefore, the string is nothing, and it is looking for a class ph_ (in your case).

NPC Code:
if (playerchats){
if (strequals(#c,join)){
join someclass;
}
}


This should join before you say anything.

JudgeDurst 01-11-2005 01:42 PM

Is this a class joining classes?
When i was experimenting i found the class itself becomes part of the class it joins, rather than the individual instance of the class.

Slash-P2P 01-11-2005 09:52 PM

Its a class joining a class. Anyways. The ph_ scripts are basically some image stuff and setshape stuff (maybe other functions later). Right now I made the stuff clientsided...I don't have a problem with the NPC anymore, but I think this should be fixed.

Make the join command work correctly so it obeys iff (conditions) it is placed under.

Kaimetsu 01-12-2005 01:01 PM

Join is a static directive, dawg. It's not a command per se.

Also, read KSI-GS.

TB3 01-12-2005 06:15 PM

as kaimetsu said its a static directive it doesnt matter where you put it if its there it will join that class IE the script of the class will be added to the npc it cannot fall into if statements so you will need to do something different.
An example being use putnpc2 inside the if statements and inside of the putnpc 2 script have it join the appropriate class eh?


All times are GMT +2. The time now is 06:20 PM.

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