Shader (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 16:42, 14 August 2014 by AFRLme (talk) (Created page with "{| class="wikitable" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | Shader Toolkit || Definition...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Name Type By
Shader Toolkit Definition SimonS

This script offers some easy functions to use shader power. It ranges from blur, noise, saturation, contrast, lightness, colorize to some simple camera controls.

Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2. Call the functions you need.

Examples

shaderZoomCharacter("", 1.2, 3000, easeBackOut) -- Zoom 1.2x on current character in 3s with one bounce
shaderZoomObject(getObject("Objects[pole]"), 1.4, 3000, easeBounceOut)
shaderFollowCharacter("Heinz", 2, 3000) -- Follow character Heinz with a slow camera
shaderStopFollow() -- Stop following
shaderViewport(2, 300, 200, 1.41, 3000, easeBounceInOut) -- advanced zooming with rotating

shaderNoise(1, -0.1, 3000) -- activate noise in 3s with a soft black grain
shaderBlur(1, 1, 3000) -- activate blur in 3s
shaderSaturation(0, 3000) -- desaturate image in 3s
shaderLightness(-0.5, 3000) -- darken image in 3s
shaderContrast(2, 3000) -- double contrast
shaderHue(0.5, 2000) -- turn hue wheel, red->green
shaderColorize(0, 1, 3000) -- colorize with red

Reset Values

shaderViewport(1, 0, 0, 0, 1000, easeQuintOut)
shaderStopFollow() -- Stop following

shaderNoise(0, 0, 3000)
shaderBlur(0, 0, 3000)
shaderSaturation(1, 3000)
shaderLightness(1, 3000)
shaderContrast(1, 3000)
shaderHue(0, 2000)
shaderColorize(0, 0, 3000)

Main Script

--[[
Dynamic action names for dragged items [v2] (20/02/2014)
Written by AFRLme [Lee Clarke]
-- + --
alternatingfrequencies@hotmail.com | skype @ AFRLme
-- + --
This script is donation optional. In game credit is non-negotiable.
You are free to: ¹ use it in your game(s). ² modify the script.
Do not remove - or edit - this comment block.
--]]

-- * local variables * --
local item, txt, current, lang, old, new, iw, cj, val  -- empty variables

-- * tables * --
old = {} -- table which will contain original item names
new = {} -- table which will contain updated names
iw = {} -- initial word table
iw["English"] = {"Use ", "Give ", "Show ", "Combine "}
iw["French"] = {"Usage ", "Donner ", "Montrer ", "Combiner "}
iw["German"] = {"Benutzen ", "Geben ", "Zeigen ", "Kombinieren "}
iw["Spanish"] = {"Usar ", "Dar ", "Mostrar ", "Combinar "}
cj = {} -- conjunction word table
cj["English"] = {" on ", " to ", " to ", " with "}
cj["French"] = {" en ", " à ", " à ", " avec "}
cj["German"] = {" auf ", " zu ", " zu ", " mit "}
cj["Spanish"] = {" en ", " a ", " a ", " con "}

-- * function for udating object name with action text * --
function itemActionName()
 item = game:getLink(VGameUsedItem) -- get currently held item
 current = game:getLink(VGameCurrentObject) -- get current object (under cursor)
 lang = game:getLink(VGameStandardLanguage):getName() -- get current game language
 val = getObject("Values[conjunction_class]"):getInt(VValueInt) -- get conjunction class value
 -- + --
 if not item:isEmpty() then -- if held item exists then...
  txt = item:getLink(VObjectName):getLinks(VTextAll) -- get all texts for the held item
  for i = 1, table.maxn(txt) do if txt[i]:getLink(VTextLanguageLanguage):getName() == lang then item = txt[i]:getStr(VTextLanguageText) end end -- store item name
  -- + --
  new = current:getLink(VObjectName):getLinks(VTextAll) -- get all texts for the object under cursor
  for i = 1, table.maxn(new) do table.insert(old, new[i]:getStr(VTextLanguageText))  end -- insert string names of table above
  -- + --
  for i = 1, table.maxn(new) do if new[i]:getLink(VTextLanguageLanguage):getName() == lang then new[i]:setValue(VTextLanguageText, iw[lang][val] .. item .. cj[lang][val] .. old[i]) end end -- update object name with action text (initial word, item, conjunction word, target)
 end  
end

-- * function for resetting object name back to original name * --
function resetItemActionName()
  for i = 1, table.maxn(new) do new[i]:setValue(VTextLanguageText, old[i]) end -- reset all text (for each language) back to original text...
end