### Script Reference |
|  | ###### Script Editor Script Reference |  |
| ### Script Reference ### ### Especial Actors ##### collide: The collision actor if Event Actor is in a collision event. (Name in actions: "Collide Actor") ##### parent: Event Actor's parent, if exists. (Name in actions: "Parent Actor") ##### creator: Event Actor's creator, if Event Actor has been created in some "Create Actor" action. (Name in actions: "Creator Actor") ### Variables ##### x: x is the Actor's horizontal coordinate. The x position is relative to the parent. If the actor has no parent, the x coordinate will be relative to the game. ##### Script Editor Syntax: In current actor: ##### x=x+5; ##### or ##### x += 5; ##### In other actor: ##### MyActor.x += 5; ##### y: y is the Actor's vertical coordinate. The y position is relative to the parent. If the actor has no parent, the y coordinate will be relative to the game. ##### Script Editor Syntax: On Key Down Event y=y+5; ##### or ##### y += 5; ##### xprevious: The Actor's previous x position in the last frame. This variable is read only. yprevious: The Actor's previous y position in the last frame. This variable is read only. xscreen: The Actor's horizontal screen position in screen coordinates. yscreen: The Actor's vertical screen position in screen coordinates. xvelocity: The Actor's x velocity in pixels / frame. yvelocity: The Actor's y velocity in pixels / frame. angle: Move the Actor's angle (0 to 360, from the positive x axis, counterclockwise, in degrees). directional_velocity: The Actor's velocity in pixels / frame, in angle direction (set this Actor variable only when it is used with angle) r: red color (0 - 255) g: green color (0 - 255) b : blue color (0 - 255) transp: The Actor's transparency setting (0.0 - 1.0). animpos: The actual animation frame. Animpos will change the frame of your current animation only. To change animation without reseting current frame, use the "No change" option in Change Animation action (NO_CHANGE in the script). animindex: Use animindex(count from 0) to find the actual animation of your actor. Each animation that an actor has has a unique index assigned to it. ( This way you can tell which animation is currently running. ) ##### If your actor has 3 animations, then: ##### The first animation has animindex = 0 The second animation has animindex = 1 The third animation has animindex = 2 ##### This variable is read only. ##### nframes: The number of frames in the current animation. This variable is read only. width: The actual animation width. This variable is read only. height:The actual animation height. This variable is read only. textNumber: If the Actor displays text, you can set the text number here. ##### Script Editor Syntax: MyActor.textNumber=5; ##### text: If the Actor displays text, you set the text string using: ##### Script Editor Syntax: strcpy (MyActor.text,"Hello World"); ##### The max length of text is 255 characters. ##### name: The Actor's name. This variable is read only. clonename: The Actor clone name (Composed of the original Actor's name followed by the clone number index). This variable is read only. ##### cloneindex: The Actor clone's index (always start counting from 0). If 2 clones have been created, index will be myclone.0, myclone.1, ... This variable is read only. ##### frame: Game frame count. This variable is global and read only. ##### musicvol: Music volume (0.0 - 1.0 Loudest). This variable is global. ##### Script Editor Syntax: ##### musicvol=.7; ##### real_fps: Real game frame rate (frames per second). This variable is global and read only. ##### xmouse: Mouse's x (horizontal) screen position (screen coordinates). This variable is global and read only. Script Editor Syntax: ##### xscreen = xmouse; ##### ymouse: Mouse's y (vertical) screen position (screen coordinates). This variable is global and read only. Script Editor Syntax: ##### yscreen = ymouse; ##### ---User Vars--- Variables that have been defined by the user will be shown in this area of the variables/functions selector box. ##### MyVariable1 MyVariable2 MyVariable3 ... ### Actions ##### ChangeAnimation: Change animation and set initial state (FORWARD, BACKWARD, STOPPED, NO_CHANGE). Return 1 if success, 0 on error. int ChangeAnimation(char *actorName, char *animationName, int state) ##### animationName: animation valid for actorName. Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: ChangeAnimaton("Event Actor","Animation_1",BACKWARD); ##### ChangeAnimationDirection: Change animation state (FORWARD, BACKWARD, STOPPED). Return 1 if success, 0 on error. int ChangeAnimationDirection(char *actorName, int state) ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: ChangeAnimatonDirection("Ball", FORWARD); ##### ChangeCursor: Change Actor cursor. int ChangeCursor(char *actorName, char *imgName, int nFramesH, int nFramesV, int hotSpotX, int hotSpotY) imgName: image file path relative to game directory. nFramesH: number of horizontal frames. nFramesV: number of vertical frames. hotSpotX: cursor x hot spot. hotSpotY: cursor y hot spot. Return 1 if success, 0 on error. ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - Any Actor in game. ##### Script Editor Syntax: ChangeCursor("Event Actor", "Ball.png", 1, 1, 0, 0); ##### ChangeParent: Change an Actor's parent. ##### int ChangeParent(char *actorName, char *parentName) parentName: any Actor name (including "Event Actor", "Collide Actor", "Parent Actor", "Creator Actor" and "no parent"). Return 1 if successful, 0 on error. ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: ChangeParent("MyActor", "Event Actor"); ##### ChangePath: Change Actor path and set axis (X_AXIS, Y_AXIS, BOTH_AXIS). int ChangePath(char *actorName, char *pathName, int axis) pathName: any path name (including "no path" and "random path"). Return 1 if success, 0 on error. ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: ChangePath("MyActor", "path1", BOTH_AXIS); ##### ChangeTransparency: Change Actor transparency (0.0 - opaque, to 1.0 - transparent). Return 1 if success, 0 on error. ##### int ChangeTransparency(char *actorName, double transp) ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: ChangeTransparency("Event Actor", 0.64); ##### ChangeZDepth: Change an Actor's z depth. ##### int ChangeZDepth(char *actorName, double zdepth) zdepth: 0.0 to 1.0 Return 1 if success, 0 on error. ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: ChangeZDepth("My Actor", 0.70); ##### CollisionState: Enable or disable collision. Return 1 if success, 0 on error. ##### int CollisionState(char *actorName, int state) ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### state: ENABLE or DISABLE ##### Script Editor Syntax: CollisionState("Event Actor", DISABLE); ##### CreateActor: Creates a new Actor via script. ##### Actor* CreateActor(char *creatorName, char *animationName, char *parentName, char *pathName, int xpos, int ypos, int absolutePosition) creatorName: any legal Actor name. animationName: the animation valid for the Actor Name or "no animation". parentName: any Actor name (including"Event Actor", "Collide Actor", "Parent Actor", "Creator Actor" and "no parent"). pathName: any path name (including "no path" and "random path"). x,y: the new Actor's initial position. absolutePosition: true or false. Return Actor if success, invalid Actor (with cloneindex = -1 and name = "") on error. ##### Script Editor Syntax: CreateActor("GamePaddle", "Paddle_Animation", "no parent", "no path", 0, 0, false); ##### CreateTimer: Create a new timer. Return 1 if success, 0 on error. ##### int CreateTimer(char *actorName, char *timerName, int milliseconds) ##### timerName: the new timer's name. (The timerName must be defined in Create new timer panel) milliseconds: new timer tempo. Actor name: - "Event Actor": The Actor that is receiving the current event. - "Parent Actor": If one exists, this signifies the name of the Event Actor's parent. - "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator. - "Collide Actor": The Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: CreateTimer("Event Actor", "MyTimer", 2000) ##### DestroyActor: Destroy an Actor in the game. ##### int DestroyActor(char *actorName) Return 1 if success, 0 on error ##### Actor name: - "Event Actor": The Actor that is receiving the current event. - "Parent Actor": If it exists, this signifies the Event Actor's parent. - "Creator Actor": If Event Actor has been created in some "Create Actor" action, this signifies name of the Event Actor's creator . - "Collide Actor": The Actor that collided with the Event Actor. - Any Actor in the game. Script Editor Syntax: DestroyActor("Ball.2"); //To destroy the Ball.2 actor DestroyActor("Ball"); //To destroy all ball actors DestroyTimer: Destroy the named timer. Must be called in the actor that have an active timer. ##### int DestroyTimer(char *timerName) Return 1 if success, 0 on error. ##### timerName: timer name Script Editor Syntax: DestroyTimer("MyTimer"); EventDisable: Disable an Actor Event: ##### int EventDisable(char *actorName, unsigned long event) Return 1 if success, 0 on error. ##### The following Events can be disabled using EventDisable: EVENTMOUSEBUTTONDOWN EVENTMOUSEBUTTONUP EVENTMOUSEENTER EVENTMOUSELEAVE EVENTANIMATION EVENTANIMATIONFINISH EVENTPATHFINISH EVENTMOVEFINISH EVENTKEYDOWN EVENTKEYUP EVENTTIMER EVENTCOLLISION EVENTCOLLISIONFINISH EVENTCREATE EVENTDESTROYACTOR EVENTOUTOFVISION EVENTACTIVATIONEVENT EVENTALL ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": If it exists, this signifies the Event Actor's parent. - "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator. - "Collide Actor": The Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: EventDisable("Event Actor", EVENTMOUSEBUTTONDOWN); ##### EventEnable: Enable an Actor Event. ##### int EventEnable(char *actorName, unsigned long event) ##### The following Events can be enabled using EventEnable: EVENTMOUSEBUTTONDOWN EVENTMOUSEBUTTONUP EVENTMOUSEENTER EVENTMOUSELEAVE EVENTANIMATION EVENTANIMATIONFINISH EVENTPATHFINISH EVENTMOVEFINISH EVENTKEYDOWN EVENTKEYUP EVENTTIMER EVENTCOLLISION EVENTCOLLISIONFINISH EVENTCREATE EVENTDESTROYACTOR EVENTOUTOFVISION EVENTACTIVATIONEVENT EVENTALL Return 1 if success, 0 on error ##### Actor name: - "Event Actor": The Actor that is receiving the current event. - "Parent Actor": If it exists, this signifies the Event Actor's parent. - "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator. - "Collide Actor": The Actor that collided with the Event Actor. - Any Actor in game. ##### Script Editor Syntax: EventEnable("Event Actor", EVENTMOUSEBUTTONDOWN); ##### FollowMouse: Makes an Actor follow the mouse axis (X_AXIS, Y_AXIS, BOTH_AXIS, NONE_AXIS). ##### int FollowMouse(char *actorName, int axis) Return 1 if success, 0 on error. ##### Actor name: - "Event Actor": The Actor that is receiving the current event. - "Parent Actor": If it exists, this signifies the Event Actor's parent. - "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator. - "Collide Actor": The Actor that collided with the Event Actor. - Any Actor in game. ##### Script Editor Syntax: FollowMouse("GamePaddle", X_AXIS); ##### getAccelerometer: Get the value from the accelerometer (on the desktop get the joystick axis values). ##### Vector getAccelerometer() The Vector is a struct with the follow members: x: -1.0 to 1.0 y: -1.0 to 1.0 z: -1.0 to 1.0 ##### Script Editor Syntax: Vector v = getAccelerometer(); x = v.x; ##### MoveTo: Move an Actor to a specified position at specified velocity (speed). ##### int MoveTo(char *actorName, double x, double y, double velocity, char *relativeActor, char *avoidActor) Return 1 if success, 0 on error Actor name: - "Event Actor": The Actor that is receiving the current event. - "Parent Actor": If it exists, this signifies the Event Actor's parent. - "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator. - "Collide Actor": The Actor that collided with the Event Actor. - Any Actor in game. x, y: position to move relative to relativeActor. relativeActor: The Actor can be moved relative to the game center (absolute coordinate), relative to mouse or any Actor in the game. Valid values: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - "Mouse Position": Move the actor relative to current mouse position - "Game Center": Move the actor relative to game coordinates - Any Actor in game avoidActor: - "Event Actor": The Actor that is receiving the current event. - "Parent Actor": If it exists, this signifies the Event Actor's parent. - "Creator Actor": If the Event Actor has been created in some "Create Actor" action, this signifies the Event Actor's creator. - "Collide Actor": The Actor that collided with the Event Actor. - Any Actor in game. Example: 1) Move the Event Actor to right 10 positions (x = x + 10): MoveTo("Collide Actor", 10, 0, 1000, "Event Actor", ""); (use high velocity for an instantaneous move) 2) Move the view to player position (view.x = player.x; view.y = player.y;): MoveTo("view", 0, 0, 1, "player", ""); 3) Move the player to mouse position: MoveTo("player", 0, 0, 1, "Mouse Position", ""); 4) Move the player to mouse position, avoind the lakes in a terrain: MoveTo("player", 0, 0, 1, "Mouse Position", "lake"); ##### PhysicalResponse: Do a physical bounce movement between Actors in a collision. int PhysicalResponse(int moveType, int massType, double massEventActor, double massCollideActor, double eventVelocityMultiplier, double collideVelocityMultiplier) Return 1 if success, 0 on error . ##### -moveType: MOVE_EVENT_ACTOR_ONLY, MOVE_COLLIDE_ACTOR_ONLY, MOVE_BOTH_ACTORS -massType: USE_CALCULATED_MASS, USE_SPECIFIED_MASS -massEventActor, massCollideActor: When massType = USE_CALCULATED_MASS, use this variable to define how to calculate the mass multiplier. When massType = USE_SPECIFIED_MASS, use this variable to define how to calculate the mass. (Values must be > 0.0) eventVelocityMultiplier, collideVelocityMultiplier: final velocity multiplier ##### Script Editor Syntax: PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 1.000000, 1.000000); ##### PlayMusic: Play a music file. ##### int PlayMusic(char *soundPath, double volume, int loop) -soundPath: relative to game directory. -volume: 0.0 to 1.0. -loop: loop count (1 to 65000 or 0 to infinite loop) Return the channel 1 if success, 0 on error. ##### Script Editor Syntax: PlayMusic("data/MyMusic.wav", 1.0, 1); ##### PlayMusic2: Play a music file with the ability to define the music priority. ##### int PlayMusic2(char *soundPath, double volume, int loop, int priority) -soundPath: relative to game directory. -volume: 0.0 to 1.0. -loop: loop count (1 to 65000 or 0 to infinite loop) -priority: HIGH_PRIORITY_MUSIC, MEDIUM_PRIORITY_MUSIC or LOW_PRIORITY_MUSIC Return the channel 1 if success, 0 on error. ##### Script Editor Syntax: PlayMusic2("C:\\WINDOWS\\Media\\MyMusic2.wav", 1.000000, 1, HIGH_PRIORITY_MUSIC); ##### PlaySound: Play a sound file. ##### int PlaySound(char *soundPath, double volume, int loop) -soundPath: relative to game directory. -volume: 0.0 to 1.0. -loop: loop count (1 to 65000 or 0 to infinite loop) Return the allocated channel if success, 0 on error ##### Script Editor Syntax: PlaySound("data/tada.wav", 1.000000, 3); ##### PlaySound2: Play a sound file with the ability to double pan. ##### int PlaySound2(char *soundPath, double volume, int loop, double pan) -soundPath: relative to game directory. -volume: 0.0 to 1.0 -pan: -1.0 (full left) to 1.0 (full right) -loop: loop count (1 to 65000 or 0 to infinite loop) Return the allocated channel if success, 0 on error. ##### Script Editor Syntax: P laySound2("data/tada.wav", 1.000000, 1, 0.000000); ##### ToAnteriorPosition: Send an Actor to a defined position in the anterior frame. ##### int ToAnteriorPosition(char *actorName) Return 1 if success, 0 on error. ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game ##### Script Editor Syntax: ToAnteriorPosition("Event Actor"); ##### VisibilityState: ##### int VisibilityState(char *actorName, int state) ##### state: ENABLE, DISABLE and DONT_DRAW_ONLY (Don't draw, but allow events) Return 1 if success, 0 on error. ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: VisibilityState("GameGhost", ENABLE); ### Drawing Functions ### Drawing Functions must be used into actions of a canvas Actor. The (x, y) coordinates are relative to the Actor's upper left corner. ##### draw_from: Draw the current image of an actor into a canvas actor (doesn't works with tile or text actors) ##### void draw_from(const char *actorname, int x, int y, double scale) ##### actorname: The name of the actor who?s current frame is to be drawn on the canvas actor. x: The x location to draw the image. y: The y location to draw the image. scale: The size to draw the image (greater than 0.0) ##### Script Editor Syntax: draw_from("player", 0, 1, 1.0); ##### setpen: Define the actual pen for the Event Actor ##### void setpen(int r, int g, int b, double transp, int pensize) ##### r: red component (0 - 255) g: green component (0 - 255) b: blue component (0 - 255) transparency: (0.0 - 1.0) pensize: size of pen ##### Script Editor Syntax: setpen(0, 255, 0, 0.0, 3); //set pen color to green, no transparency, pensize 3 ##### moveto: Move the Event Actor's pen to (x, y) coordinates. ##### void moveto(int x, int y) ##### Script Editor Syntax/Example: screen_to_actor(&xmouse,&ymouse) //get mouse coordinates moveto(xmouse,ymouse); //move pen to mouse coordinates ##### lineto: Draw a line on Event Actor to (x, y) coordinates using actual pen void lineto(int x, int y) ##### Script Editor Syntax: setpen(255,255,255,0,3); lineto (50,50); ##### Example: if (draw == 1) { screen_to_actor(&xmouse, &ymouse); //mouse coordinates from screen to actor coordinates lineto(xmouse, ymouse); //draw a line to the mouse coordinates } ##### putpixel: Draw a single pixel on Event Actor in (x, y) coordinates using actual pen. ##### void putpixel(int x, int y) ##### Script Editor Syntax: putpixel(0, 0); ##### erase: E rase all Actors with a specified color. ##### void erase(int r, int g, int b, double transp) ##### -r: red component (0 - 255) -g: green component (0 - 255) -b: blue component (0 - 255) -transparency: (0.0 - 1.0) ##### Script Editor Syntax: erase(0, 0, 0, .5); ##### screen_to_actor: Convert from screen coordinates to Actor coordinates (Use screen_to_actor(&xmouse, &ymouse); to convert the mouse coordinates to the current actor coordinates. For Example, this function could be used to draw at the correct spot on a canvas actor. ) ##### void screen_to_actor(int *x, int *y) ##### Script Editor Syntax: screen_to_actor(&xmouse, &ymouse); //convert the mouse coordinates to the current actor coordinates. ##### actor_to_screen: Convert from Actor coordinates to screen coordinates void actor_to_screen(int *x, int *y) ##### Script Editor Syntax: actor_to_screen(&xmouse, &ymouse); //convert from Actor(in this case the mouse)coordinates to screen coordinates. ##### savecanvas: Save the canvas Actor state in memory. void savecanvas() ##### Script Editor Syntax: savecanvas(); ##### restorecanvas: Restores the canvas Actor from the memory. ##### void restorecanvas() ##### Script Editor Syntax: restorecanvas(); ### Sound functions ### Sound functions use the channel returned by PlayMusic, PlayMusic2, PlaySound, PlaySound2. ##### setPan: Set the pan of sounds (Doesn't work with music). channel: use 0 to affect all sound channels, except the music. pan: -1.0 (full left) to 1.0 (full right) ##### void setPan(int channel, double pan) ##### Script Editor Syntax: setPan(channel, -1); ##### setVolume: Set the sound or the music volume channel: use 0 to affect all sound channels, except the music. volume: 0.0 to 1.0 ##### void setVolume(int channel, double volume) ##### Script Editor Syntax: setVolume(channel, .5); ##### stopSound: Stop the sound or music played on the specified channel. channel: use 0 to stop all sounds, except the music. ##### void stopSound(int channel) ##### Script Editor Syntax: stopSound(channel); ##### ### Save functions ### Use saveVars and loadVars to save and load any variables in a game, like highscores, current lives, etc. To use these functions, you must use the "Save group" field in the "Add New Variable" panel (Variable button in the Script Editor). ##### saveVars: Save all variables in the group to the specified file. The file will be saved in the game directory. void saveVars(char *file, char *group) ##### Use saveVars to save any variables in a game; highscores, current lives, etc. You must use the "Save group" field in the "Add New Variable"panel (Variable button in the Script Editor). ##### Script Editor Syntax: saveVars("game.sav", "High Score"); ##### loadVars: Load all the variables in the group from a specified file. void loadVars(char *file, char *group) ##### Script Editor Syntax: loadVars("game.sav", "High Score"); Example: 1. Create a "score" variable and put it in the "High Score" group. 2. Create two more variables: "lives" and "energy". Put these variables in the "Actor State" group. When the player dies, use saveVars("game.sav", "High Score"); to save the current player's high score without saving the player's state. When the user exits the game, use saveVars("game.sav", "Actor State"); to save the current player's state (lives and energy). Note: different variable groups can be saved in the same file (game.sav). Finally, use loadVars("game.sav", "High Score"); and loadVars("game.sav", "Actor State"); in the proper script editor area of the game! ### Game Control ##### LoadGame: Loads a new game. ##### int LoadGame(char *gamePath) gamePath: game file path relative to actual game directory. Return 1 if success, 0 on error. ##### Script Editor Syntax: LoadGame("Level1.ged"); In the Script Editor, Level1.ged will be loaded. In your executable game, Level1.exe or Level1.dat will be loaded. ##### ExitGame: End game and return to system. ##### int ExitGame() Return 1 if success, 0 on error. ##### Script Editor Syntax: ExitGame(); ##### SuspendGame: Pause the game and stop receiving any events. ##### void SuspendGame() ##### Script Editor Syntax: ##### SuspendGame(); ##### Shows the task bar on the Pocket PC. Continue the game only if the game gets the focus (when the user clicks on game title bar window or uses Alt+Tab or if user click on [Continue] option on Pocket PC, Handheld PC and Smartphone). ##### PauseGameOff: Continue a game that has been paused by PauseGameOn() function. See Example below under PauseGameOn. ##### void PauseGameOff() ##### Script Editor Syntax/ Example Code: 1) When the user wants to pause a game, Create your "pauseActor": "Paused - Click To Resume". ##### 2) On the Create Actor Event of "pauseActor" add a Script Editor Action with the following code: ##### PauseGameOn(); ##### 3) On Mouse Button Down event, add a Script Editor action with the following code: ##### PauseGameOff(); DestroyActor("Event Actor"); ##### PauseGameOn: Pause the game but continue receiving keyboard and mouse events. This is done so, you can call PauseGameOff() in a keyboard or mouse event. ##### void PauseGameOn() ##### Script Editor Syntax: ##### PauseGameOn(); ### Keyboard Functions ##### getKeyText: Returns the key description char *getKeyText(int key) ##### Script Editor Syntax: int keyCode = getLastKey(); //get the last key pressed. strcpy(myactor.text, getKeyText(keyCode)); //get the key text (getKeyText) and copy it (strcpy) to myactor. ##### getLastKey: Returns the last pressed key. int getLastKey() ##### Script Editor Syntax: int selectedKey = getLastKey(); //"selectedKey" is the variable used to store the last key pressed using the getLastKey() function. Any variable name could be used. ##### Note: The getLastKet() function will return the last pressed key after redirection. So, if the user press the 'T' key and you are remaped the 'T' to 'right' key previously, the getLastKey() will return the 'right' key. To avoid this behavior, in this example, you need remove the redirection by using: ##### remapKey(KEY_t, KEY_t); ##### remapKey: Redirect fromKey to toKey (User configured keys). Use this function to redirect any keys. ##### void remapKey(int fromKey, int toKey) All redirections are removed using LoadGame() ##### Script Editor Syntax: For Example: A game actor shoots with KEY_RCTRL. If you want your user to be able to change this control key in the game configuration screen, you use a KeyDown event, and put the following into the script editor: ##### remapKey(getLastKey(), KEY_RCTRL); //KEY_RCTRL is the the key to remap. Now, the key pressed by user, will be redirected to KEY_CTRL. The remapKey() function allows you to keep your original default game key. ##### GetKeyState: Returns an array with the keyboard state. ##### char *GetKeyState() ##### Script Editor Syntax: char *key = GetKeyState(); // "key" is the variable used to store GetKeyState() function. Any variable name could be used. ##### Example: When the left or right key is pressed in the "Draw Actor" Event, the following code will move an Actor to the left or to the right. 1) Create an actor 2) Add a "Draw actor" event 3) Add Script code Code: char *key = GetKeyState(); //Get entire keyboard state if(key[KEY_RIGHT] == 1) //Test if right key is pressed { x = x + 5; //Move actor to right } if(key[KEY_LEFT] == 1) //Test if left key is pressed { x = x - 5; //Move actor to left } ##### Valid key entries: ##### KEY_BACKSPACE KEY_TAB KEY_CLEAR KEY_RETURN KEY_PAUSE KEY_ESCAPE KEY_SPACE KEY_EXCLAIM KEY_QUOTEDBL KEY_HASH KEY_DOLLAR KEY_AMPERSAND KEY_QUOTE KEY_LEFTPAREN KEY_RIGHTPAREN KEY_ASTERISK KEY_PLUS KEY_COMMA KEY_MINUS KEY_PERIOD KEY_SLASH KEY_0 KEY_1 KEY_2 KEY_3 KEY_4 KEY_5 KEY_6 KEY_7 KEY_8 KEY_9 KEY_COLON KEY_SEMICOLON KEY_LESS KEY_EQUALS KEY_GREATER KEY_QUESTION KEY_AT KEY_LEFTBRACKET KEY_BACKSLASH KEY_RIGHTBRACKET KEY_CARET KEY_UNDERSCORE KEY_BACKQUOTE KEY_a KEY_b KEY_c KEY_d KEY_e KEY_f KEY_g KEY_h KEY_i KEY_j KEY_k KEY_l KEY_m KEY_n KEY_o KEY_p KEY_q KEY_r KEY_s KEY_t KEY_u KEY_v KEY_w KEY_x KEY_y KEY_z KEY_PAD_0 KEY_PAD_1 KEY_PAD_2 KEY_PAD_3 KEY_PAD_4 KEY_PAD_5 KEY_PAD_6 KEY_PAD_7 KEY_PAD_8 KEY_PAD_9 KEY_PAD_PERIOD KEY_PAD_DIVIDE KEY_PAD_MULTIPLY KEY_PAD_MINUS KEY_PAD_PLUS KEY_PAD_ENTER KEY_PAD_EQUALS KEY_UP KEY_DOWN KEY_RIGHT KEY_LEFT KEY_INSERT KEY_HOME KEY_END KEY_PAGEUP KEY_PAGEDOWN KEY_F1 KEY_F2 KEY_F3 KEY_F4 KEY_F5 KEY_F6 KEY_F7 KEY_F8 KEY_F9 KEY_F10 KEY_F11 KEY_F12 KEY_F13 KEY_F14 KEY_F15 KEY_NUMLOCK KEY_CAPSLOCK KEY_SCROLLOCK KEY_RSHIFT KEY_LSHIFT KEY_RCTRL KEY_LCTRL KEY_RALT KEY_LALT KEY_RMETA KEY_LMETA KEY_LWINDOWS KEY_RWINDOWS KEY_ALT_GR KEY_HELP KEY_PRINT KEY_SYSREQ KEY_BREAK KEY_MENU KEY_MAC_POWER KEY_EURO KEY_POCKET_UP KEY_POCKET_DOWN KEY_POCKET_LEFT KEY_POCKET_RIGHT KEY_POCKET_A KEY_POCKET_B KEY_POCKET_C KEY_POCKET_START KEY_POCKET_AUX1 KEY_POCKET_AUX2 KEY_POCKET_AUX3 KEY_POCKET_AUX4 KEY_POCKET_AUX5 KEY_POCKET_AUX6 KEY_POCKET_AUX7 KEY_POCKET_AUX8 KEY_GP2X_BUTTON_UP KEY_GP2X_BUTTON_DOWN KEY_GP2X_BUTTON_LEFT KEY_GP2X_BUTTON_RIGHT KEY_GP2X_BUTTON_UPLEFT KEY_GP2X_BUTTON_UPRIGHT KEY_GP2X_BUTTON_DOWNLEFT KEY_GP2X_BUTTON_DOWNRIGHT KEY_GP2X_BUTTON_CLICK KEY_GP2X_BUTTON_A KEY_GP2X_BUTTON_B KEY_GP2X_BUTTON_X KEY_GP2X_BUTTON_Y KEY_GP2X_BUTTON_L KEY_GP2X_BUTTON_R KEY_GP2X_BUTTON_START KEY_GP2X_BUTTON_SELECT KEY_GP2X_BUTTON_VOLUP KEY_GP2X_BUTTON_VOLDOWN ### Helper functions ##### ActorCount: Returns the number of Actors with the Actor Name. ##### Actor name: - Any Actor in game. ##### Script Editor Syntax: ( ActorCount("metalBlock1") == 1)\\total number of actors currently active ==1. Load the breakout demo and go to the DestroyActor event of metalBlock1 actor to see this function in action. ##### CollisionFree: Check if position (x, y) is collision free for ActorName. Return 1 if not collide, 0 otherwise. ##### int CollisionFree(char *actorName, int x, int y) ##### Actor name: - "Event Actor": Actor that is receiving the current event. - "Parent Actor": Event Actor's parent, if exists. - "Creator Actor": Event Actor's creator, if Event Actor has been created in some "Create Actor" action. - "Collide Actor": Actor that collided with the event Actor. - Any Actor in game. ##### Script Editor Syntax: if (CollisionFree("Event Actor", x, y+5)) y=y+5; //On KeyDown Event script for KEY_DOWN, check if there is no collision before moving an actor down by 5 pixels. ##### SendActivationEvent: Send an Activation Event to an Actor's clone. ##### ##### int SendActivationEvent(char *cloneName) Return 1 if success, 0 on error. ##### cloneName: nameactor.cloneindex (Ex.: ship.1, ship.2, ...) SendActivationEvent("ship.1"); //send ActivationEvent to the ship clone with the index number 1. ##### radtodeg: Convert an angle from radians to degrees. double radtodeg(double a) ##### degtorad: C onvert an angle from degrees to radians. double degtorad(double a) ##### Script Editor Syntax: myactor.textNumber= degtorad(angle); ##### direction: R returns the direction between points (x1, y1) and (x2, y2) (in degrees, 0 to 360, from positive x axis, counterclockwise, in degrees). double direction(double x1, double y1, double x2, double y2) ##### Script Editor Syntax: textNumber= direction(x, y, player.x, player.y); ##### distance: Returns the distance between points (x1, y1) and (x2, y2). double distance(double x1, double y1, double x2, double y2) ##### Script Editor Syntax: textNumber= distance(x, y, player.x, player.y); ##### getAllActorsInCollision: R eturns an Actor's array that includes all Actors that collide with the cloneName if successful or NULL if there are no collisions. Actor count will be returned in nActors. ##### Actor *getAllActorsInCollision(char *cloneName, int *nActors) cloneName: nameactor.cloneindex (Ex.: ship.1, ship.2, ...), "Event Actor", "Collide Actor", "Parent Actor" or "Creator Actor" ##### The returned array will be valid until the next call to getAllActorsInCollision. The returned array is read only. ##### Script Editor Syntax: getAllActorsInCollision("Event Actor",&num); For Example, to make the "Event Actor" the parent of all the colliding actors: int n; Actor *actors; actors = getAllActorsInCollision("Event Actor", &n); if(actors) { int i; for(i = 0; i < n; i++) { ChangeParent(actors[i].clonename, "Event Actor"); } } ##### getAnimIndex: Get the index of an animation in the Event Actor. ##### Return animation index if success, -1 on error. ##### int getAnimIndex(char *animName) animName: a valid animation name in the current Event Actor. ##### Script Editor Syntax: getAnimIndex("palette"); Example: 1. Create two Actors: "number" and "myImages". 2. Assign text to the "number" Actor. Use "0" for the text. 3. Assign 3 animations to the "myImages" Actor. 4. On "myImages" Actor, Create Actor >Script Editor 5. Enter the following code: number.textNumber= getAnimIndex("myAnimation2"); ##### getAnimName: Get the name of an animation in Event Actor. Return animation name if success, "" on error. ##### char *getAnimName(int animIndex) animIndex: an animation index in the Event Actor. ##### Script Editor Syntax: strcpy(text, getAnimName(0)); ##### getactor: Returns Actor at position (x,y) (in game coordinates) if success, invalid Actor (with cloneindex = -1 and name = "") on error. Actor *getactor(int x, int y) ##### Script Editor Syntax: Actor *MyActor; MyActor=getactor(x,y); ##### getclone: Get Actor with name cloneName. Actor *getclone(char *cloneName) cloneName: nameactor.cloneindex (Example: ship.1, ship.2, ...) Return Actor if successful, invalid Actor (with cloneindex = -1 and name = "") on error. ##### getTime: Get system date and time. stTime getTime(); ##### The stTime is a struct with follow members: sec: Seconds after minute (0 - 59) min: Minutes after hour (0 - 59) hour: Hours since midnight (0 - 23) mday: Day of month (1 - 31) mon: Month (1 - 12; January = 1) year: Year (current year) wday: Day of week (0 - 6; Sunday = 0) yday: Day of year (0 - 365) sec_utc: Number of seconds elapsed since midnight (00:00:00), January 1, 1970 (coordinated universal time) ##### Script Editor Syntax: stTime t = getTime(); textNumber = t.sec; //to show the seconds Download the sample here ##### ##### openUrl: Opens a web page. ##### Game Editor Syntax: ##### openUrl("http://game-editor.com"); ##### round: Returns the value of arg rounded to the nearest integer. However, the number is returned as a floating-point value. Values precisely between two values, such as 3.5 are rounded up. double round(double arg); ##### max: R eturns the maximum of two values. double max(double a, double b) ##### min: R eturns the minimum of two values. double min(double a, double b) ##### rand: G enerates a sequence of pseudorandom numbers. Each time it is called, an number between zero and max will be returned. ##### double rand (double max); ##### vectoradd: Adds vector2 (angle2, magnitude2) to vector1 (angle1, magnitude1) and returns the result in vector1 (angles in degrees). void vectoradd(double *angle1, double *magnitude1, double angle2, double magnitude2). Download an example here. ### Device Indentification functions ##### getHardwareID: Returns a string that can uniquely identify the device. Use this function to get a string that can uniquely identify a Pocket PC, Handheld PC or Smartphone device. This string can be used in some registration service to protect your game against illegal copies. Some protected smartphones requires you digitally sign your game to execute and use this function. Returns an empty string on desktop or if any error happens. ##### char *getHardwareID(); ##### Script Editor Syntax: strcpy(text, getHardwareID()); ##### getOwner: Returns the device owner name. Use this function to get the owner name of Pocket PC, Handheld PC or Smartphone device. Returns an empty string on desktop or if any error happens. ##### char *getOwner(); ##### Script Editor Syntax: strcpy(text, getOwner()); ##### ### Standard C Functions ##### For more detailed information consult a C Programmer's Reference ##### abs: Returns the absolute value of a number. int abs(int num); ##### Script Editor Syntax: int num =5; myactor.textNumber=abs(num); ##### acos: Returns the arc cosine of arg. double acos (double arg); Note: The argument to acos() must be in the range -1 to 1: otherwise, a domain error will occur. asin: R eturns the arc sine of arg. ##### double asin (double arg); Note: The argument to asin() must be in the range -1 to 1: otherwise, a domain error will occur. atan: Returns the arc tangent of arg. ##### double atan (double arg); atan2: R eturns the arc tangent of a/b. It uses the signs of its arguments to compute the quadrant of the return value. double atan2(double a, double b); atof: C onverts the string pointed to by str into a double value. ##### double atof (const char *str); ##### The string must contain a valid floating-point number. If this in not the case, the returned value is undefined. The number can be terminated by a character that cannot be part of a valid floating-point number. This includes whitespace, punctuation(other than periods), and characters other than E or e. This means that the atof() is called with "300.00 GameEditor is great.", the value 300.00 will be returned. atoi: C onverts the string pointed to by str into an int value. ##### int atoi (const char * str); ##### The string must contain a valid integer number. If this is not the case, the returned value is undefined. The nuber can be terminated by any character that cannot be part of an integer number. This includes whitespace, puncuation, and characters. This means that if atoi() is called with "456.78", the integer 123 value will be returned, and the ".23" is ignored. atol: C onverts the string poined to by str into a long int value. ##### long atol (const char * str); ##### The string must contain a valid integer number. If this is not the case, the returned value is undefined. The number can be terminated by any character that cannot be part of an intger number. This includes whitespace, punctuation, and characters. This means that if atol() is called with 345.67, the long integer value 345L will be regurned, and the .67 is ignored. calloc: A llocates memory the size of which is equal to num * size. (For more detailed information consult a C Programmer's Reference.) ##### void * calloc(size_t num, size_t size); ##### calloc() allocates sufficient memory for an array of num objects of size size. All bits in the allocated memory are initially set to zero. The calloc() function returns a pointer to the first byte of the allocated region. If there is not enough memory to satisfy the request, a null pointer is returned. It is always imprortant to verify that the return value is not null before attempting to use it. ceil: Returns the smallest integer (represented as a floating-point value) not less than num. double ceil (double num); ##### For example, given 3.02, ceil() would return 4.0. Given -3.02, ceil() would return -3. ##### Script Editor Syntax: myactor.textNumber= ceil(3.02); ##### cos: R eturns the cosine of arg. The value of arg must be in radians. double cos (double arg); cosh: Returns the hyperbolic cosine of arg. double cosh (double arg); ##### fclose: Closes the file associated with stream. fclose(FILE * stream); ##### If successful, zero is returned; otherwise EOF is returned. Trying to close a file that has already been closed is an error. Removing the storage media before closing a file will also generate an error, as will lack of sufficient free disk space. feof: D etermines if the end of the file associated with stream has been reached. ##### A nonzero value is returned if the file position indicator is at the endo-of-file; zero is returned otherwise. Once the endo fot the file has been reached, susequent read operations will return EOF until either rewind() is called or the file position indicator is moved using fseek(). feof is particulary useful when working with binary files because the end-of-file maker is alswo a valid binary integer. fgetc: R eturns the next character from the specified input stream and increments the file position indicator. int fgetc(FILE *stream); ##### The character is read as an unsigned char that is converted to an integer. If the end of the file is reached, fgetc() returns EOF. However, since EOF is a valid integer value, when working with binary files your must use feof() to check for the end of the file. If fgetc() encounters an error, EOF is also returned. If working with binary files, you must use ferror() to check for file errors. fgets: Reads up to num-1 characters from stream and stores them in the character array pointed to by str. char *fgets(char *str, int num, FILE *stream); If successful, fgets() returns str; a null pointer is returned upon failure. ##### Characters are read until either a newline or an EOF is recieved or until the specified limit is reached. After the characters have been read, a null is stored in the array immediately after the last character read. A newline character will be retained and will be part of the array pointed to by str. floor: Returns the largerst integer (represented as a floating-point value) not greater than num. ##### double floor(double num); ##### For example 3.02, floor() would return 3.0 . Given -3.02, floor() would return -3.0. ##### Script Editor Syntax: myactor.textNumber= floor(3.02); ##### fmod: R eturns the remainder of a/b. ##### double fmod(double a, double b); ##### fopen: O pens a file whose name is pointed to by fname and returns the stream that is associated with it. The path must be relative to game directory. ##### FILE *fopen(const char *name, const char *mode) ##### The types of operations that will be allowed on the file are defined by the value of mode. The filename must be a string of characters comprising a valid filename as defined by the operatiing system. Script Editor Syntax: Script for reading text from a File: char textArray[10][256]; //Max 10 text of 255 characters int nText = 0; //Number of texts read void readText(char * fileName) { char line[256]; FILE *arq = fopen(fileName, "r"); if(arq) { while(fgets(line, 255, arq) && nText < 10) { if(strlen(line) > 0) //Dont put empty lines { strcpy(textArray[nText], line); nText++; } } } } ##### fprintf: Write a formatted string in the selected file. ##### int fprintf(FILE * fp,const char *fmt, ...); ##### fputc: W rites the character ch to the specified stream at the current file position and then advances the file position indicator. ##### fputc( int ch, FILE *stream); ##### Even though ch is declared to be an int for historical reasons, it is converted by fputc() into an unsigned char. The value returned by fputc() is the value of the character written. If an error occurs, eOF is returned. For files opened for binary operations, an EOF may be a valid character, and the function ferror() will need to be used to determine whether an error has actually occurred. ##### fputs: W rites the contents of the string pointed to by str to the specified stream. The null terminatior is not written. The fputs() function returns nonnegative on success and EOF on failure. ##### fputs(const char * str, FILE *stream); fread: R eads count number of objects, each object being size bytes in length, from the stream pointed to by stream and stores them in the array pointed to by buf. The file position indicator is advanced by the number of characters read. The fread() function returns the number of items actually read. If fewer items are read than are requested in the call either an error has occurred or the end of file has been reached. You must use feof() or ferror() to determine what has taken place. ##### size_t fread(void *buf, size_t size, size_t count, FILE * stream); free: R eturns the memory pointed to by ptr to the heap. This makes the memory available for future allocation. It is imperative that free() only be called with a pointer that was previously allocated using one of the dynamic allocation system's functions. ##### void free(void *ptr); fscanf: R eads information from the stream specified by stream. fscanf() returns the number of arguments actually assigned values. This number does not include skipped fields. A regurn value of EOF means that a failure occured before the first assignment was made. ##### int fscanf(FILE *stream, const char *format, ...); fseek: S ets the file position indicator associated with stream according to the values of offset and origin. Its purpose is to support random access I/O operations. A return value of zero means that fseek() succeeded. A nonzero value indicates failure. In general, fseek() should be used only with binary files. ##### int fseek(FILE *stream, long int offset, int origin); ftell: R eturns the current value of the file position indicator for the specified stream. In the case of binary streams, the value is the number of bytes the indicator is from the beginning of teh file. For text streams, the return value may not be meaningful except as an argument to fseek() because of possible character translations, such as carriage return/linefeeds being substituted for newlines, which affect the apparent size of the file. ##### long int ftell (FILE *stream); ##### Returns -1 whan an error occurs. fwrite: W rites count number of objects, each object being size bytes in length, to the stream pointed to by stream from the character array pointed to by buf. The file position indicator is advanced by the number of characters written. ##### size_t fwrite(const void *buf, size_t size, size_t count, FILE *stream); Returns the number of items actually written, which, if the function is successful, will equal the number requested. If fewer items are written than are requested, an error has occurred. ##### log: R eturns the natural logarithm for num. A domain error occurs if num is negative. If num is zero, a range error is possible ##### double log(double a); ##### log10: R eturns the base 10 logarithm for num. A domain error occurs if num is negative. The num is zero, a range error is possible. ##### double log10(double a); ##### malloc: R eturns a pointer to the first byte of a region of memory of size size that has been allocated from the heap. If there is insufficient memory in the heap to satisfy the request, malloc() returns a null pointer. It is always important to verify that the return value is not null before attempting to use it. Attempting to use a null pointer usually result in a system crash ##### void *malloc(size_t size); ##### memcmp: C ompares the first count characters of the arrays pointed to by buf1 and buf2. Returns an integer. int memcmp(const void *buf1, const void *buf2, size_t count); ##### memcpy: C opies count characters from the array pointed to by from into the array pointed to by to. If the arrays overlap, the behavior of memcopy() is undefined. Returns a pointer to to. void *memcpy(void *to, const void *from, size_t count); ##### memmove: C opies count characters from th array pointed to by from into the array pointed to by to. If the arrays overlap, the copy will take place correctly, placing the correct contents into to but leaving from modified. Returns a pointer to to. void *memmove(void *to, const void * from, size_t count); ##### memset: C opies the low-order byte of ch into the first count characters of the array pointed to by bur. It returns buf. The most common use of memset() is to initialize a region of memory to some known value. ##### void *memset( void *dest, int c, size_t count ); ##### pow: R eturns base raised to the exp power (base exp). A domain error may occur if base is zero and exp is less than or equal to zero. It will also happen if base is negative and exp is not an integer. A range error is possible. double pow(double base, double exp); ##### realloc: C hanges the size of the previously allocated memory pointed to by ptr to that specified by size. The value of size can be greater or less than the original. A pointer memory block is returned because it may be necessary for realloc() to move the block in order to change its size. If this occurs, the contents of the old block (up to size bytes) are copied into the new block. ##### void *realloc(void *ptr, size_t size); ##### sign: Returns an integer indicating the sign of a number. ##### double sign(double a); ##### sin: R eturns the sine of arg. The value of arg must be in radians. double sin(double arg); ##### sinh: R eturns the hyperbolic sine of arg. double sinh (double arg); ##### sprintf: U se sprintf to mix fixed text (like "Hello...") with text in variables (like actor name, numbers, ...) sprintf(youractor.text, "Hello %s", stringvar); ##### sqrt: R eturns the square root of num. If they are called with a negative argument, a domain error will occur. double sqrt (double num); ##### sscanf: R eads data from the array pointed to by buf. int sscanf(const char *buf, const char *format,...); ##### strcat: C oncatenates a copy of str2 to str1 and terminates str1 with a null. The null terminator originally ending str1 is overwritten by the first character of str2. The str2 is untouched by the operation. If the arrays overlap, the behavior of strcat() is undefined. char *strcat(char *str1, const char *str2); ##### strchr: R eturns a pointer to the first occurrence of the low-order byte of ch in the string pointed to by str. If no match is found, a null pointer is returned. char *strchr(const char *str, int ch); ##### strcmp: C ompares two strings and returns an integer based on the outcome. int strcmp(const char *str1, const char *str2); ##### strcpy: C opies the contents of str2 into str1. str2 must be a pointer to a null-terminated string. strcpy() function returns a pointer to str1. char *strcpy(char *str1, const char *str2); ##### strlen: R eturns the length of the null-terminated string pointed to by str. The null terminatior is not counted. size_t strlen(const char *str); ##### strncat: Appends the source string s2 to destination string s1, but not more than n characters char *strncat(char * s1, const char *s2, size_t n) ##### strncmp: C ompares not more than count characters from the two null-terminated strings and returns an integer based on the outcome. If there are less than count characters in either string, the comparison ends when the first null is encountered. char *strncmp(char *str1, const char *str2, size_t count); ##### strncpy: C opies up to count characters from the string pointed to by str2 into the array pointed to by str1. str2 must be a pointer to a null-terminated string. char * strncpy(char *str1, const char *str2, size_t count); ##### tan: R eturns the tangent of arg. The value of arg must be in radians. double tan (double arg); ##### tanh: R eturns the hyperbolic tangent of arg. double tanh(double arg); ##### ### ### Tutorials >> |  |
#### Home Top |  |  |  |