getting a mobile ph gui to work

Started by gypsysnail, Tue 24/10/2006 03:08:13

Previous topic - Next topic

gypsysnail

Ok I shall try the run script one.

And duh, I shud hit my forehead lol, I didnt see left click 2 steps above! It is actually set to Set Cursor Mode. It is late at night but I WONT give up until I have resolved this lol. I like to stick at something til its done, bugger sleep lol, glad its weekend so not to worry :P.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Ashen

If you haven't already, change that to 'Run script'. Now you should get the message and animation.
I know what you're thinking ... Don't think that.

gypsysnail

#22
Ok I did this and added the script to the run script as shown but this is what i got:
EDIT:
There was an error compiling your script. The problem was:
In: 'Global script'

Error (line 264): Variable 'show_mobph_window' is already defined.

The script is:
Code: ags
#sectionstart inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE
function inventory5_a() {
  // script for Inventory item 5 (mobph): Talk to inventory item
function show_mobph_window  
}
#sectionend inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE


but that function section was added after I put in the run script interaction. So I dont know what is going on.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Ashen

Quote from: Ashen on Fri 03/11/2006 13:41:25
What you'll need to do is make that a Run script interaction, edit the script and paste show_mobph_window(); (including the '();' bit) into it.

So that'd be:
Code: ags

#sectionstart inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE
function inventory5_a() {
  // script for Inventory item 5 (mobph): Talk to inventory item
show_mobph_window();
}
#sectionend inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE


And please, show error messages as text, not image files. It makes it easier for people with the same problem to search.
I know what you're thinking ... Don't think that.

gypsysnail

Nope does not work :(.

Here is what I did so far.
First I added your edited script just above this section code:
Code: ags
#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function show_mobph_window () {
// is called when mouse clicks on mobile phone in inventory to interact
// with the mobile phone gui
  if(mouse.Mode == eModeTalkto){
     Display("Glop glop... ah you open the phone with your slimy snail hands.");
}
         gMobph.BackgroundGraphic = (128);
         Wait(5);
         gMobph.BackgroundGraphic = (124);
         Wait(5);
         gMobph.BackgroundGraphic = (125);
         Wait(5);
         gMobph.BackgroundGraphic = (126);
         Wait(5);
         gMobph.BackgroundGraphic = (127);

}
#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE


and it came up with this error message saying "Already referenced name as import; you must define it before using it" so I deleted that whole function section that I pasted above and came up with an error saying Script link failed: runtime error: unresolved import show_mobph_window.

This brain of mine is really stupid (yeah I know I shudnt put myself down but this is so frustrating, this learning curve).
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Ashen

Quote
First I added your edited script just above this section code:

Quote from: Me, a couple of hours ago
Using show_mobph_window (and hide_mobph_window, when you make it, or in fact ANY custom function) is a lot like using a custom variable. Firstly you need to be sure it comes earlier in the script than anything that tries to use it.

If you've added the Inventory script (that tries to use show_mobph_window) BEFORE your function declaration (that bit of code you just quoted), obviously you've going to have problems (the 'Already referenced as import' error.)

Deleting the function declaration but not the import in the Script Header will also cause problems (the 'unresolved import' error).

Put the above section of code back into the Global Script (if you haven't already), then make sure the Inventory interaction:

Code: ags

#sectionstart inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE
function inventory5_a() {
  // script for Inventory item 5 (mobph): Talk to inventory item
show_mobph_window();
}
#sectionend inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE


comes AFTER it in the Global Script. Then go get some sleep and come back to this with a clearer head :)
I know what you're thinking ... Don't think that.

gypsysnail

#26
Back up!!!! I am totally lost! my internet broadband is too slow to backtrack posts from a cpl hours ago (thanks to australia's low standard of broadband!). Please paste the exact orders and exact scripts fresh b4 I go to bed. Its just too hard. Its all a complicated mess I am sorry. All these error messages, just driving me mad

EDIT: sorry that wasnt meant to be an outburst, it was only meant to say hey can u back up a little. I am waiting for your reply, I will NOT go to bed til I have the answer :) I hate things being unresolved. I won't be able to sleep otherwise if its not resolved
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Ashen

#27
It's hard to do that without knowing exactly how your script is layed out, but from what you've posted so far, this should be close enough for jazz.

Global Script:
Code: ags

#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function show_mobph_window () {
// is called when mouse clicks on mobile phone in inventory to interact
// with the mobile phone gui
  if(mouse.Mode == eModeTalkto){
     Display("Glop glop... ah you open the phone with your slimy snail hands.");
}
         gMobph.BackgroundGraphic = (128);
         Wait(5);
         gMobph.BackgroundGraphic = (124);
         Wait(5);
         gMobph.BackgroundGraphic = (125);
         Wait(5);
         gMobph.BackgroundGraphic = (126);
         Wait(5);
         gMobph.BackgroundGraphic = (127);

}
#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE
function inventory5_a() {
  // script for Inventory item 5 (mobph): Talk to inventory item
show_mobph_window();
}
#sectionend inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE


You should also have the interface_click function between those sectionstat/end tags, but you haven't mentioned if it's before or after show_mobph_window.

Script Header (Not counting other functions and variables you've got imported):
Code: ags

import function show_mobph_window ();
I know what you're thinking ... Don't think that.

gypsysnail

Hey thanks! Ok that script is pasted in that order now, and no error message. Now the problem is - even though the message shows up as it should when I click hand icon on mobile ph in inventory, after the message, no gui shows up this time, just the cursor changes to the talk cursor instead. What would be the next step? and yes
Code: ags
Code:
import function show_mobph_window ();
was already in the header, so that was good and I changed the left click in floating box in the gui for mobile phone to run script.... so now.... what could be stopping the gui from showing up? Hmmmmm. Its good we have taken a few steps back up and now time to proceed one step, so this is not confusing now :). I will be able to sleep better after this yay! ;)
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Ashen

Ooops, I've gone code-blind. I didn't realise you'd removed the gMobph.Visible = true; line from show_mobph_window. That should be:

Code: ags

#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function show_mobph_window () {
// is called when mouse clicks on mobile phone in inventory to interact
// with the mobile phone gui
     Display("Glop glop... ah you open the phone with your slimy snail hands.");
    gInventory.Visible = false;
    gMobph.Visible = true;
    gMobph.BackgroundGraphic = 128;
    Wait(5);
    gMobph.BackgroundGraphic = 124;
    Wait(5);
    gMobph.BackgroundGraphic = 125;
    Wait(5);
    gMobph.BackgroundGraphic = 126;
    Wait(5);
    gMobph.BackgroundGraphic = 127;

}
#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE
function inventory5_a() {
  // script for Inventory item 5 (mobph): Talk to inventory item
show_mobph_window();
}
#sectionend inventory5_a  // DO NOT EDIT OR REMOVE THIS LINE


I also removed the if(mouse.Mode == eModeTalkto) part - since show_mobph_window will only be run by a 'Talk to' interaction, it wasn't really needed.
I know what you're thinking ... Don't think that.

gypsysnail

Oooh that worked!!! :) Now to work out how to get the exit to work and how to receive a message after a short while of sending the message. Thank you, and I or we can post the updates in this thread to keep ppl up to date, this be good reference for newbies in the future :). Cheers and g'nite, its late in Australia :D.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Maverick

I know it is a little late in the game and Ashen has done some great work (as always) but I also struggled with a cellphone GUI some time ago and my solution was to open the GUI by pressing "P" on the keyboard as I found this to be much easier than changing the cursor mode. I used the following code:

In top of global script (under variables)
Code: ags


//======================================================
//Control to pop up the Cellphone GUI
//======================================================
function Show_Cellphone(){
// Called when the "P" key is pressed to activate the GUI
gGuiphone.Visible = true;
gGuiphone.Backgroundgraphic = 51;
Wait(5);
gGuiphone.Backgroundgraphic = 52;
Wait(5);
gGuiphone.Backgroundgraphic = 53;
Wait(5);
gGuiphone.Backgroundgraphic = 54;
Wait(5);
gGuiphone.Backgroundgraphic = 55;
Wait(5);

#sectionstart on_key_pressÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_key_press(int keycode) {
Ã,  // called when a key is pressed. keycode holds the key's ASCII code

if (keycode=='P') Show_Cellphone(); //Show Cellphone GUI


In global script header:

Code: ags

import Show_Cellphone();


To close the GUI I used one of the buttons on the phone.

If nothing else this gives you another view on how it can be done.





   

SMF spam blocked by CleanTalk