Graal Forums

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

JkWhoSaysNi 03-17-2005 04:45 PM

hasweapon()
 
I'm just trying to make a warp ring. The weapon itself is fine, it's the place where you pick it up i'm having trouble with.

I'm trying to use hasweapon(Warp Ring) to decide whether to show or hide the pickup npc.

like this:

NPC Code:

//#CLIENTSIDE
if (playerenters && hasweapon(Warp Ring)) hide;
else show;



It works fine offline.. but as soon as i upload the level it wont work.

Do i need to do something else to get this to work properly?

Kaimetsu 03-17-2005 04:56 PM

KSI-GS

JkWhoSaysNi 03-17-2005 05:09 PM

what's wrong with that?

Should i have braces around the show and hide? If so, why? In other languages it's poor convention to use begin and end when there is only one line after the condition.

Luigi203 03-17-2005 05:10 PM

Your weak link is, this is #gscript. What I really think he was reffering to is your placement of the hide; next to your if statement , and the &&.

Kaimetsu 03-17-2005 05:44 PM

Quote:

Originally Posted by JkWhoSaysNi
what's wrong with that?

You're not adhering to KSI-GS. In particular, you have code outside of event blocks.

JkWhoSaysNi 03-17-2005 05:55 PM

Ok. Thanks. I added the braces and it works now.

Kaimetsu 03-17-2005 06:20 PM

Quote:

Originally Posted by JkWhoSaysNi
Ok. Thanks. I added the braces and it works now.

Okay. But if that's all you did then you're still not adhering to KSI-GS.

Amagius 03-19-2005 02:04 AM

I believe Kai is referring to your If statement. He might not mean this, but I think you should change it to nested 'If' statements instead of connecting two predominantly detached events.

Kaimetsu 03-20-2005 10:23 AM

Quote:

Originally Posted by Amagius
I believe Kai is referring to your If statement

Well, you are kind of right, but only because that statement covers the entire of his script. No, my criticism is simply that he's ignoring the first rule of KSI-GS.

Amagius 03-20-2005 06:30 PM

Quote:

Originally Posted by Kaimetsu
Well, you are kind of right, but only because that statement covers the entire of his script. No, my criticism is simply that he's ignoring the first rule of KSI-GS.

Ah, okay.

Admins 03-21-2005 03:13 AM

Should be

NPC Code:

//#CLIENTSIDE
if (playerenters) {
if (hasweapon(Warp Ring))
hide;
else
show;
}



Kai: helping someone with their scripts is more important than some scripting guide :/ Sorry but such answers are pissing me

Kaimetsu 03-21-2005 04:01 AM

Quote:

Originally Posted by Stefan
Kai: helping someone with their scripts is more important than some scripting guide :/ Sorry but such answers are pissing me

Stefan, the point is that if he applied the rule then he would fix his problem. By directing him to it, I am helping him. Giving him a script will make things easier for him in the short-term, but he won't actually learn anything that could be used in the future.

Also: Even if he didn't take my advice - even if I didn't help him - did I actually harm him in any way? Did I obstruct his progression or make fun of his difficulties? I may not have contributed in the way that you would prefer, but I certainly didn't do anything bad.

EikeSiewertsen 03-21-2005 05:50 PM

Quote:

Originally Posted by Stefan
Should be

NPC Code:

//#CLIENTSIDE
if (playerenters) {
if (hasweapon(Warp Ring))
hide;
else
show;
}



Kai: helping someone with their scripts is more important than some scripting guide :/ Sorry but such answers are pissing me

Quote:

Originally Posted by this forum's rules
2) Likewise, don't post whole scripts for people. Post wordy solutions, certainly, but not things that people can just copy & paste into their levels without any effort.

...

zell12 03-21-2005 07:17 PM

Quote:

Originally Posted by EikeSiewertsen
...

Shut up Fry. He didn't post a whole script for someone, he gave him the help he asked for. Try to understand that that rule is in place so people dont come here asking for a "warp ring" script, instead of actually doing it themselfs.

Luigi203 03-21-2005 09:21 PM

Quote:

Originally Posted by zell12
Shut up Fry. He didn't post a whole script for someone, he gave him the help he asked for. Try to understand that that rule is in place so people dont come here asking for a "warp ring" script, instead of actually doing it themselfs.

I basically agree with you and stefan, he came asking for HELP, rather than coming to us saying "can any1 plz maek me warp ring script plzzz", but Kai is also right in that his script was horribly formatted.

Amagius 03-21-2005 10:08 PM

Quote:

Originally Posted by zell12
Shut up Fry. He didn't post a whole script for someone, he gave him the help he asked for. Try to understand that that rule is in place so people dont come here asking for a "warp ring" script, instead of actually doing it themselfs.

He did post the whole script. It does the action the thread starter wanted, so how can you say otherwise? Not that I think it was wrong of him to do this, as if he hadn't we probably would've gone in loops of "READ THIS"; still, formatting it so that it'll work is giving him the script.

zell12 03-21-2005 10:13 PM

He posted the part that was giving him trouble, Stefan didn't make the warp ring for him. That is why I said that to Fry. What the heck are you saying; how am I saying otherwise?

Darlene159 03-21-2005 10:15 PM

I dont know who made that rule, but giving someone a whole script when asked would not be a good idea, but when someone posts a script, and asks what is wrong with it, I see nothing wrong with someone showing them what they are doing wrong, showing the correct script, and then explaining what they did and why..there is no loss of learning there, and it isnt like they would be asking for an entire script to be handed to them. I know how frustrating it is to try to get a script working, and not being able to do it. I would never bring my question here because I know I wouldn't get help, and that's sad....

zell12 03-21-2005 10:20 PM

That rule I belive, like I said in my second last post, is so people dont come here looking for whole scripts. Like, for example, comming on here saying I need a Door scripted. Can someone make me a door? OH! How about making me a RC Car too!

But taking the piece of script that is giving you the trouble here, and asking for some help is alright. That is how it should be.

Darlene159 03-21-2005 10:25 PM

Quote:

Originally Posted by zell12
That rule I belive, like I said in my second last post, is so people dont come here looking for whole scripts. Like, for example, comming on here saying I need a Door scripted. Can someone make me a door? OH! How about making me a RC Car too!

But taking the piece of script that is giving you the trouble here, and asking for some help is alright. That is how it should be.

And I agree with you fully, personally I would like to know that I could come here for help since I suck at scripting, and take hours to find a problem with a script and alot of times it is something simple such as forgetting ; or a {}

Fry 03-21-2005 10:30 PM

Quote:

Originally Posted by zell12
Shut up Fry. He didn't post a whole script for someone, he gave him the help he asked for. Try to understand that that rule is in place so people dont come here asking for a "warp ring" script, instead of actually doing it themselfs.

Yes, he didn't ask for a whole script, he asked what was wrong with his script, Kai told him but he didn't really listen to it.
Now, what has he learned of it? Stefan didn't tell him what was wrong and it doesn't seem like he read the KSI-GS which would've solved his problem. It doesn't look like he learned anything of it so he is always going to ask for someone to fix his scripts and is never going to know what exactly the problem with it was.

Kaimetsu 03-21-2005 10:34 PM

Quote:

Originally Posted by Luigi203
Kai is also right in that his script was horribly formatted.

Man, I didn't say anything about formatting.

zell12 03-21-2005 10:39 PM

Quote:

Originally Posted by Fry
Yes, he didn't ask for a whole script, he asked what was wrong with his script, Kai told him but he didn't really listen to it.
Now, what has he learned of it? Stefan didn't tell him what was wrong and it doesn't seem like he read the KSI-GS which would've solved his problem. It doesn't look like he learned anything of it so he is always going to ask for someone to fix his scripts and is never going to know what exactly the problem with it was.

I'm pretty stupid when it comes to scripting and I can still find the difference between Stefans script and the other one. He was already told what was wrong.

Luigi203 03-21-2005 10:51 PM

Quote:

Originally Posted by Kaimetsu
Man, I didn't say anything about formatting.

I never said you said anything about anything, but in which other ways did he not 'adhere' to the first rule of the KSI-GS?

Kaimetsu 03-21-2005 11:00 PM

Quote:

Originally Posted by Luigi203
I never said you said anything about anything, but in which other ways did he not 'adhere' to the first rule of the KSI-GS?

Formatting is completely outside of the bounds of KSI-GS.

Luigi203 03-21-2005 11:09 PM

Alright, maybe I have my terms mixed up? What do you call the process of "improving the readability of a code"?

Kaimetsu 03-21-2005 11:16 PM

Quote:

Originally Posted by Luigi203
Alright, maybe I have my terms mixed up? What do you call the process of "improving the readability of a code"?

Well, I call it precisely that.


All times are GMT +2. The time now is 08:49 PM.

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