Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Need help with Ocarina script  (Read 1011 times)

0 Members and 1 Guest are viewing this topic.
Need help with Ocarina script
« on: February 16, 2008, 03:57:58 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 7
Hi all Zelda fanatics  :), I'm working on a Zelda game at the moment and today i have been trying to make an Ocarina engine.

It have gone quite well, but as always something goes wrong. All tones(music) works correct but the draw event doesn't.
So the reason I'm writing this post is that when i play a tone on my ocarina it should draw images of the tones(like in OOT) but i cant get it to work :/

Creation code (ocarina obj)
Code: [Select]
ObjLink.image_speed=1
soundstring=0
ObjLink.sprite_index=SprLinkOcarina
lk=0; vA=0; vL=0; vR=0; vD=0; vU=0; sn="";
do {
lk=keyboard_lastkey
screen_redraw()
draw_text(ObjLink.x,ObjLink.y,sn)
screen_refresh()
if vA>0 vA-=0.01 else sound_stop(wav_oc_A)
if vL>0 vL-=0.01 else sound_stop(wav_oc_L)
if vR>0 vR-=0.01 else sound_stop(wav_oc_R)
if vD>0 vD-=0.01 else sound_stop(wav_oc_D)
if vU>0 vU-=0.01 else sound_stop(wav_oc_U)




if lk = ord('S') {if !sound_isplaying(wav_oc_A) sound_play(wav_oc_A);vA=1; if string_copy(sn,string_length(sn),1)!='A' sn+='A'}
if lk = vk_up {if !sound_isplaying(wav_oc_U) sound_play(wav_oc_U);vU=1;if string_copy(sn,string_length(sn),1)!='U' sn+='U'}
if lk = vk_down {if !sound_isplaying(wav_oc_D) sound_play(wav_oc_D);vD=1;if string_copy(sn,string_length(sn),1)!='D' sn+='D'}
if lk = vk_left {if !sound_isplaying(wav_oc_L) sound_play(wav_oc_L);vL=1;if string_copy(sn,string_length(sn),1)!='L' sn+='L'}
if lk = vk_right {if !sound_isplaying(wav_oc_R) sound_play(wav_oc_R);vR=1;if string_copy(sn,string_length(sn),1)!='R' sn+='R'}
if string_length(sn) > 7 sn = string_copy(sn,string_length(sn)-6,7)
sound_volume(wav_oc_A,vA)
sound_volume(wav_oc_L,vL)
sound_volume(wav_oc_R,vR)
sound_volume(wav_oc_U,vU)
sound_volume(wav_oc_D,vD)

if keyboard_check(vk_up) or keyboard_check(vk_down) or keyboard_check(vk_left) or keyboard_check(vk_right) or keyboard_check(ord('S')){
soundstring=+1
}

if string_copy(sn,string_length(sn)-5,6) = "RADRAD" {sleep(200); sound_play(mid_timesong);sn='';do{sleep(100)}until !sound_isplaying(mid_timesong); instance_destroy()}

keyboard_lastkey=0
sleep(50/3)
} until lk = ord('D') or lk = vk_escape
instance_destroy()

The step event (ocarina obj)
Code: [Select]


switch(sn){
case 'A':  image_index=4; break;
case 'U':  image_index=3; break;
case 'D':  image_index=1; break;
case 'L':  image_index=2; break;
case 'R':  image_index=0; break;
}

and the draw event (ocarina obj)
Code: [Select]
draw_sprite(Ocarinamenu,0,view_xview+50,view_yview+180)

if  soundstring=1 then{ draw_sprite(OcarinabuttonsU,(execute_string('sprite_index=Ocarinabuttons'+sn)),view_xview+20,view_yview+190)
}
if  soundstring=2 then{ draw_sprite(OcarinabuttonsU,(execute_string('sprite_index=Ocarinabuttons'+sn)),view_xview+20,view_yview+190)
}
if  soundstring=3 then{ draw_sprite(OcarinabuttonsU,(execute_string('sprite_index=Ocarinabuttons'+sn)),view_xview+20,view_yview+190)
}



I tried to make a code that changes the "soundstring" variable but i cant get it to work, so please help me  :'(
i would appreciate any kind of answer and i should be really glad if someone could help me to get rid of my problem :)

// Jegge
(sorry for my bad English)
Logged

Xiphirx

wat
Re: Need help with Ocarina script
« Reply #1 on: February 16, 2008, 10:02:35 pm »
  • Xiphirx
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3007
Well the first problem i saw was a "draw" function in the creation code, draw functions can only be done in  the draw event.
tip: use block coding it is so much easier to read
the step code does nothing since in the creation code sn has letters being added to it so it is not a single letter for the switch to work.
the problem i see is the whole "execute_string" part get rid of that and replace it by a simple variable... i don't see how it returns an integer...

that is why your code isn't working. good luck! :)
Logged
  • For The Swarm
Re: Need help with Ocarina script
« Reply #2 on: February 18, 2008, 10:02:06 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 7
got it to work! :D thanks to xiphirx for helping me ^^

Thread LOCKED!
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.084 seconds with 41 queries.