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 09-01-2006, 01:44 AM
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
Full list of GS2 events?

Is there a full list of events anywhere?

onWeaponFired()
onKeyPressed()
onTimeout()
etc.

Is there a complete list anywhere? I looked on the wiki but couldn't see one.

Thanks
Reply With Quote
  #2  
Old 09-02-2006, 09:37 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
Quote:
Originally Posted by JkWhoSaysNi
Is there a full list of events anywhere?

onWeaponFired()
onKeyPressed()
onTimeout()
etc.

Is there a complete list anywhere? I looked on the wiki but couldn't see one.

Thanks
No, there is not a full list. They are spread out around the Bible. If you look at an object in the Bible, it will list the events for that object.
__________________
Reply With Quote
  #3  
Old 09-03-2006, 08:37 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Your best bet it to parse an object for functions.

In TGraalVar
getfunctions() - returns object - gets the names of all functions of the object as array, also each entry has subvariables which give more information about the function ("parameters", "description", "scope")

PHP Code:
function onCreated()
{
  
temp.test level.getfunctions();
  echo(
temp.test);

This prints out a line of functions into RC chat. Best to make it pm the results to someone or pipe it to a debug window. Clientside it to get different results.

http://wiki.graal.us/Script_Functions:_NPC_Server
http://wiki.graal.us/Script_Functions:_Client
Nice list of functions. Use these while the Graal Bible is down.

The Graal Bible was down at the time of writing this. If you need more help just find me on Graal.

Last edited by Twinny; 09-03-2006 at 09:12 AM..
Reply With Quote
  #4  
Old 09-03-2006, 09:17 AM
googleman googleman is offline
Registered User
googleman's Avatar
Join Date: Dec 2003
Location: Seattle, WA
Posts: 96
googleman is on a distinguished road
Quote:
Originally Posted by cbkbud
No, there is not a full list. They are spread out around the Bible. If you look at an object in the Bible, it will list the events for that object.
So now you have an answer for why there are not many people who can code in GS2. Support (Wiki) is lousy.
Reply With Quote
  #5  
Old 09-03-2006, 09:38 AM
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
scriptlogfunctions-client? or whatever?
Reply With Quote
  #6  
Old 09-03-2006, 02:14 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by googleman
So now you have an answer for why there are not many people who can code in GS2. Support (Wiki) is lousy.
I beg to differ. The wiki is a good way to find what you need, if you know how to find it. If not, use the Search function that so many people never does.
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #7  
Old 09-03-2006, 04:10 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
The Wiki is actually very sensibly organised. Let me give you some examples of how you might search for things in the Wiki.

I'm working with a GuiTabCtrl, but I want to look up how to clear all of the tabs.
  • Open up the wiki (http://wiki.graal.net/Creation/Dev/GScript) and navigate to the clientside page, because I'm working clientside.
  • Now, a GuiTabCtrl is a class or object, so navigate to "Classes / Object Types".
  • I've got a tree of objects now, so find GuiTabCtrl and click it. I've now got a page up with all of the functions, variables and events related to the object.
  • Here I find the function I'm looking for: clearRows()

Now I've got my GuiTabCtrl working, I want to change some attributes about the control. For example, I want to change the size of it, but that attribute isn't listed under GuiTabCtrl.
  • The top of the page states that it inherits 'GuiControl', so everything that is available in GuiControl is available to my GuiTabCtrl. Click the 'GuiControl' link.
  • I look down the list of variables and see the 'extent' variable; that's the one I'm looking for.

Now finally, I want to edit the text of one of the tabs by making it lower case. I want to edit the variable MyTabs.rows[0].text.
  • Navigate back to http://wiki.graal.net/Creation/Dev/GScript and go back to the clientside functions.
  • I'm looking for functions regarding strings, so look under the '1.4 Functions' header in the navigation box.
  • Find '1.4.1.3 Strings' listed under Common. Perfect. A list of common string functions. Follow the link.
  • Listed there is just the function I'm looking for:
    PHP Code:
    lowercase(str text) - returns lowercased string 

That isn't difficult. For the object types, the available events are listed at the bottom of the page where available. It isn't difficult to find things.

If you are worried that you can't figure out the basic events (if (created) is now function onCreated()) then look at the old commands.rtf and just rewrite them in the function onEVENTNAME() format.

HTML Code:
Built-in Flags	     true when:
actionleftmouse		someone left-clicks on the npc
actionrightmouse		someone right-clicks the npc
actionmiddlemouse	someone middle-clicks the npc
actiondoublemouse	someone double-clicks the npc
actionprojectile		is triggered when a projectile lands on player/npc from the shoot command
canspin			the player has spin power (for sword)
carrying	      	      the player carries something
carriesblackstone	      the player carries a blackstone
carriesbush	      the player carries a bush
carriessign	      the player carries a sign
carriesstone	      the player carries a stone
carriesvase	      the player carries a vase
compsdead	      there is no living baddy
compusdied	      all baddies died
exploded		      the npc was exploded by a bomb
firedonhorse	      this npc weapon is fired while riding on horse
followsplayer	      the npc currently follows the player
hasweapon( name )	the player has the weapon specified with ‘name’
isleader		      the player entered the level first (of all players in the same room)
isonmap		      the player is on an outside level
issparringzone	      the player is in a sparring level
isweapon		      this npc is a weapon
keycode(character)		gets the keycode for a character
keypressed	occurs when a standard key is pressed, also triggers a parameter, #P(0) for the keycode, #P(1) for the character
keydown( key )	      the specified key is pressed (0..10: up,left,down,right,S,A,D,M,tab,Q,P)
keydown2(keycode,ignorecase)	checks if a key has been pressed, must be true if you want to turn off the check for alt/shift/ctrl
for keycode values, check at the end.
lighteffectsenabled	      the player can see light effects
leftmousebutton		the left-mouse button is clicked (in combination with mousedown)
middlemousebutton	the middle-mouse button is clicked (in combination with mousedown)
rightmousebutton		the right-mouse button is clicked (in combination with mousedown)
mousedown		a mouse button is clicked
mouseup			the mouse is released
mousewheel		when the mousewheel has been used
nopkzone	      the player is in a level where you can’t hurt other players
onmapx( level )	      x-position of the level on the current map
onmapy( level )	      y-position of the level on the current map
onwall( x, y )	      the specified field is blocked
onwater( x, y )	      the specified field is water
playeronline	      the game is in online mode
peltwithblackstone      the npc was pelt with a blackstone
peltwithbush	      the npc was pelt with a bush
peltwithnpc	      the npc was pelt with another npc
peltwithsign	      the npc was pelt with a sign
peltwithstone	      the npc was pelt with a stone
peltwithvase	      the npc was pelt with a vase
playerchats	      the player says something
playerdies	      the player died
playerendsreading	      the player finished reading
playerenters	      the layer enters the room
playerhurt	      the player has been hurt 
playerisfemale	      the player is female
playerismale	      the player is male (specified in headsconfig.txt)
playerlaysitem	      somebody layed an item
playeronhorse	      the player rides on a horse (or boat)
playerreading	      the player is reading a sign
playerswimming	      the player is swimming
playertouchsme	      the layer touchs the npc
playertouchsother	      the player touchs another npc
playerattached	      the player is attached to this npc
shotbybaddy	      the npc was shot by a computer opponent
shotbyplayer	      the npc was shot by the player
startswith( partstr, str )	str starts with partstr
strcontains( str, partstr )	str contains partstr
strequals( str1, str2 )	str1=str2 (both strings can contain message codes)
timeout		      the npc’s timeout counter runs to 0
visible		      the npc is visible
wa****		      the npc was slayed with a sword or axe
waspelt		      the npc was pelt
wasshot		      the npc was shot with arrows
wasthrown	      the npc was carried and then thrown
weaponfired	      this npc is used as weapon, ‘D’ (or joybutton1) is pressed
weaponsenabled	      the player weapons are enabled
Reply With Quote
  #8  
Old 09-05-2006, 01:31 AM
googleman googleman is offline
Registered User
googleman's Avatar
Join Date: Dec 2003
Location: Seattle, WA
Posts: 96
googleman is on a distinguished road
Sounds great. Now if I remember correctly, wasn't there a way to generate the functions using the client?
Reply With Quote
  #9  
Old 09-05-2006, 02:10 AM
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
Quote:
Originally Posted by googleman
Sounds great. Now if I remember correctly, wasn't there a way to generate the functions using the client?
Yes, I remember reading it on the wiki somewhere
__________________
Deep into the Darkness peering...
Reply With Quote
  #10  
Old 09-05-2006, 02:10 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
To "generate" the functions? you mean create new functions?
Reply With Quote
  #11  
Old 09-05-2006, 02:17 AM
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
Quote:
Originally Posted by Rapidwolve
To "generate" the functions? you mean create new functions?
There's a command/function that displays all GS2 functions in the RPG window or somethin.
__________________
Deep into the Darkness peering...
Reply With Quote
  #12  
Old 09-05-2006, 11:30 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Add -listscriptfunctions to a shortcut pointing to graal4.exe
For example

"CProgram Files\Graal\Graal4.exe" -listscriptfunctions

This would go in a shortcut for myself. It will generate a file in your graal directory called scriptfunctions_client.txt

http://wiki.graal.net/index.php/Crea...side_Functions
http://wiki.graal.net/index.php/Crea...ns:_NPC_Server
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 01:13 PM.


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