Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: How to transfer the image to component STATIC?  (Read 2139 times)

0 Members and 1 Guest are viewing this topic.

HIman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Russian adventure !
    • View Profile
    • Home WEB by QSP
How to transfer the image to component STATIC?
« on: August 28, 2005, 08:06:02 AM »

Example
scenes\start_logo\scr\credits.script
Code: [Select]
#include "scripts\base.inc"

var Caption = this.GetControl("credit");
var Caption_image = this.GetControl("credit_imge");

Game.PlayMusic("sounds\town_zombie_call1.ogg");
DoCredit("HIman present","sprites\logo.sprite");

Sleep(3600);
Game.StopMusic();
Sleep(1000);
HideCredit();
Sleep(500);

Game.PlayMusic("sounds\windchine1.ogg");
DoCredit("AKAVAKA present","sprites\2d_zast.sprite");
   
Sleep(3600);
Game.StopMusic();
Sleep(1000);
HideCredit();
Sleep(500);

this.Visible = false;

DoClose();


////////////////////////////////////////////////////////////////////////////////
function DoClose()
{
Game.StopMusic();
        this.Close();
Game.ChangeScene("scenes\Menu\Menu.scene");
Game.UnloadObject(this);
}

////////////////////////////////////////////////////////////////////////////////
function DoCredit(Text, Image)
{
var i;

this.AlphaColor = RGB(255, 255, 255, 0);

Caption.Text = Text;

//   Not work
//        Caption_image.Image = Image;
//   Not work to
          Caption_image.SetImage(Image);


// show new credit
for(i = 0; i<=255; i=i+10)
{
this.AlphaColor = RGB(255, 255, 255, i);
Sleep(80);
}
this.AlphaColor = RGB(255, 255, 255, 255);
}

////////////////////////////////////////////////////////////////////////////////
function HideCredit()
{
var i;
// hide old credit
for(i = 255; i>=0; i=i-10)
{
this.AlphaColor = RGB(255, 255, 255, i);
Sleep(20);
}

}

scenes\start_logo\scr\credits.window

Code: [Select]
WINDOW
{
  TRANSPARENT = TRUE
  SCRIPT = "scenes\start_logo\scr\credits.script"
  STATIC
  {
    NAME = "credit_image"
    X = 270
    Y = 100
  }
  STATIC
  {
    TEXT = ""
    TEXT_ALIGN = "center"
    NAME = "credit"
    FONT = "fonts\big_grey.font"
    X = 0
    Y = 568
    WIDTH = 800
    HEIGHT = 32
  }
}

The text works perfectly, but the image is not :(

If in scenes\start_logo\scr\credits.window to insert

Code: [Select]
WINDOW
{
  TRANSPARENT = TRUE
  SCRIPT = "scenes\start_logo\scr\credits.script"
  STATIC
  {
    NAME = "credit_image"
    X = 270
    Y = 100
    IMAGE = "sprites\logo.sprite"
  }
  STATIC
  {
    TEXT = ""
    TEXT_ALIGN = "center"
    NAME = "credit"
    FONT = "fonts\big_grey.font"
    X = 0
    Y = 568
    WIDTH = 800
    HEIGHT = 32
  }
}

That the picture is shown as it is necessary, but whereas it can be changed?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5679
    • View Profile
    • Dead:Code Site
Re: How to transfer the image to component STATIC?
« Reply #1 on: August 28, 2005, 08:16:11 AM »

This should work:

  Caption_image.SetImage(Image);


But you seem to have a typo in the following line:

  var Caption_image = this.GetControl("credit_imge");
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

HIman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Russian adventure !
    • View Profile
    • Home WEB by QSP
Re: How to transfer the image to component STATIC?
« Reply #2 on: August 28, 2005, 09:31:02 AM »

Oh, forgive really I is not attentive.

But nevertheless has not earned.

Call to undefined method 'SetImage'. Ignored.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5679
    • View Profile
    • Dead:Code Site
Re: How to transfer the image to component STATIC?
« Reply #3 on: August 28, 2005, 12:24:33 PM »

So, uh... does it work now? I tried the your script with the fixed typo and it works here.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

HIman

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 24
  • Russian adventure !
    • View Profile
    • Home WEB by QSP
Re: How to transfer the image to component STATIC?
« Reply #4 on: August 28, 2005, 04:41:10 PM »

 It work! Thanks !!!!
You the wizard, that I only did not do{make} also a code checked
Also has written a pair of other scripts too the most realizing.
The doubt has already crept in that only TEXT it is possible to transfer,
and other parameters are not present.
I cannot explain why 4 hours back this code did not work, and now works.  :(
Logged
 

Page created in 0.19 seconds with 24 queries.