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 07-16-2006, 09:38 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Angry Stock System Help!

Guys, I really need some help. I made a stock system, with basic functions ... The problem is, it uses a GUI, and that's only clientside ... How can I tell the NPC that you chose the 'buy' option? I've tried several things, but I'm out of ideas. Thanks for any help!

Chris
Reply With Quote
  #2  
Old 07-16-2006, 10:07 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
Let's say you called the button 'buy'.

NPC Code:
function buy.onAction() { ... }


That will trigger when you click that button. If your question is how to get it to the serverside, use a triggeraction.

triggeraction(x, y, "action", "param", "param", "etc");
Reply With Quote
  #3  
Old 07-16-2006, 11:08 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
or use a triggeraction to add the weapon
__________________
Deep into the Darkness peering...
Reply With Quote
  #4  
Old 07-16-2006, 11:29 PM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
PHP Code:
new GuiButtonCtrl(MyGui_NameOfButton) {
  ...
}

MyGui_NameOfButton.onAction() {
  ...

That should do it. Look at what I did and you should be able to figure it out easily. Guis aren't hard at all.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
Reply With Quote
  #5  
Old 07-17-2006, 01:15 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by ForgottenLegacy
PHP Code:
new GuiButtonCtrl(MyGui_NameOfButton) {
  ...
}

MyGui_NameOfButton.onAction() {
  ...

That should do it. Look at what I did and you should be able to figure it out easily. Guis aren't hard at all.
I'm pretty sure his problem is that he doesn't know how to communicate with the server.

My suggestion is to follow Bl0nkt's advice and use a triggerfunction, however instead of triggeraction, you should use triggerserver ( syntax: triggerserver("gui", <weaponname>, <actionname>, <param1>, <param2>, ...) )
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #6  
Old 07-17-2006, 02:48 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Hello guys. Thanks for all the help. I really didn't expect to get so much help on this. Anyway, how do I talk to the client? I could add something in -System such as
PHP Code:
function onCreated() {
setTimer(0.05);
}
function 
onTimeOut() {
if (
client.stocksys != NULL) {
//blah blah blah, showing GUI ...
client.stocksys NULL;
}
//Other -System junk here
setTimer(0.05);
}
function 
button.onAction() {
//triggers here

and then from my NPC
PHP Code:
function onActionClick(account) {
with(account) {
client.stocksys = {itemnamepricestockweaponname};
}

and have it set it so it is NOT null so it knows to display the GUI from System, but is there a better way?

Thanks,
Chris
Reply With Quote
  #7  
Old 07-19-2006, 06:56 AM
ZeekTheMan2 ZeekTheMan2 is offline
Zeek Is The Man
ZeekTheMan2's Avatar
Join Date: Feb 2006
Location: Ohio
Posts: 12
ZeekTheMan2 is on a distinguished road
Send a message via AIM to ZeekTheMan2
Are you using a guiCTR or a custom image for it like

new GuiButtonCtrl(MyGui_NameOfButton) {
...
}


or a showimg script based on your mousex and mousey
Reply With Quote
  #8  
Old 07-19-2006, 12:43 PM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by cbkbud
Guys, I really need some help. I made a stock system, with basic functions ... The problem is, it uses a GUI, and that's only clientside ... How can I tell the NPC that you chose the 'buy' option? I've tried several things, but I'm out of ideas. Thanks for any help!

Chris
http://wiki.graal.net/index.php/Creation/Dev/GScript

^-- Good source of information
Reply With Quote
  #9  
Old 07-19-2006, 04:59 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Okay, thanks for all the help earlier, I managed to get it done.

Thanks guys.
__________________
Reply With Quote
  #10  
Old 07-19-2006, 07:46 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Quote:
Originally Posted by KuJi
If the wiki were really that helpful, why would we need these forums?
'Why don't you contribute to it, then?'
Because I'm lazy. And there are already enough half-wit scripters.


Personally, I just don't put GUI in local NPCs. I hate it.
If I need a GUI for something, I make a new system to handle whatever needs the GUI.
i.e. if I want a shopping GUI, I'll make a Shopping system to deal with it rather than having each shop NPC create a new GUI on it's own.
Reply With Quote
  #11  
Old 07-21-2006, 03:28 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Yen
Personally, I just don't put GUI in local NPCs. I hate it.
If I need a GUI for something, I make a new system to handle whatever needs the GUI.
i.e. if I want a shopping GUI, I'll make a Shopping system to deal with it rather than having each shop NPC create a new GUI on it's own.
That is good advice. NPCWs are called GuiScripts in the new engine for a reason.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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:06 AM.


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