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 08-04-2005, 06:51 PM
alissalee alissalee is offline
Mr. Ciprioni Atrius Admin
alissalee's Avatar
Join Date: Dec 2004
Location: Lawrence, Ma
Posts: 190
alissalee is an unknown quantity at this point
Send a message via AIM to alissalee Send a message via MSN to alissalee
Safe script

if (created||timeout) {
message Tips: #s(server.BHE);
timeout=0.5;
}
if (playerchats&&strequals(#a,Birdwell)||strequals(#a ,Brandons account)||strequals(#a,Dark Dragon Guardian)){}
if (startswith(/take,#c)) {
tokenize #c;
if (strtofloat(#s(server.BHE))>=strtofloat(#t(1))){
if (strtofloat(#t(1))>0){
playerrupees+=strtofloat(#t(1));
setstring server.BHE,#v(strtofloat(#s(server.BHE))-strtofloat(#t(1)));
setplayerprop #c,Took #t(1)!;
message Tips: -#t(1);
sleep 3;
message Tips: #s(server.BHE);
}else setplayerprop #c,Can't take that!;
}}

if (playerchats) {
if (startswith(/tip,#c)){
tokenize #c;
if (playerrupees>=strtofloat(#t(1))){
if (strtofloat(#t(1))>0){
playerrupees-=strtofloat(#t(1));
setstring server.BHE,#v(strtofloat(#s(server.BHE))+strtofloa t(#t(1)));
setplayerprop #c, Tipped #t(1)!;
message Tips: +#t(1);
sleep 3;
message Tips: #s(server.BHE);
}
}
}
the script works but it gives out money to ppl not in the list to be able to take it. help please
Reply With Quote
  #2  
Old 08-04-2005, 07:41 PM
protagonist protagonist is offline
Banned
protagonist's Avatar
Join Date: May 2003
Location: CAW
Posts: 5,586
protagonist is on a distinguished road
Send a message via AIM to protagonist Send a message via MSN to protagonist
Quote:
Originally Posted by alissalee
if (created||timeout) {
message Tips: #s(server.BHE);
timeout=0.5;
}
if (playerchats&&strequals(#a,Birdwell)||strequals(#a ,Brandons account)||strequals(#a,Dark Dragon Guardian)){}
if (startswith(/take,#c)) {
tokenize #c;
if (strtofloat(#s(server.BHE))>=strtofloat(#t(1))){
if (strtofloat(#t(1))>0){
playerrupees+=strtofloat(#t(1));
setstring server.BHE,#v(strtofloat(#s(server.BHE))-strtofloat(#t(1)));
setplayerprop #c,Took #t(1)!;
message Tips: -#t(1);
sleep 3;
message Tips: #s(server.BHE);
}else setplayerprop #c,Can't take that!;
}}

if (playerchats) {
if (startswith(/tip,#c)){
tokenize #c;
if (playerrupees>=strtofloat(#t(1))){
if (strtofloat(#t(1))>0){
playerrupees-=strtofloat(#t(1));
setstring server.BHE,#v(strtofloat(#s(server.BHE))+strtofloa t(#t(1)));
setplayerprop #c, Tipped #t(1)!;
message Tips: +#t(1);
sleep 3;
message Tips: #s(server.BHE);
}
}
}
the script works but it gives out money to ppl not in the list to be able to take it. help please
The account check isn't even checking anything. You close it instead of continuing with the event block.
Reply With Quote
  #3  
Old 08-04-2005, 08:22 PM
alissalee alissalee is offline
Mr. Ciprioni Atrius Admin
alissalee's Avatar
Join Date: Dec 2004
Location: Lawrence, Ma
Posts: 190
alissalee is an unknown quantity at this point
Send a message via AIM to alissalee Send a message via MSN to alissalee
Quote:
Originally Posted by protagonist
The account check isn't even checking anything. You close it instead of continuing with the event block.
ok that means wat i am a new scripter i dont know that much
Reply With Quote
  #4  
Old 08-04-2005, 08:48 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
1. KSI-GS (Rule 2a and Rule 8).
2. You may want to check that they're adding / taking an integer value.
3. The timeout isn't necessary...
Reply With Quote
  #5  
Old 08-04-2005, 09:28 PM
PastAustin PastAustin is offline
Registered User
Join Date: Mar 2003
Location: Littleton, Colorado, US
Posts: 91
PastAustin is on a distinguished road
Send a message via ICQ to PastAustin Send a message via AIM to PastAustin
Quote:
Originally Posted by Tolnaftate2004
1. KSI-GS (Rule 2a and Rule 8).
2. You may want to check that they're adding / taking an integer value.
3. The timeout isn't necessary...
If this weren't a simple fix I probably would completly recode it. So lets act as if it weren't.

Alissalee:
The thing I was pointing out with this that I guess I should have actually hilited it that you need to watch your groupings. You had this:
PHP Code:
if (playerchats&&strequals(#a,Birdwell)||strequals(#a,Brandons account)||strequals(#a,Dark Dragon Guardian)){} 
and then this:
PHP Code:
if (startswith(/take,#c)) { 
I am guessing you accidently closed the condition but what it was testing was not
PHP Code:
if (playerchats && startswith(/take#c) && (strequals(#a,Birdwell)||strequals(#a,Brandons account)||strequals(#a,Dark Dragon Guardian))) 
but
PHP Code:
// Does nothing:
if (playerchats && strequals(#a,Birdwell) || strequals(#a,Brandons account) || strequals(#a,Dark Dragon Guardian) {}
// And
if (startswith(/take#c)) {
// actions

Meaning that it would never reach the code block with the startswith because startswith is not a trigger. Also since you had:
PHP Code:
if (playerchats && strequals(#a,Birdwell)||strequals(#a,Brandons account)||strequals(#a,Dark Dragon Guardian)) {} 
You were literally saying
If the player chats and the account is Birdwell or if (no action) and the account is Brandons Account or (no action) and the account is Dark Dragon Guardian.
Meaning that the playerchats (the trigger) had no effect on Brandons Account or Dark Dragon Guardian since neither of them had the playerchats attached to them.

That is the long way of explaining it. Hope it helped.
__________________
"...I'm going to burn this place down..."
-Milton

Last edited by Lance; 08-04-2005 at 09:35 PM.. Reason: Violation of forum rule 2
Reply With Quote
  #6  
Old 08-04-2005, 10:03 PM
Lance Lance is offline
dark overlord
Lance's Avatar
Join Date: Sep 2003
Location: Space Jam Mountain
Posts: 5,072
Lance is on a distinguished road
In addition to everything already said, I'd suggest only re-displaying the tip amount when the NPC is created or when the tip amount has changed. It's unnecessary to have such a timeout-display unless you have some other script changing it (which does not seem to be the case).
Reply With Quote
  #7  
Old 08-04-2005, 10:15 PM
alissalee alissalee is offline
Mr. Ciprioni Atrius Admin
alissalee's Avatar
Join Date: Dec 2004
Location: Lawrence, Ma
Posts: 190
alissalee is an unknown quantity at this point
Send a message via AIM to alissalee Send a message via MSN to alissalee
thank you it works right.
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 08:31 PM.


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