SOLVED:Help in ActiveInventory code + changing game speed

Started by VegeTato, Wed 05/04/2017 01:21:47

Previous topic - Next topic

VegeTato

Hey, i am trying to tell ags whe ni activate the "key" in my inventory and press it on "the other character" do display text
but every time i run it, it gives me this error
end of input reached in middle of expression

here is the full code:

function Dead_UseInv()
{
if (player.ActiveInventory==key)(
(Display("you toke the dead key ! WOW..."));
}



Gurok

#1
The opening bracket after your if statement '(' should be an opening brace '{'. You're also missing a closing brace for the if statement. Finally, you don't need brackets around the Display statement. Try this:

Code: ags
function Dead_UseInv()
{
    if (player.ActiveInventory==key) {
        Display("you toke the dead key ! WOW...");
    }
}


If you have just one statement within an if, you can leave out the braces ('{' and '}'). This is perfectly valid:

Code: ags
function Dead_UseInv()
{
    if (player.ActiveInventory==key)
        Display("you toke the dead key ! WOW...");
}


Also, if you're including code in a post, wrap it in [ code ] [ /code ] tags (without the spaces) to format it as above.
[img]http://7d4iqnx.gif;rWRLUuw.gi

VegeTato

Thank you so much it works perfect ! :D

i got one more question please :)


is there is anyway to change the game speed default ?
(the character moving so slow and lagy i keep going to the top of the screen and go to options and set game speed to max then it works fine)
is is there is anyway yo make it speed without changing the options in the game every time i play it ? :) Thanks.

Khris

Open the player character in the editor, then lower their AnimationSpeed value. Afaik it's set to 4; try 3 or 2.

NicolaGs

#4
Quote from: VegeTato on Thu 06/04/2017 18:51:19
is there is anyway to change the game speed default ?
SetGameSpeed (int new_speed)
new_speed is the speed in frames per second.
If you use a template with a slider for speed adjustment , then you may have to change its default value.

edit : Khris was faster than me and may have better understood your question...
My first game : I Want Out!

Khris

Changing the game's speed will make everything faster or slower, but if this is about a slowly walking character, decreasing the number of game frames in between animation frames is probably a better solution.

I checked my Default Game, and I always flip the values, setting Roger to MovementSpeed 4 (which better fits the walkcycle frames) and AnimationSpeed 3, which speeds him up by 33% on top.

SMF spam blocked by CleanTalk