Author Topic: Variable/Conditional Events (V.4)  (Read 60961 times)

Variable/Conditional Events
By Chrono and Destiny


Introduction
This is a massive mod which allows you to increment, decrement etc players variables and call upon ifVariable and other input events before acting a event command. This mod is the end of all those bad RPGs, now all you need is this to make a your own currency system, banking system, everything that in the past you had to script.

Input Events
VariableTrue - This is called if the output event "ifVariable" and its children return true.
VariableFalse - This is called if the output event "ifVariable" and its children return false.

Output Events
Player & Client & Bricks - addVariable - The first text box is the variable you want to increase or descrease and the second is by how much.
Player & Client Bricks - setVariable - The first text box is the variable you want to set and the second is what you want to set it too.
Player & Client Bricks - multiplyVariable - The first text box is the variable you want to set and the second is what you want to multiply it by.
Player & Client Bricks - divideVariable - The first text box is the variable you want to set and the second is what you want to divide it by.
Player & Client Bricks - ifVarToVar - Allows you to check if one variable equals another variable.
Player & Client Bricks - addVarToVar - Allows you to add one variable to another.
Player & Client Bricks - subVarToVar - Allows you to subtract one variable with another.
Player & Client Bricks - displayVar - You can choose either to chat message. center print, bottom print or messageboxok and it displays the value of a variable.
fxDTSBrick - ifVariable - You use this to check if a variable equals a certain number. The 1st textbox is the variable and second is the number you want to check.
fxDTSBrick - ifBrickNameEquals - You use this to check if a brick name equals are string.
fxDTSBrick - ifPlayerNameEquals - You use this to check if the player who is doing the event's name equals a string.
fxDTSBrick - ifAdmin - You use this to check if the player who is doing the event is an admin.
fxDTSBrick - ifRandomDice - This rolls a virtual die. The first textbox is amount of sides on the die.
fxDTSBrick - ifRandom - This randomly chooses a number, First box is the minimum number it can be and the second is the highest number it can be. 
fxDTSBrick - ifPrintCount - If bricks print count equals certain logic. (Must have been incremented or decremented by events first)
fxDTSBrick - ifPlayerID - If the players blockland ID equals a certain logic.
fxDTSBrick - ifPlayerScore - If the players score equals a certain logic.
fxDTSBrick - ifPlayerDamage - If the players damage equals a certain logic. (Opposite of health)
fxDTSBrick - ifPlayerEnergy - If the players energy equals a certain logic.
fxDTSBrick - ifPlayerSpeed - If the players speed equals a certain logic on a certain axis.
fxDTSBrick - ifLastPlayerMsg - If the last message the player said in the chat equals something. (Best used with onPlayerTalk input event)
Client - saveVariable - REQUIRES TRUCE's SAVING VARIABLES [SEE DOWN]
Client - loadVariable - REQUIRES TRUCE's SAVING VARIABLES [SEE DOWN]


How does it work?
Its relatively easy to use. To call the if output events, you just do the output event, then do the next line of event VariableTrue, which means if it succeeds, or Variable False. It's best to play around with it a bit to get how to use it.

Installation & Download
Mirror 1: Destiny's Page
Mirror 2: MediaFire
Click Here to view this file on the RTB Download Manager
Just place it straight into your add-ons folder. (And tick it on the start mission menu)

Change Log
Version 2:
  • ifVarToVar
  • addVarToVar
  • subVarToVar
  • displayVariable
  • setVarToVar

Version 3:
  • ifAdmin
  • ifBrickNameEquals
  • ifPlayerNameEquals
  • ifRandomDice
  • ifRandom

Version 4:
  • ifPrintCount
  • ifPlayerID
  • ifPlayerScore
  • ifPlayerDamage
  • ifPlayerEnergy
  • ifPlayerSpeed
  • ifLastPlayerMsg
  • Saving Variables by Truce [SEE DOWN]

Tutorials
Multiple Variable Checks in One Brick - by Truce

V/CE Mods that have been Approved to be Safe and Useful:
ifItemInSlot/ifItemInHand Event - by Truce
ifProjectile - by Truce
Saving Variables - by Truce [HIGHLY SUGGESTED]

« Last Edit: January 05, 2009, 05:14:41 PM by Destiny/Zack0Wack0 »

Nice job DL'ed

(first post! :D)
« Last Edit: November 30, 2008, 10:50:44 AM by nano »

this looks coolo ill DL later

(first post! :D)




 On Topic: Awsome, needed.

can some one in the fourms make somehting use full
« Last Edit: August 30, 2008, 07:43:55 PM by DABlock »

can some one in the fourms make somehting use full


 In that case, whoever made you was an idiot.


This looks amazing, but confusing. The description needs to be worded better.

You forgot multiplyvariable and dividevariable and that dividing by 0 is impossible. D:

These are..

Expression Gates?

SWEET


can some one in the fourms make somehting use full


This is very useful, just then I made a team spawn system using them.

Sweet, this will allow much more wrench event functionality

Epic, as said on yous server. ;D

Output Events
Player & Client - incrementVariable - The first text box is the variable you want to increment and the second is by how much.
Player & Client - decrementVariable - The first text box is the variable you want to decrement and the second is by how much.
Player & Client - setVariable - The first text box is the variable you want to set and the second is what you want to set it too.
Player & Client - multiplyVariable - The first text box is the variable you want to set and the second is what you want to multiply it by.
Player & Client - divideVariable - The first text box is the variable you want to set and the second is what you want to divide it by.
fxDTSBrick - ifClientVariableEquals
fxDTSBrick - ifClientVariableGreat
fxDTSBrick - ifClientVariableGreatEquals
fxDTSBrick - ifClientVariableLess
fxDTSBrick - ifClientVariableLessEquals
fxDTSBrick - ifClientVariableNotEquals
fxDTSBrick - ifPlayerVariableEquals
fxDTSBrick - ifPlayerVariableGreat
fxDTSBrick - ifPlayerVariableGreatEquals
fxDTSBrick - ifPlayerVariableLess
fxDTSBrick - ifPlayerVariableLessEquals
fxDTSBrick - ifPlayerVariableNotEquals
You could cut down the number of output events quite easily. Firstly, there's no need for decrementVariable if you can pass negative numbers to incrementVariable. Also, you could just have one output event for all the if's, e.g.
if [drop-down box: Client, Player] [drop-down box: ==, >, <, >=, <=] [int value]

Right, I didn't think about that.
Thank you for the idea, I'll get to that when I get home.

Edit: To hell with that, I'll do it right now. I can download the file.

Double toast edit: Finished. However, since Destiny posted, I cannot update it at this moment. I'll PM him.
« Last Edit: August 30, 2008, 09:20:23 PM by Chrono »