Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Full list of GS2 events? (https://forums.graalonline.com/forums/showthread.php?t=68482)

JkWhoSaysNi 09-01-2006 01:44 AM

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 :)

cbk1994 09-02-2006 09:37 PM

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.

Twinny 09-03-2006 08:37 AM

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.

googleman 09-03-2006 09:17 AM

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.

KuJi 09-03-2006 09:38 AM

scriptlogfunctions-client? or whatever?

xXziroXx 09-03-2006 02:14 PM

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.

Skyld 09-03-2006 04:10 PM

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


googleman 09-05-2006 01:31 AM

Sounds great. Now if I remember correctly, wasn't there a way to generate the functions using the client?

Angel_Light 09-05-2006 02:10 AM

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 >_<

Rapidwolve 09-05-2006 02:10 AM

To "generate" the functions? you mean create new functions?

Angel_Light 09-05-2006 02:17 AM

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.

Twinny 09-05-2006 11:30 AM

Add -listscriptfunctions to a shortcut pointing to graal4.exe
For example

"C:\Program 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


All times are GMT +2. The time now is 01:20 PM.

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