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 05-21-2002, 03:34 AM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
Little Problem!

NPC Code:
if (playertouchsme&&strequals(#s(eventtoken)&&strtofl  oat(#s(eventtoken)>=strtofloat(1)){
setlevel2 level2.graal,30,30;
}
else
if (Playertouchsme) {
say2 #bTokens needed;
}



The idea is, if you have more than ONE eventtoken then it warps you! Its on NONE NPC Server, anyone know prob?

flagitsets (Of Course) is:
eventtoken=xx *xx=Number!

ive tried a few thanks but none seem to work, I am none the wiser, anyone can help?

-Spark911
__________________
--Spark911
Reply With Quote
  #2  
Old 05-21-2002, 06:02 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
Re: Little Problem!

NPC Code:

if (playertouchsme&&strequals(#s(eventtoken)&&strtofloat(#s(eventtoken)>=strtofloat(1)){
setlevel2 level2.graal,30,30;
} elseif (playertouchsme) {
say2 #bTokens needed;
}



first bold - no end part of srequals
second bold - forgot the ending ) around strtofloat
__________________
[signature]insert here[/signature]
Reply With Quote
  #3  
Old 05-21-2002, 06:38 AM
mikepg mikepg is offline
Registered User
Join Date: Nov 2001
Location: VA, USA
Posts: 501
mikepg is on a distinguished road
Send a message via AIM to mikepg Send a message via Yahoo to mikepg
if statement should look like this:














if (playertouchsme&&strtofloat(#s(eventtoken))>=1) {
stuff here;
}
else if (playertouchsme) stuff here;
__________________
~War Lord Mpg2
Bravo Online's Asst. Staff Manager

"Sittin by the tree, sippin eggnog, waitin on christmas gifts"
Reply With Quote
  #4  
Old 05-21-2002, 08:04 AM
Despo1 Despo1 is offline
Registered User
Join Date: May 2002
Location: G3rM4nY
Posts: 38
Despo1 is on a distinguished road
Send a message via AIM to Despo1
NPC Code:

if(playertouchsme){
this.testvar = strtofloat(#s(eventtoken));
if(this.testvar > 0)
setlevel2 level2.graal,30,30;
else
say2
#b
Tokens needed;
}

__________________
Bl4h Si6n4tur3s sUx3n
Reply With Quote
  #5  
Old 05-21-2002, 10:46 PM
Saga2001 Saga2001 is offline
Wishing he had 3 feet
Join Date: Aug 2001
Location: Basement
Posts: 1,565
Saga2001 is on a distinguished road
Send a message via ICQ to Saga2001 Send a message via AIM to Saga2001 Send a message via Yahoo to Saga2001
I wouldn't have either. Also a note to screen name, its else if not elseif, though I am not sure it matters...
Also you should try to only test something once in a script, unless you have statements where you test if its not true and playertouchsme and you test if it is true and playertouchs me, otherwise both or one probably not the one you want will be executed.
For example:
NPC Code:

// way one:
if (playertouchsme && thisistrue) unset thisistrue;
if (playertouchsme && !thisistrue) set thisistrue;
sleep .05;
// way two:
if (playertouchsme) {
if (thisistrue) unset thisistrue;
else set thisistrue;
sleep .05;
}
// way three:
if (playertouchsme) {
if (thisistrue) unset thisistrue;
if (!thisistrue) set thisistrue;
sleep .05;
}
// way four and the most complicated way:
if (created)
setstring this.displays,"Hello Message A","Hello Message B";
if (playertouchsme) {
this.disp = (thisistrue ? 1 : 0);
showMessage();
sleep .05;
}
function showMessage()
say2 #I(this.displays, this.disp);



See there are many sides of one coin.
__________________

!Wan ( 11:27:55 AM):
can i c ur scripts please?
Zorg (RC): If I hear NPC Server call Ne0, Past Austin or Brent sexy one more time im disconnecting it
Reply With Quote
  #6  
Old 05-22-2002, 12:34 AM
Spark910 Spark910 is offline
Ex-Graal Global
Spark910's Avatar
Join Date: Oct 2001
Location: England
Posts: 10,892
Spark910 has a spectacular aura about
Thankyou People!
__________________
--Spark911
Reply With Quote
  #7  
Old 05-23-2002, 08:08 PM
BBflat BBflat is offline
Registered User
BBflat's Avatar
Join Date: Apr 2002
Location: United States of America
Posts: 573
BBflat is on a distinguished road
Quote:
Originally posted by Kaimetsu
This is part of the reason why people should NEST IF STATEMENTS MORE.
=)
__________________
I am a .sig virus. Please put me in your .sig so I can continue to replicate.
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 12:16 PM.


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