Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Zipofthe95

#1
I'm testing by just changing the code and launching the game to see if it works, but I'll try to deal with that on my own because that's off topic. Thanks very much for helping!
#2
Code: ags


function cmbrnd1()
  {
    cMain.LockView(3);  
    cMain.Animate(0, 3, eOnce);
    cMain.UnlockView();
    cMain.Walk(45, 182, eBlock, eAnywhere);
    cMain.LockView(3);  
    cMain.Animate(2, 4, eOnce);
    cMain.UnlockView();
    Dmg1 = (PlAt WpM)- o1D;
    o1H = o1H - Dmg1;
  }  



So this is within global script (.asc) (all in lower two lines are int variables, all defined in .asc)

Code: ags


import function cmbtrnd1();



This is header (.ash)

Code: ags


function oB1_Interact()
{
    cmbtrnd1();
cMain.Walk(82, 182, eBlock, eAnywhere);
cMain.LockView(6); 
cMain.Animate(0, 1, eOnce);
cMain.UnlockView();
}



And this is room code.

Error message (upon starting the game) is: "An internal error has occured. Please note down the following information. If problem persists, post the details on AGS technical forum (ACI version 3.5.0.24)

Error. Unable to create local script: Runtime error: unresolved import 'cmbtrnd1' "

Wherever I added, either named parameter or just declaring int or just number, that's the message I receive (that's why parenthesis are blank, result is the same). What's in brackets (or curly braces?)is irrelevant to me, I just split things like that to see how it works (I'm at the test room, precisely for things like thigs), I can delete it/rewrite it as neccessary, how to call the function is what's problematic.

I'm not exactly programming expert so I hope I provided what you asked (or to be exact, I just copied everything I did in regards to this). I hope it helped!

P.S. So... um... I just noticed. In .asc code, function is called "cmbrnd" and everywhere else is "cmb(t)rnd" ... I've added "t" and that seems to work. Wow. What a moron I am.

But, if I may ask. If just that "t" was fine and that's how functioning works, I think I have an actual question. In the .asc, o1H is health of an object. By that formula it should calculate dmg1 first and then subtract it from o1H, whereupon the subtracted value should be the new o1H, and if the o1H is zero, object should be.Visible = false. However, it doesn't do that. The object just stays. Did I do the formula wrong or should I unblock movement or (I added that object should be invisble a 0 o1H both in room and global script btw)?
#3
I question my sanity at this point.

So. In global script (.asc) I added a function that does a thing. In header (.ash) I've stated import function (it's name)... now after name it says (parameters). After that if I'm reading the manual correctly I call the function in the room by just saying function name (parameter value).

The gist is this. Whenever an object is clicked the function is supposed to fire off. Yet, whatever parameter I add it says "unresolved import" (I say this because (for now at least) parameter doesn't matter (in manual it's animation number, I don't need anything that specific) I just need it to run). What parameter should I use or at least where should I use it (I mean, room or global script(s))?

Thanks ahead.
#4
Interesting. Thanks.
#5
Yup, that's the stuff. Many thanks!
#6
Well that tells you bugger all.

Anyway, here's the gist. Let's say I have three four-button panels that use the same gui, and let's say the number 1 in each panel toggles the visibility of an object in a room. How would I go about it? I made a "panel gui" with "add gui button" but on click button sends me to global script. Global script doesn't work with local room objects (I just tried. I made an object 1 that controls that object within a room, works. On global script, it doesn't know what that object is). So essentially, is there a way to "localise" what a gui button does? And if that is possible, can I make the script carry over to other rooms? Let's say I have room 2 that's exactly the same room as room 1 (and panels use the same "panel gui") but while "button 1" there would control... a chair, room two "button 1" would control... a mug on the table. Hope I made myself clear.

P.S. On a side note. Can I make it that when I hover over a button a text appears to describe what it does. For example, if I have a "hand" button and mouse hovers over it to say in gui box "your hands "As efficent as they are deadly"?

Cheers!
SMF spam blocked by CleanTalk