Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #31  
Old 07-12-2006, 08:39 AM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm will become famous soon enough
A good clarification for the documentation too.
onCreated - serverside - [this is an example, please don't expect me to be right] called when the NPC is created by the NPCServer, typically when the level is first uploaded or when the NPCServer is restarted. In the case of Non Database NPCs (See Database NPCs, [and that would be a link]), this is also called when the level is updated.
- clientside - called when the NPC is first encountered by the player and thus 'created' locally. Also called when the level is updated. [maybe, depends on if people still use "update level" to restart the NPCs fresh, and if it works clientside, and if it works serverside, all three questions at once.]
onPlayerEnters - serverside - called whenever any player enters the level by any means - walking, warping, connecting, reconnecting, anything. Also checked when the NPCServer restarts or the level is updated, but only if there is a player still in the level (to the NPC, the player just "entered" - "enter" and "poof into existance" are synonimous)
onPlayerEnters - clientside - called whenever the player enters the level. For checking if another player entered their level, you'd need [link to functioncall here].
onHit - serverside - called whenever any damage is dealt to this NPC by any source...

I'm sure I'm beating a dead horse by this point, just speaking to hear myself talk - ye who write the documentation, you get what I'm sayin' right?
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #32  
Old 07-12-2006, 08:45 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Quote:
Originally Posted by Tyhm
ye who write the documentation, you get what I'm sayin' right?
You're one of them. If you arn't, you should be. Get to work wenchy!
Reply With Quote
  #33  
Old 07-12-2006, 11:00 AM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
onCreated() is pretty straight forward, though.. If you go into the level, the NPC is created clientside, when you change the script, it is created serverside.
__________________


[06:24:19] * Parts: Skyld ([email protected]/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #34  
Old 07-12-2006, 11:09 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
I dont think there's any documentation on the mudlib functions, only syntax.. Wouldn't mind some documentation on that
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #35  
Old 07-12-2006, 03:21 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
Quote:
Originally Posted by Raeiphon
I dont think there's any documentation on the mudlib functions, only syntax.. Wouldn't mind some documentation on that
Why would you care? It's not like you can play around with them.
Reply With Quote
  #36  
Old 07-12-2006, 09:50 PM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
Rwar we should be able to play around with them!
Reply With Quote
  #37  
Old 07-13-2006, 06:35 AM
upsilon upsilon is offline
Shmoo
upsilon's Avatar
Join Date: Dec 2005
Location: Birmingham, Alabama
Posts: 58
upsilon is on a distinguished road
since they seem crutial to getting any non-trivial chunk of work done in gscript, someone who understands them pretty thoroughly should start a page on the wiki exclusively for triggerserver triggerclient and triggeraction, and object.trigger. distinctions between them, non pseudo code examples without confusing or non-descript variable names for the parameter.. descriptions of each parameter, stuff like that.

I racked my brain the other day trying to figure out how to use them all, and they seem to have overlapping functionality, but totally differ in their usage. Ive manage to get a triggerserver working so far. I could help out on that part of the page

Reguardless of that though, i think they deserve special attention.
__________________
Health nuts are going to feel really stupid someday, lying in hospitals dying of nothing. - Redd Foxx
Reply With Quote
  #38  
Old 08-28-2006, 10:37 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
I think it would be nice if we had examples of each function. Kinda like php's documentation. All of the functions are listed but, useless mostly. changeimgpart(float,float,float,float,float); isn't useful without knowing what the params are supposed to be.

It'd be good if I could just type changeimgpart into the search box on wiki.graal.us and get an explanation of what it does and a couple of examples of how to use it.

I usually end up finding a function name in the wiki and then typing it into the forums search to get an example of usage.
Reply With Quote
  #39  
Old 08-28-2006, 11:28 PM
Skrobo2 Skrobo2 is offline
In the real world ogod.
Skrobo2's Avatar
Join Date: Dec 2005
Location: Refugio, Texas
Posts: 435
Skrobo2 is on a distinguished road
I still think someone should type up a GS2 equivalent of commands.rtf. And cover everything that can be done with Gscript, not just some of it. I find myself adding new things that I learn to my commands.rtf quite a bit. The wiki is nice, but I'd rather have a file to open, instead of having to go online.

And before someone quotes Okie again.

Quote:
Originally Posted by ApothiX
Run graal4 with the command line option "-listscriptfunctions" and open the file it generates.
I know I've said this before, and I know what he said. I did as he said and the list I got was not that helpfull. We need something that gives a short explanation like in commands.rtf.

Like this:

NPC Code:

// simple npc manipulation:
setimg("filename"); changes the npcís image
setimgpart("filename",x,y,width,height); changes the npcís image and only displays the rectangle (x,y,width,height) of it
hide(); hides the npc
show(); shows an hidden npc
dontblock(); lets the npc donít block the player anymore
drawoverplayer(); draws the npc over the player
drawunderplayer(); draws the npc under the player
drawaslight(); draws the npc above day/night
blockagain(); turns off the four previous flags
canbecarried(); the npc can now be lifted and carried by the player
cannotbecarried(); turns off the previous flag
canbepushed(); the npc can now be pushed by the player
cannotbepushed(); turns off the previous flag
canbepulled(); the npc can now be pulled by the player
cannotbepulled(); turns off the previous flag
cannotwarp(); disables link warping (dnpc) (server-side)
canwarp(); enables link warping (dnpc) (server-side)
canwarp2(); enables link warping for overworld links (dnpc) (server-side)
noplayeronwall(); players arenít counted as a wall in onwall() or onwall2()
timershow(); lets the npcís timeout be shown
showcharacter(); displays a player character instead of the npc image
throwcarry(); throws the carried object
*followplayer; Removed in GS2
hidelocal(); hides the npc (only for the current player)
showlocal(); shows an hidden npc (only for the current player)
dontblocklocal(); lets the npc donít block the player anymore (only for the current player)
blockagainlocal(); turns off the three block flags (only for the current player)
destroy(); deletes the npc
shootball(); shoots a ball directly to the player

__________________


Quote:
Originally Posted by Darlene159 View Post
I would rather have dead forums.

Last edited by Skrobo2; 08-29-2006 at 12:04 AM..
Reply With Quote
  #40  
Old 08-31-2006, 03:46 AM
_Z3phyr_ _Z3phyr_ is offline
Banned
Join Date: Sep 2003
Location: Louisiane
Posts: 390
_Z3phyr_ is an unknown quantity at this point
My mental version of commands.rtf is this:

- Same as GS1, but with () marks... and start off every code block by declaring a function.



---

But yeah though Skrobo, you keep doing what you're doing man with that commands.rtf and I, along with everyone else who is trying to teach themselves GS2 but has no one to teach them, will love you long time.
Reply With Quote
  #41  
Old 08-31-2006, 05:20 AM
Skrobo2 Skrobo2 is offline
In the real world ogod.
Skrobo2's Avatar
Join Date: Dec 2005
Location: Refugio, Texas
Posts: 435
Skrobo2 is on a distinguished road
Problem is, I don't know GS2 well, myself. It'd be nice if Skyld or someone could do this. Most of it is just syntaxing, but things have been removed and there are new additions to the scripting language such as GUI windows and particles.
__________________


Quote:
Originally Posted by Darlene159 View Post
I would rather have dead forums.
Reply With Quote
  #42  
Old 11-11-2006, 11:17 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm will become famous soon enough
- shoot real,real,real,real,real,real,string,string
Not only is this posted numerous times, only once does it list it as
shoot x,y,z,angle,zangle,power,ani,aniparams;
which STILL omits the most useful bit of information from the original documentation:
angle is in radians, and what number you set Power to to make it a classic-style goes-until-it-hits-a-wall projectile.
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote
  #43  
Old 11-13-2006, 09:32 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Function prototypes are not documentation by any means.
Reply With Quote
  #44  
Old 11-13-2006, 11:33 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm will become famous soon enough
http://wiki.graal.net/index.php/Crea...ev/Old_GScript

Well, I mean, we got stuff like
NPC Code:

move dx,dy,time,options; moves the npc, options: cachtype(0,1,2) +
blockcheck(4) + eventwhendone(8) +
applydir(16)


...so I can figure out dx, dy is going to be something like -8, 0 for Move 8 tiles left, and time's probably going to be in seconds, so if you say 1 it'll move those 8 tiles in one second...
So what's cachtype 0,1,and 2? I imagine it's standard-issue binary, 0 means no cachtype, 1 means cachtype 1, 2 means cachtype 2, 3 means both 1 and 2...but what do they DO in vague terms?
Blockcheck 4, I imagine it detects blocking tiles - does it detect water? Chairs? Beds? Lava? Shallows?
Eventwhendone, I remember this being terrifically useful - but what event did it call? With what parameters/arguments?
Applydir? Will that turn the NPC automatically?
I'll grant, I could do some of this legwork myself, but EventWhenDone, that's infinite possible event-calls to detect for...

-5 minutes later-
It's a good thing I keep everything.

From NewFeatures2001.txt:
Quote:
Originally Posted by Admins
There are also nice options to makes things very simple:
- cachingmode:
- 0: previous movements will be finished immediatelly
- 1: movements will be cached, the previous movements
will only be finished when the cache is too large
(distance to go >5);
this caching can be used on server-side npcs to
make the movement look like non-laggy even when
there are little delays sometimes
- 2: the movement will just be appended to the movement
list; you can add up to 100 movements
- blockcheck: add 4 to the options when you want the
npc to stop when there is a wall blocking the npc
- informmewhendone: if you add 8 to the options then the
script will be called with a 'movementfinished' flag
when the the npc has stopped walking; catch this event
with
if (movementfinished) {...}
if you want to do something when the npc has stopped
(e.g. walking in a different direction)
- applydirection: add 16 to the options if you want the
game to automatically set the direction of the npc
depending on the movement direction (can be good
when using movement caching)
I wonder if I have access to add the old NewFeatures to the Wiki myself...
Nope, sure don't. Oh well.
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233

Last edited by Tyhm; 11-14-2006 at 03:19 AM.. Reason: nevermind, I'm dumb
Reply With Quote
  #45  
Old 11-14-2006, 12:38 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by Tyhm View Post
I wonder if I have access to add the old NewFeatures to the Wiki myself...
Nope, sure don't. Oh well.
You do, login to the Bible with your Graal account information and you can add a new page or edit an already existing one.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:38 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.