Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-02-2003, 07:14 PM
melissa1988 melissa1988 is offline
Fruitty Jewel of Flavor
melissa1988's Avatar
Join Date: Dec 2002
Posts: 992
melissa1988 is on a distinguished road
Send a message via AIM to melissa1988 Send a message via Yahoo to melissa1988
if (playersays) problem

Hey, I've never done scripting before and I'm just starting to learn a little bit. Would anyone be kind enough to tell me what I did wrong with this little script I made? It works for the most part, but some parts won't

NPC Code:
  
if (playertouchsme) {message Welcome to my room!;sleep 3;message Do you like punk?;sleep 3;
if (playersays(yes)) {message Really? I LOVE punk!;sleep 3;message You got any liquor?;sleep 3;
if (playersays(yes)) {message Cool! Give me some shots!;sleep 3;
if (playersays(no)) {message Aww...You're no fun...;}}}
}
if (playersays(no)) {message You're *** then! Punk rules!;sleep 3;
if (playersays(**** you)) {message No thanks, I have your mom for that!;sleep 3;
if (playersays(shut up pickles!)) {message No you shut up!;shootnuke down;}}
}
if (playerisfemale) {message Hey baby wanna screw?;sleep 3;
if (playersays(no)) {message That's okay, you're just one of millions!;sleep 3;
if (playersays(yes)) {message Go lay in the bed! I'll be there...;sleep 3;
if (playersays(okay)) {message Go lay in the bed! I'll be there...;sleep 3;}}}
}
if (playeronhorse) {message Get off that horse you ****! You're trackin' mud on my floor!;sleep 3;
}
if (wa****) {message Ouch! Take this ya ****!;shootnuke down;
}


the parts that don't work are the (playersays(no)) {message Aww...you're no fun}, (playersays(**** you)) {message No thanks...}. and a few others i think...
I'm still learning this so it's probably something stupid so I appologize to all the scripting gurus here. I've been searching all over the place for someone to help, so this is my last resort. Thanks in advance. I'm not asking for someone to fix my code, but for someone to tell me how to fix it or suggest a better way to do this.. thanks
Reply With Quote
  #2  
Old 03-02-2003, 07:28 PM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
Use

if (playerchats&&strequals(#c,text)) {
stuff;
}

Instead of playersays.
__________________
QUICK LOOK BUSY JESUS IS COMING!
Reply With Quote
  #3  
Old 03-02-2003, 08:23 PM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Quote:
Originally posted by AlexH
Use

if (playerchats&&strequals(#c,text)) {
stuff;
}

Instead of playersays.
Example using your (melissa-whatever's) code:

NPC Code:

if (playertouchsme){
message Welcome to my room!;
sleep 3;
message Do you like punk?;
sleep 3;
if (playerchats && strequals(#c,yes)) {message Really? I LOVE punk!;
sleep 3;
message You got any liquor?;
sleep 3;
}
}


#c = chat, in case you didn't know.

strequals is really useful, as is strcontains and other things with "str" in them. I recommend looking them up and learning more about them. Check in newfeatures also. There are some pretty new commands there.
Reply With Quote
  #4  
Old 03-02-2003, 08:39 PM
Knuckles Knuckles is offline
Registered User
Join Date: Sep 2002
Location: New York
Posts: 580
Knuckles is on a distinguished road
Send a message via AIM to Knuckles
Quote:
Originally posted by Torankusu

Example using your (melissa-whatever's) code:

NPC Code:

if (playertouchsme){
message Welcome to my room!;
sleep 3;
message Do you like punk?;
sleep 3;
if (playerchats && strequals(#c,yes)) {message Really? I LOVE punk!;
sleep 3;
message You got any liquor?;
sleep 3;
}
}


#c = chat, in case you didn't know.

strequals is really useful, as is strcontains and other things with "str" in them. I recommend looking them up and learning more about them. Check in newfeatures also. There are some pretty new commands there.
O.O, I don't think that would work.. >:P.
It would, accept you would have to say it EXACTLY on the 3rd second.

NPC Code:

if (playertouchsme) {
message Hi, whats up?;
sleep 1;
message Do you like punk?;
this.mode = 1; // Just pretend that this means 'if was talked to'
}

if (playerchats && strequals(#c,yes) && this.mode == 1) message Oh cool! Me too!;
// Noticed I added the && this.mode == 1.
// Thats to check if the NPC was talked to/touched

// Else if the player chats NO.. blah
else if (playerchats && strequals(#c,no) && this.mode == 1) message Ewww! I can't belive you don't like punk!;

__________________
Knuckles
"They say 60% of the time, it works everytime!"
Reply With Quote
  #5  
Old 03-02-2003, 08:55 PM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
Quote:
Originally posted by Knuckles


O.O, I don't think that would work.. >:P.
It would, accept you would have to say it EXACTLY on the 3rd second.

NPC Code:

if (playertouchsme) {
message Hi, whats up?;
sleep 1;
message Do you like punk?;
this.mode = 1; // Just pretend that this means 'if was talked to'
}

if (playerchats && strequals(#c,yes) && this.mode == 1) message Oh cool! Me too!;
// Noticed I added the && this.mode == 1.
// Thats to check if the NPC was talked to/touched

// Else if the player chats NO.. blah
else if (playerchats && strequals(#c,no) && this.mode == 1) message Ewww! I can't belive you don't like punk!;

I didn't test it, nor was I expecting it to work. I just showed him how to use the playerchats and strequals. He can find out the bugs on his own.
Reply With Quote
  #6  
Old 03-02-2003, 09:08 PM
Knuckles Knuckles is offline
Registered User
Join Date: Sep 2002
Location: New York
Posts: 580
Knuckles is on a distinguished road
Send a message via AIM to Knuckles
Quote:
Originally posted by Torankusu

I didn't test it, nor was I expecting it to work. I just showed him how to use the playerchats and strequals. He can find out the bugs on his own.
o.O, okie.
__________________
Knuckles
"They say 60% of the time, it works everytime!"
Reply With Quote
  #7  
Old 03-02-2003, 09:28 PM
melissa1988 melissa1988 is offline
Fruitty Jewel of Flavor
melissa1988's Avatar
Join Date: Dec 2002
Posts: 992
melissa1988 is on a distinguished road
Send a message via AIM to melissa1988 Send a message via Yahoo to melissa1988
Thanks! That seems to be more efficient

I'm having a problem with else if though

NPC Code:

if (playertouchsme) {message Hi, welcome to my humble abode!;sleep 1;message Do you like punk?;this.mode = 1;}
if (playerchats && strequals(#c,yes) && this.mode == 1) message Oh cool! Me too!;sleep 2;message You got any liqour?;this.mode = 2;
else if (playerchats && strequals(#c,no) && this.mode == 1) message You're *** then! Punk rules!;
else if (playerchats && strequals(#c,maybe) && this.mode == 1) message Maybe? What kinda goofball answer is that?;
else if (playerchats && strequals(#c,no) && this.mode == 2) message Damn! I wanna get FUBARed!;
}



it tells me no if-cause specified...i don't understand what that means

Last edited by melissa1988; 03-02-2003 at 09:56 PM..
Reply With Quote
  #8  
Old 03-02-2003, 10:21 PM
Falados Falados is offline
Cucumber NPC
Falados's Avatar
Join Date: Jan 2003
Posts: 141
Falados is on a distinguished road
Send a message via ICQ to Falados Send a message via AIM to Falados
Dont use playerchats inside other things =\.
I dont think it is a wise idea to nest events... strequals(#c,whatever) should suffice, as long as it is nested in your event (in this case, the event is playertouchsme)
__________________

subliminal message: 1+1=3
Reply With Quote
  #9  
Old 03-02-2003, 11:05 PM
melissa1988 melissa1988 is offline
Fruitty Jewel of Flavor
melissa1988's Avatar
Join Date: Dec 2002
Posts: 992
melissa1988 is on a distinguished road
Send a message via AIM to melissa1988 Send a message via Yahoo to melissa1988
Thanks. Sorry I'll remember that in the future
It works now.
Reply With Quote
  #10  
Old 03-03-2003, 07:27 AM
funnylinkwantsbomys funnylinkwantsbomys is offline
Omi New
funnylinkwantsbomys's Avatar
Join Date: Mar 2001
Location: ohio
Posts: 2,116
funnylinkwantsbomys is on a distinguished road
Send a message via AIM to funnylinkwantsbomys
if (playertouchsme){
message Welcome to my room!;
sleep 2;
message Do you like punk?;
sleep .5;
if (playerchats && strequals(#c,yes)) {message Really? I LOVE punk!;
sleep 2;
message You got any liquor?;
sleep 2;
}
}
sleep should be small between those?
__________________

"Microwave a piece of cheese for 40secs and eat it. Yum." -Funnylink
Reply With Quote
  #11  
Old 03-03-2003, 07:42 AM
Knuckles Knuckles is offline
Registered User
Join Date: Sep 2002
Location: New York
Posts: 580
Knuckles is on a distinguished road
Send a message via AIM to Knuckles
Dont put the playerchats inside the playertouchsme.
__________________
Knuckles
"They say 60% of the time, it works everytime!"
Reply With Quote
  #12  
Old 03-03-2003, 01:23 PM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
I'd show you a little example here... but after i read what it says it would insult the maker and anybody who contributed for that npc to exist at all
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #13  
Old 03-03-2003, 05:01 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by Kaimetsu
It's kinda annoying when people don't listen to me
:-( It only happened once, you ever gonna unblock me?

Quote:
Originally posted by funnylinkwantsbomys
if (playertouchsme){
message Welcome to my room!;
sleep 2;
message Do you like punk?;
sleep .5;
if (playerchats && strequals(#c,yes)) {message Really? I LOVE punk!;
sleep 2;
message You got any liquor?;
sleep 2;
}
}
sleep should be small between those?
You really should find a way to do it without sleep, sleep can be hazardous. Try timeouts. And again, don't use playerchats inside of another if statement.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #14  
Old 03-03-2003, 05:39 PM
HoudiniMan HoudiniMan is offline
Playerworld Administrator
HoudiniMan's Avatar
Join Date: Dec 2001
Location: Calfiornia - USA
Posts: 3,512
HoudiniMan will become famous soon enough
In general while still not supporting the boozer npc...

NPC Code:

if (playerenters) {
message initial;
sleep 2; //
message ; // only needing sleep if you want to clear the message
}
if (playerchats&&strequals(#c,yes)) {
message newmessage;
}
if (playerchats&&strequals(#c,newreply)) {
message another new message;
}



Sleep is unneeded unless you want the message to leave after a couple seconds, in which case you need to set it to blank
__________________
-HoudiniMan (Chief Playerworld Administrator)
Compulsive Support Center Checker - 5 Years and Change
Graal Support Center

Reply With Quote
  #15  
Old 03-03-2003, 07:03 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by funnylinkwantsbomys
if (playertouchsme){
message Welcome to my room!;
sleep 2;
message Do you like punk?;
sleep .5;
if (playerchats && strequals(#c,yes)) {message Really? I LOVE punk!;
sleep 2;
message You got any liquor?;
sleep 2;
}
}
sleep should be small between those?

Listen to Kai!

NPC Code:

if (playertouchsme) {
message Welcome to my room!;
sleep 2;
message Do you like punk?;
sleep 2;
if (strequals(#c,yes)) {
message Really? I LOVE punk!;
sleep 2;
message You got any liquor?;
sleep 2;
}
}

__________________
[signature]insert here[/signature]
Reply With Quote
  #16  
Old 03-04-2003, 05:42 AM
tlf288 tlf288 is offline
Registered User
tlf288's Avatar
Join Date: Nov 2001
Location: new account: Trevor
Posts: 0
tlf288 is on a distinguished road
Send a message via AIM to tlf288 Send a message via Yahoo to tlf288
NPC Code:

if (playertouchsme) {
message Listen to frickin Kai! k?;
set asked;
}

if (playerchats && asked) {
if (strequals(#c,Ok)) {
message Thank you, he is the smartest being ya know!;
}
else if (strequals(#c,No)) {
message Well then your just a dope...;
}
else if (strequals(#c,Why)) {
message Becasue he is the smartest being, duh!;
}

sleep3;
message;
}



Comment the sleep3 and message to make it so the message doesn't clear.
__________________
new account: Trevor
Reply With Quote
  #17  
Old 03-04-2003, 06:07 PM
melissa1988 melissa1988 is offline
Fruitty Jewel of Flavor
melissa1988's Avatar
Join Date: Dec 2002
Posts: 992
melissa1988 is on a distinguished road
Send a message via AIM to melissa1988 Send a message via Yahoo to melissa1988
Well at any rate, thanks for giving me several ways to do the same effect. I really appreciate how helpful you guys have been.
Reply With Quote
  #18  
Old 03-08-2003, 08:29 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by Kaimetsu
NPC Code:

if(playertouchsme){
message So, you wanna see how I'd code it?;
this.state=1;
timeout=2;
}
if(timeout) message;
if(playerchats){
if(this.state==1){
if(strequals(#c,yes)){
message Well you can just go to hell; timeout=2;
}
elseif(strequals(#c,no)){
message Well you can just go to hell; timeout=2;
}
}
}

This is why you should not anger the script monkey
__________________
Reply With Quote
  #19  
Old 03-08-2003, 08:39 PM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
Quote:
Originally posted by G_yoshi


This is why you should not anger the script monkey
^.^
I answered no. I guess I get to visit Michigan.
__________________
[signature]insert here[/signature]
Reply With Quote
  #20  
Old 03-08-2003, 09:03 PM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by screen_name


^.^
I answered no. I guess I get to visit Michigan.
Erm...::
__________________
Reply With Quote
  #21  
Old 03-09-2003, 12:29 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by screen_name


^.^
I answered no. I guess I get to visit Michigan.
Why are you visiting me?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #22  
Old 03-09-2003, 09:33 AM
screen_name screen_name is offline
is watching you
Join Date: Mar 2002
Location: The 3rd Dimension
Posts: 2,160
screen_name is on a distinguished road
Send a message via AIM to screen_name Send a message via MSN to screen_name
There is a place named Hell, Michigan.
__________________
[signature]insert here[/signature]
Reply With Quote
  #23  
Old 03-10-2003, 01:36 AM
G_yoshi G_yoshi is offline
Forbidden
G_yoshi's Avatar
Join Date: Mar 2001
Posts: 7,206
G_yoshi will become famous soon enough
Send a message via AIM to G_yoshi
Quote:
Originally posted by screen_name
There is a place named Hell, Michigan.
Already knew that.

Lots of other cities with strange names.
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:18 PM.


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