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-23-2005, 08:55 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
Pay check System

how would i script the part when the player chats /paycheck it only takes $250 playerrupees from the safe?
Reply With Quote
  #2  
Old 08-23-2005, 10:16 PM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
-shakes head-
Not to be rude or anything, but judging by the vast number of questions you've been asking about simple things or things you have no idea how to do, you really need to get a NAT for your server.
__________________
Reply With Quote
  #3  
Old 08-23-2005, 10:23 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
Use a database.
__________________
Reply With Quote
  #4  
Old 08-24-2005, 01:15 AM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
Keep the money that's in that safe in a serverr. string.

NPC Code:
if (playerchats && strequals(#c,/paycheck)) {



Ok, so

NPC Code:
if (playerchats ...



This is detected when enter is hit entering a message.

NPC Code:
&& strequals(#c,/paycheck)) {



&& is just another way of saying and in scripting. So far we have 'if the player enters a message and'. strequals is used to determine what a player has. In this case, it's looking for something the player is saying (notice #c). So, if the player enters a message and the player's chat text is '/paycheck', what is written in the bracers will take place.

NPC Code:
if (playerchats && strequals(#c,/paycheck)) {
playerrupees += 250;
setstring 'serverr.strings',strtofloat(#s('serverr.strings') ) - 250;
}



Of course, you will have to add another flag in there to test whether the safe has 250g or not; but that's your job.
Reply With Quote
  #5  
Old 08-24-2005, 01:52 AM
Luigi203 Luigi203 is offline
Hamma Time
Luigi203's Avatar
Join Date: Mar 2003
Location: North East PA
Posts: 285
Luigi203 is on a distinguished road
Send a message via AIM to Luigi203
Quote:
Originally Posted by Bl0nkt
Keep the money that's in that safe in a serverr. string.
What the hell, Hachi? Use a DB NPC, did you absorb nothing I tried to teach you? I guess you like opening your server. flags and wondering what the hell each flag means.

Quote:
Originally Posted by Bl0nkt
NPC Code:
if (playerchats && strequals(#c,/paycheck)) {
playerrupees += 250;
setstring 'serverr.strings',strtofloat(#s('serverr.strings') ) - 250;
}

NPC Code:

setstring 'serverr.strings',#v(strtofloat(#s('serverr.strings')) - 250);




Use the flag prefix thiso. and with(). Thiso. flags belong to the npc that is 'calling' another with the with() function, for example,
NPC Code:

thiso.var = 5;
with (getnpc(DBNPC)) this.var += thiso.var;



If you were to just do "with (getnpc(DBNPC)) this.var += this.var;"
it would add DBNPC's this.var to itself, however, since thiso.var belongs to the current npc and it equals 5, it adds 5 to DBNPC's this.var. I hope you understand this...
__________________


CAUTION
Reply With Quote
  #6  
Old 08-24-2005, 11:56 PM
Bl0nkt Bl0nkt is offline
Era Developer
Bl0nkt's Avatar
Join Date: Mar 2005
Location: Pennsylvania
Posts: 1,589
Bl0nkt will become famous soon enough
Send a message via AIM to Bl0nkt
Quote:
Originally Posted by Luigi203
What the hell, Hachi? Use a DB NPC, did you absorb nothing I tried to teach you? I guess you like opening your server. flags and wondering what the hell each flag means.



NPC Code:

setstring 'serverr.strings',#v(strtofloat(#s('serverr.strings')) - 250);




Use the flag prefix thiso. and with(). Thiso. flags belong to the npc that is 'calling' another with the with() function, for example,
NPC Code:

thiso.var = 5;
with (getnpc(DBNPC)) this.var += thiso.var;



If you were to just do "with (getnpc(DBNPC)) this.var += this.var;"
it would add DBNPC's this.var to itself, however, since thiso.var belongs to the current npc and it equals 5, it adds 5 to DBNPC's this.var. I hope you understand this...
I never really learned about DBs. :[
Reply With Quote
  #7  
Old 08-25-2005, 01:46 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
hey cool, my post got deleted
guess i'm not supposed to help out o.O
__________________
Reply With Quote
  #8  
Old 08-25-2005, 02:18 AM
Malinko Malinko is offline
Unholy Nation
Join Date: Mar 2004
Location: Massachusetts, U.S.A.
Posts: 1,782
Malinko is on a distinguished road
Send a message via AIM to Malinko
Quote:
Originally Posted by calani
hey cool, my post got deleted
guess i'm not supposed to help out o.O
http://forums.graalonline.com/forums...cement.php?f=8

Read Rules #2 and #4.
Reply With Quote
  #9  
Old 08-25-2005, 06:19 AM
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
Quote:
Originally Posted by Malinko
Only rule 2 was applicable in this case.
Reply With Quote
  #10  
Old 08-25-2005, 08:02 PM
konidias konidias is offline
Old Bee
konidias's Avatar
Join Date: Jul 2001
Location: Orlando, FL
Posts: 7,222
konidias will become famous soon enough
Send a message via AIM to konidias
His post was moot considering the starting post breaks rule #1.
__________________

Put this image in your sig if you support Bomy Island! (g2k1 revision)
play bomberman while you wait!


Reply With Quote
  #11  
Old 08-26-2005, 01:51 AM
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
Quote:
Originally Posted by konidias
His post was moot considering the starting post breaks rule #1.
Not intrinsically.
Reply With Quote
  #12  
Old 08-27-2005, 12:45 AM
Gamba_Legend Gamba_Legend is offline
Slow NPC Scripter
Join Date: Jun 2005
Location: Asbury Park, New Jersey
Posts: 63
Gamba_Legend is on a distinguished road
Send a message via AIM to Gamba_Legend
Just ignore this person from now on
It's not my idea this person was hired and/or not fired -.-
__________________

is bad
IDC!
s-t-f-u
Reply With Quote
  #13  
Old 08-27-2005, 01:02 AM
calani calani is offline
Scriptess
calani's Avatar
Join Date: Aug 2003
Location: asmgarden.gmap
Posts: 606
calani is on a distinguished road
Send a message via AIM to calani
Quote:
Originally Posted by Malinko
Read Rules #2 and #4
har har @ breaking rule #4.
shall I bring up our last argument wherein every one of your glorious 'points' were off or misinformed, or completely and utterly wrong?
Quote:
Originally Posted by Malinko
For all we know, the only information you posess is the knowledge of you abusing your powers and harassing players/playerworlds with the powers you have gained. So don't speak to me unless you know your information.
It's scary how perfectly accurate that is about the very person who spoke it.



Anyways, enough with the bashing.

I broke rule #2 for posting a 'full script' that could not possibly work?
lets review the script i posted


[start of script]
(serverside script showing thiso. vars inside a with)
//#CLIENTSIDE
(clientside script showing thiso.vars not crossing the clientside boundary)

//////////////

(a second serverside script showing how this. vars do not work through withs)
//#CLIENTSIDE
(clientside code showing that this. vars also do not cross the clientside boundary)
[end of script]


few problems with that one being a full script they can copy/paste into an editor:
* will not work at all. the script has no purpose and no way to link itself together
* there's actually two scripts in one! neither of which work

please, explain to me how that violates rule #2.
__________________

Last edited by calani; 08-27-2005 at 02:23 AM..
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 11:11 PM.


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