Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-12-2003, 04:42 AM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Err help?

Umm I was trying to scrip something that counts how many letters in your text you say, there are. This is kinda simple but it only works 1 time. And when I added a timeout it oviously didn't help. It's werid. I probally overlooked something but here ya go:
NPC Code:
// NPC made by Rob Getashu
if (created) {
this.ctxtcount = strlen(#v(#c));;
}
if (playerchats) {
if (this.ctxtcount=<8&&this.ctxtcount>0) {
message good;
}
if (this.ctxtcount>8) {
message bad;
}
}



Thanks
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
  #2  
Old 02-12-2003, 01:41 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
and you have two ;'s after the line of code Kai just questioned.. won't really harm the script I think, but its pointless none the less (you only need one) x.x

[edit]theres another big problem in it, but I think i'll let you figure that out yourself.. hint: you're using if (created) to check the length of the players chat text[/edit]
__________________

Reply With Quote
  #3  
Old 02-12-2003, 03:28 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Yea, but Kai, when I took out the (#v) it didn't work anymore. But when I leave it in, the string always stays 1? Maybe I was using the wrong command to read the number of letters?
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
  #4  
Old 02-12-2003, 03:47 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Quote:
Originally posted by Kaimetsu
Cheetos pointed out the biggest problem. if(created) only runs once.
SO Should I use if (timeout) there?
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
  #5  
Old 02-12-2003, 10:18 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Quote:
Originally posted by Kaimetsu


That depends. When do you want it to make the check?
Well, whatever the person chats, the script will make sure the text is 8 or below characters. Then it'll make the text a string and save it. And later print it out.
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
  #6  
Old 02-12-2003, 10:24 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 SSRobgeta

Well, whatever the person chats, the script will make sure the text is 8 or below characters. Then it'll make the text a string and save it. And later print it out.

Well there it is. You've got it. Now tell us, what event happens when a player chats?
what function checks the length of the string?
what is the string for the players current chat text?
how do you save a string?
how do you print out a string?


And in that order.
__________________
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
  #7  
Old 02-12-2003, 10:26 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Quote:
Originally posted by adam



Well there it is. You've got it. Now tell us, what event happens when a player chats?
what function checks the length of the string?
what is the string for the players current chat text?
how do you save a string?
how do you print out a string?


And in that order.
Err first, This is just a beta test on what I can;t work out. And Couldn't you easily just read the damn script instead of making me explain it
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
  #8  
Old 02-12-2003, 10:35 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
Quote:
Originally posted by SSRobgeta

Err first, This is just a beta test on what I can;t work out. And Couldn't you easily just read the damn script instead of making me explain it
he asked those questions to explain to you how to create your script correctly x.x
__________________

Reply With Quote
  #9  
Old 02-12-2003, 10:50 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Quote:
Originally posted by CheeToS2

he asked those questions to explain to you how to create your script correctly x.x
o.o
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
  #10  
Old 02-12-2003, 11:03 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 CheeToS2

he asked those questions to explain to you how to create your script correctly x.x
Indeed I did. :-)

All of the answers to those questions are in the script posted already. But things are a bit out of order in it. >.< Maybe he's just not used to the way graal does things.
__________________
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
  #11  
Old 02-12-2003, 11:16 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Quote:
Originally posted by adam
Maybe he's just not used to the way graal does things.
Yea, I'm use to other Programing languages and I haven't scripted in Gscript for awhile, but I got it fixed see!
NPC Code:

// NPC made by Rob Getashu
if (created || playerenters) {
timeout = 0.1;
}
if (timeout) {
this.ctxtcount = strlen(#c);
if (this.ctxtcount<=8) {
message good #v(this.ctxtcount);
}
if (this.ctxtcount>8) {
message bad;
}
timeout = 0.1;
}

__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
  #12  
Old 02-12-2003, 11:27 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 SSRobgeta

Yea, I'm use to other Programing languages and I haven't scripted in Gscript for awhile, but I got it fixed see!
NPC Code:

// NPC made by Rob Getashu
if (created || playerenters) {
timeout = 0.1;
}
if (timeout) {
this.ctxtcount = strlen(#c);
if (this.ctxtcount<=8) {
message good #v(this.ctxtcount);
}
if (this.ctxtcount>8) {
message bad;
}
timeout = 0.1;
}

Good job, Now forget the timeout loop and use the playerchats event. :-) Save the timeout loop for something that requires one.
__________________
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
  #13  
Old 02-13-2003, 10:23 PM
mhermher mhermher is offline
galase galase!
mhermher's Avatar
Join Date: Jun 2001
Location: Sweden, Stockholm.
Posts: 2,012
mhermher is on a distinguished road
Send a message via ICQ to mhermher Send a message via AIM to mhermher Send a message via Yahoo to mhermher
Why did my post get deleted?
__________________
Donate money for my trip to Germany

Adiarde Manager
Reply With Quote
  #14  
Old 02-13-2003, 10:30 PM
SSRobgeta SSRobgeta is offline
Ebil Cloud = l337 *kupo*
SSRobgeta's Avatar
Join Date: Aug 2001
Location: Monroeville, PA
Posts: 1,084
SSRobgeta is on a distinguished road
Send a message via AIM to SSRobgeta
Quote:
Originally posted by mhermher
Why did my post get deleted?
Your answer lies within the mods young grasshopper...
__________________
Rob Getashu
Anyone can show you the way, but the real adventure is finding it yourself..
Reply With Quote
Reply


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 09:32 PM.


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