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 10-10-2003, 02:05 AM
Zethar Zethar is offline
hmm
Zethar's Avatar
Join Date: May 2003
Posts: 1,452
Zethar is on a distinguished road
Send a message via ICQ to Zethar Send a message via AIM to Zethar
Really simple question :)

Ok, i'm trying to learn how to script and i'm doing something that when it happens it won't happen again.
for example.
NPC Code:

if (playerchats&&strequals(#c,Hello)){
players[index].rupees+=10;
}



It thought it might be something like this but it doesnt work
NPC Code:

if (playerchats&&strequals(#c,Hello)){
players[index].rupees+=10;
set Hello-Rupee}
if (playerchats&&strequals(#c,Hello)){
if (Hello-Rupee){message No more >:[
}
}


And whats the command for if all enemies are dead....?
__________________
hmm

Last edited by Zethar; 10-10-2003 at 02:19 AM..
Reply With Quote
  #2  
Old 10-10-2003, 02:27 AM
Qwert616 Qwert616 is offline
Possibly Possessed
Qwert616's Avatar
Join Date: Sep 2001
Posts: 4,694
Qwert616 is on a distinguished road
Re: Really simple question :)

Even though the second part of the money script finds that the event is false, it is still re-running the first event each time the player speaks.

I think you are looking for something like this:
NPC Code:
if (playerchats&&strequals(#c,Hello))
if (HelloRupee)
{message No more >:[;}
else
{players[index].rupees+=10;
set HelloRupee;
}




*note: There is most likely a more efficient way to do this*

I hope this helps.

Last edited by Qwert616; 10-10-2003 at 02:37 AM..
Reply With Quote
  #3  
Old 10-10-2003, 02:31 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Now don't go forgetting your semi-colons, they have a lot to do with scripting.

EDIT: No need to set a flag.
Reply With Quote
  #4  
Old 10-10-2003, 02:51 AM
Zethar Zethar is offline
hmm
Zethar's Avatar
Join Date: May 2003
Posts: 1,452
Zethar is on a distinguished road
Send a message via ICQ to Zethar Send a message via AIM to Zethar
ok that doesnt really work.
If you type "hello" once you get nothing and if you type hello1 or anything else after your money just goess up =(
__________________
hmm
Reply With Quote
  #5  
Old 10-10-2003, 03:21 AM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
A variable will help the script to work once. E.g:

NPC Code:


if(created){
this.mode = 0;
}

if(playerchats && strequals(#c,bah) && this.mode == 0){
playerrupees+=10;
this.mode = 1;
}



Done,you did it once and next time you won't be able to get more 10 gralats. Why did i put 'playerrupees' with underline? Because seems (is) better to use than players[index].rupees since it's for you.

Quote:

And whats the command for if all enemies are dead....?
read commands.rtf ^-^
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #6  
Old 10-10-2003, 04:21 AM
Qwert616 Qwert616 is offline
Possibly Possessed
Qwert616's Avatar
Join Date: Sep 2001
Posts: 4,694
Qwert616 is on a distinguished road
Ah, hm.

I should probably stop trying to help people in this section. ^_^;;

Thanks osrs, that helped me out too.
Reply With Quote
  #7  
Old 10-10-2003, 01:26 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 DustyPorViva
EDIT: No need to set a flag.
setting a flag would be the best way, otherwise somebody could get gralats over and over again by using update level.
__________________

Reply With Quote
  #8  
Old 10-10-2003, 03:50 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
geez, every one of you suck at formatting x_X
Reply With Quote
  #9  
Old 10-10-2003, 04:48 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Quote:
Originally posted by Python523
geez, every one of you suck at formatting x_X
Sorry if we aren't a master like you.

Quote:
Originally posted by CheeToS2

setting a flag would be the best way, otherwise somebody could get gralats over and over again by using update level.
A player won't update the level,so i think a variable would be fine >.<
But setting a flag work too.
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
Reply With Quote
  #10  
Old 10-10-2003, 06:55 PM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
Quote:
Originally posted by osrs

Sorry if we aren't a master like you.
It doesn't take an ounce of brainpower to format well.


Also, you didn't specify an index for player[index].rupees.
I also think that is read only.
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #11  
Old 10-10-2003, 08:07 PM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
funny how everyone is using the code brackets, yet half of them don't even bother to actually use spaces (the whole point of using code brackets)
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
Reply With Quote
  #12  
Old 10-10-2003, 08:45 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
This is all you need.

NPC Code:

if (playerchats){
if (strequals(#c,Hello) && !Hello) {
playerrupees += 10;
set Hello;
}
}



Simple as.
__________________
Former Global Scripting Team Member


Reply With Quote
  #13  
Old 10-10-2003, 09:48 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 osrs
A player won't update the level,so i think a variable would be fine >.<
But setting a flag work too.
If anybody ever fixed a tile error, or updated the level, or (possibly) if the server went down, the variable would be reset. Its foolish to not use some kind of permanent protection when dealing with rupees.

Quote:
Originally posted by Neoreno


It doesn't take an ounce of brainpower to format well.


Also, you didn't specify an index for player[index].rupees.
I also think that is read only.
You don't need [index] when dealing with the player in question, and its only read-only when its clientside.
__________________

Reply With Quote
  #14  
Old 10-10-2003, 09:51 PM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
In any case, I would think it's better to use playerrupees.
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #15  
Old 10-11-2003, 04:01 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Quote:
Originally posted by Dach
funny how everyone is using the code brackets, yet half of them don't even bother to actually use spaces (the whole point of using code brackets)
Wha? Code brackets as in '{'s? They're not inextricably related to spaces.
__________________
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:08 AM.


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