Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Pictures+Scripting

12 years ago

Hey guys I am new here and have zero experience  with scripts. I am making a game where you control your own little empire and stuff, and I want to make it so that if you click on a link that says check map it lets you see a map of your borders and what other countries are around. But the problem is I don't know how to change the picture so for example if you buy land it shows a new picture with your borders increased. Do I have to make a secret variable and make it so that if it is higher then x than it changes the picture? And if so how do I bring the picture into the script.

Pictures+Scripting

12 years ago

I think you're on the right track, although you'll probably end up needing to check multiple variables (unless your game is really simple.) You should be able to insert the picture using HTML in your scripts -- and if you don't know HTML, it's easy to pick up the basics. Of course, you'll also need to make a bunch of pictures, depending on how many 'states' your empire can be in.

Pictures+Scripting

12 years ago

You could have a different page for each picture, and then use link scripting to control where the "Go to Map" link actually sends them based on their variables.

Pictures+Scripting

12 years ago

Alternatively, you can change the picture through scripting like you thought. The script of the page where you have the map would be something like this:

IF %SECRETVARIABLE = 1 THEN

$PAGETEXT := $PAGETEXT + "<img src='http://chooseyourstory.com/resources/images/user/16013'/>"

ELSE IF %SECRETVARIABLE = 2 THEN

$PAGETEXT := $PAGETEXT + "<img src='http://chooseyourstory.com/resources/images/user/16014'/>"

The bolded part is number the site gives your picture. Go to My Pictures, and either hover over the picture (the bottom left of your screen might tell you the number), or click on the picture and it will try to download it, with the file name as the number.

I got the basic info from an article Zakari made before: http://chooseyourstory.com/help/articles/article.aspx?ArticleId=108

So yes, it's possible to do it with scripting and it isn't too hard.

Pictures+Scripting

12 years ago

You can also put pictures By Variable directly on a Page in the Edit (not Source) side.

Set a Variable that keeps track of which picture to show (Say MAP1), then on the Page, enter this text: (where XXXXX is the picture number from your My Stuff / Pictures on the site, gained by right-clicking and looking at the picture Properties)

%%MAP1%=%1%<img alt="1-1.jpg" src="http://chooseyourstory.com/resources/images/user/XXXXX" />%%%%MAP1%=%2%<img alt="1-2.jpg" src="http://chooseyourstory.com/resources/images/user/XXXXX" />%%%%MAP1%=%3%<img alt="1-3.jpg" src="http://chooseyourstory.com/resources/images/user/XXXXX"  />%%

The above, checks to see if %MAP1 is set to 1, 2, or 3, and shows only the picture as applicable.

Pictures+Scripting

12 years ago

Thanks Berk this worked for me.