Author Topic: Advanced VCE v2 - Raycast event! Uploaded to RTB.  (Read 10967 times)

Advanced VCE

Description
After finding that default Variable Conditional Events had no Sin, Cos, or Tan functions, I made a brick which basically you relay and it calculates the sin, or cos of whatever you send it. However, i got fed up with having to set them up, so I made an extension to VCE.

Events
Self Output: VCE_AdvModVar > "Target list", "Variable Name", "Logic", "Second Variable/Number"
Target List is the same as VCE_ModVar; Self, Player, Client, Minigame, Vehicle.
Variable Name is the name of the variable to change.
Logic is what you want to change in the variable; Sin, Cos, Tan, DegToRad, RadToDeg, FloatLength, VectorAdd, VectorSub, VectorScale, VectorDist, VectorLen, VectorNormalize, GetSubStr, StrPos.
Second Variable depends on the Logic. For Sin, Cos, and Tan, putting "-1" in this will change it to Inverse Sin, Cos, or Tan. FloatLength sets the amount of decimal places the variable can go to. VectorAdd, Sub, Scale, Dist needs vectors. GetSubStr accepts one or two words. If only one number is given, it will get everything afterwards.

Self Output: VCE_Expression > "Expression", "Expression", "Expression", "Expression"
Allows you to combine a crapton of lines into one. Its basically a programming language in an event. Massively WIP, don't get too attached.
Currently includes: + - * / Sin, ASin, Cos, ACos, Tan, ATan, DegToRad, RadToDeg, FloatLength, <var:x:y>, x%y, =x%y. x%y is my own variable replacers, target%variable. Target can be B/Brick/S/Self for Brick variables. P/Player for player. C/Client/[blank] for client, M/Minigame, V/Vehicle. Using =x%y sets the variable, otherwise it will get the variable. If you don't understand, don't use it.
Eg. "<var:player:yaw> degToRad sin * 5 =C%AimVectorY" This gets the players yaw, converts it into radians, finds the sin of it, multiplys it by 5, then sets the client variable "AimVectorY" to the result.

Self or Player Output: VCE_raycast > "Setting", "Vector", "Range", "Targets"
Fires a raycast in the given direction. Setting modifies what the Vector does. World, Forward (For player target), and Variable (Brick/Player:rcvec). The raycast then outputs details into variables brick or player: 'rctype' type of object hit. 'rcpos(x,y,z)' position raycast hit. 'rcdist(x,y,z)' Distance from starting position.
If range is set to 0, it will use the vectors distance. If not it will only go as far as the range. Targets is what to look for, Bricks, Players, or Vehicles, or any combination of the three. If the raycast hits something, it triggers OnVCERaycast.
Note: Does not detect the non-brick ground!

Input: onVCERaycast > Targets Self, Player, Client, Minigame, TargetBrick, TargetPlayer, TargetClient, TargetVehicle
Triggered when a raycast hits an object. Use to affect objects from another brick without namedbricks, relays, projectiles, you name it. Only works on the owners bricks.

Generally if you do not understand something in this, don't use it.


Variable Replacers
Player
  • rhealth - Rounded Health (Ceiled)
  • renergy - Rounded Energy (Ceiled)
  • rdamage - Rounded damage (Floored)
  • pos - Position (X, Y, Z)
  • state - State (Honestly, no idea..)
  • isPassenger - If the player is a passenger in a vehicle/bot
  • isDriver -If the player is driving a vehicle/bot
  • altFire - If the player is Alt Firing
  • veDamage - Mounted Vehicle's damage
  • veHealth - Mounted Vehicle's health
  • veMaxHealth - Mounted Vehicle's max health
  • veDatablock - Mounted Vehicle's datablock
  • weDamage - Currently equipped weapons projectile damage
  • weRadiusDamage - Currently equipped weapons explosion damage
  • weDamageRadius - Currently equipped weapons explosion range
  • weSpeed - Currently equipped weapons projectile speed
  • weArc - Currently equipped weapons projectile gravity/weight
  • item6 - Item name in slot 6
  • item7 - Item name in slot 7
  • item8 - Item name in slot 8
  • item9 - Item name in slot 9
  • item10 - Item name in slot 10
  • yaw - Players yaw 0 - 360 degrees
  • pitch - Players pitch -90 - 90 degrees
Brick
  • pos - Position (X, Y, Z)
  • type - Brick type (Tab in Brick GUI)
Vehicle
  • pos - Position (X, Y, Z)
  • yaw - Vehicles yaw 0 - 360 degrees
  • pitch - Vehicles pitch -90 - 90 degrees
Still no vehicle roll..
Global
  • simSecond - The second since the server started (Floored)
  • simMinute - The minute since the server started (Floored)
  • simHour - The hour since the server started (Floored)


Black = Credits to me.
Yellow = Credits to Boom.
Red = Credits to Clockturn / M

NOTE: Most of these Replacers are from other Packs. Disable "Event_MoreVariableReplacers", and "Event_VCEReplacers".
I have asked Clockturn (M), and he said that I can use the Yaw and Pitch from his pack, however Boom hasn't been online for a while, and i cant find him on the forums. If he asks me to, i will remove his replacers, and tell you to get his instead.

Beta Testers needed!
Keep an eye out for my server.

Future Updates
Rewrite of the Expression, a lot more features, who knows what else.

« Last Edit: January 12, 2013, 12:12:39 PM by boodals 2 »



Add string functions to vce.
I want to be able to do getsubstr on vce variables, through events.

Add string functions to vce.
I want to be able to do getsubstr on vce variables, through events.
While i have no idea what getsubstr does, i was gonna add string logic, however after adding GetWord and GetWords, it broke the last output parameter. Thats why aSin, aCos, and aTan were merged with Sin, Cos, and Tan. I think theres a limit on the amount of list you can have :C
However, a separate event should work. AdvModString?

Oh, and i probably should of added, these haven't been completely tested. It works as far as a <10 lines of them (Var>DegToRad>Sin>FloatLength>Sin^-1>RadToDeg>Var), but nothing has been tested with multiple clients.

Also, Sin, Cos, and Tan accepts Radians, not Degrees. Use DegToRad.
« Last Edit: November 26, 2012, 04:43:28 PM by boodals 2 »

ive already had most of these var replacers for almost a year now except the black ones; but they're kinda useless

edit: rest of this stuff looks sweet, i'll play around with this when i get some free time

getsubstr returns parts of the string
getsubstr("blahasdfcool23",4,8) returns asdfcool

getsubstr returns parts of the string
getsubstr("blahasdfcool23",4,8) returns asdfcool
Oooh, i see. Nice, i think i can fit that in actually. Once i fix GetWords ill try that.

Sweet.

Are you willing to make more VCE stuff?

the thing is, I'm only going to use the variable replacers :I
but wow this is actually really useful.

Sweet.

Are you willing to make more VCE stuff?
Of course. The raycasting event i made is pretty epic from what ive tested.

Basically, it detects from the player, or from bricks, a certain distance in a certain direction. Then it outputs the data into variables.

Of course. The raycasting event i made is pretty epic from what ive tested.

Basically, it detects from the player, or from bricks, a certain distance in a certain direction. Then it outputs the data into variables.

Damn I want that.  Is it line-of-sight, or does it record all in that direction.

Its a raycast. Basically it creates a line, then finds out whats touching it. For the player, its either world based (x, y, z from the players position), or its where the player is looking.

getsubstr returns parts of the string
getsubstr("blahasdfcool23",4,8) returns asdfcool
actually it's zero indexed so i think it would return sdfcool2

so boodals, either you make it zero indexed ( and confusing for eventing noobs ) or make it not-zero-indexed (and confusing for scripters)


but if we're scripters we kinda aren't gonna be using vce so yeah

go with non-zero-index

(eg) abc == a = 1, b = 2, c = 3

VS zero indexed
a = 0, b = 1, c = 2

Were you always this clever, boodals?