I am having problems with sending a delegate variable of a scripted material as a parameter of a function. He does not want to reference properly to it.
Any ideas if this is possible?
Small example :
function OnClickIMGtag pBitmap pImgBitmap pEnableDC pToggle pMapBool pMap=
(
if pBitmap.filename == bm.filename then
(
local bmT = bitmap 64 64
bmT = selectBitMap()
if not(bmT == undefined) then
(
pBitmap = bmT
pEnableDC = true
)
)
if pEnableDC then
(
if b_Toggle_Diffuse then
(
pMapBool = true
pMap = pBitmap
pImgBitmap.bitmap = CreateOnImage pBitmap
pToggle = false
)
else
(
pMapBool = false
local tempBitmap = bitmap 64 64
copy pBitmap tempBitmap
pImgBitmap.bitmap = tempBitmap
pToggle = true
)
)
)--End Function
OnClickIMGtag bm_Diffuse imgT_Diffuse b_EnableDC_Diffuse b_Toggle_Diffuse delegate.bUseDiffuseMap delegate.diffuseMap
I believe your problem is that you are passing in the value of the delegate’s parameters but are expecting your function to actually change the parameter on the delegate. Instead your code is just changing the value of the variable within your function.
Try passing in the two delegate.* values as references instead of parameters.
[QUOTE=Nysuatro;10971]I am having problems with sending a delegate variable of a scripted material as a parameter of a function. He does not want to reference properly to it.
Any ideas if this is possible?
Small example :
function OnClickIMGtag pBitmap pImgBitmap pEnableDC pToggle pMapBool pMap=
(
if pBitmap.filename == bm.filename then
(
local bmT = bitmap 64 64
bmT = selectBitMap()
if not(bmT == undefined) then
(
pBitmap = bmT
pEnableDC = true
)
)
if pEnableDC then
(
if b_Toggle_Diffuse then
(
pMapBool = true
pMap = pBitmap
pImgBitmap.bitmap = CreateOnImage pBitmap
pToggle = false
)
else
(
pMapBool = false
local tempBitmap = bitmap 64 64
copy pBitmap tempBitmap
pImgBitmap.bitmap = tempBitmap
pToggle = true
)
)
)--End Function
OnClickIMGtag bm_Diffuse imgT_Diffuse b_EnableDC_Diffuse b_Toggle_Diffuse delegate.bUseDiffuseMap delegate.diffuseMap
[/QUOTE]
Nvm,
Solved it by using pass by reference and the dereference operator
function OnClickIMGtag pBitmap pImgBitmap pEnableDC pToggle pMapBool pMap=
(
if pBitmap.filename == bm.filename then
(
local bmT = bitmap 64 64
bmT = selectBitMap()
if not(bmT == undefined) then
(
pBitmap = bmT
pEnableDC = true
)
)
if pEnableDC then
(
if b_Toggle_Diffuse then
(
*pMapBool = true
*pMap = pBitmap
pImgBitmap.bitmap = CreateOnImage pBitmap
pToggle = false
)
else
(
*pMapBool = false
local tempBitmap = bitmap 64 64
copy pBitmap tempBitmap
*pImgBitmap.bitmap = tempBitmap
pToggle = true
)
)
)--End Function
OnClickIMGtag bm_Diffuse imgT_Diffuse b_EnableDC_Diffuse b_Toggle_Diffuse &(delegate.bUseDiffuseMap) &(delegate.diffuseMap)
EDIT: LOL Thanks Jeff Hanna. I saw your reply too late