Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Querystring and texture loading

andycampbell10
Registered User
Quote
2018-02-07 15:58:53

Hi there,

I'm building a WebGL project in Coppercube and wondered if there is a way to get the Load Texture action to work with querystrings in a URL?

Or any other way of passing in a variable into the URL of the action, so that the textures loaded could be changed depending on parameters rather than static?

Any advice would be highly appreciated!

Thank you

Andy


just_in_case
Moderator
Quote
2018-02-08 04:44:27

Don't know if it would work or not.... To get the texture by using a url
....not sure..


andycampbell10
Registered User
Quote
2018-02-10 14:37:51

Passing a URL parameter to a script via Load Texture embedded in the Coppercube WebGL build works fine.

So, for instance, in the Load Texture parameters box, specififying URL to get from as -

www.domain.com/grab-texture.asp?id=1

- with the grab-texture.asp script redirecting to a .jpg image based on the querystring picks up OK and works great.

But how could you pass a variable to Load Texture script so that id=1 could be any ID specified by a querystring?

It would be great if there was an easy way to do this. :)

Andy


just_in_case
Moderator
Quote
2018-02-10 17:00:57

You can save variable to a text file...

For example save a variable name "ID" and use add value 1

Then in your code to load a texture from a file ...

Add something like this...

Var id = ccbgetcoppercubevariable("ID")

Var url = www.domain.com/grab-texture.asp?id here id is our variable

Ccbloadtexturefromfile (url)


This can be the idea to fetch variable to url...by loading the coppercube variable into the code itself...
And then executing it...


Maybe am not explaining it correctly to u... As am not feeling well....


Zoo
Guest
Quote
2018-02-10 19:34:42

I have worked with this exact method before andycampbell, it works really well +1


andycampbell10
Registered User
Quote
2018-02-11 11:13:22

Thank you so much for your responses! I will give this a go.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact