Inventory+Player/Score [SOLVED]

Started by Gabarts, Mon 24/11/2014 12:37:45

Previous topic - Next topic

Gabarts

Hello guys,

it's quite a while I don't ask for help (this can be positive, I learned something :))
Anyway, I cannot find a thread about this, maybe I'm searching the wrong code or scripting.

What I need to do:

-Checking if my player is in a certain room and then if item is used start the code.

At the moment for that item is assigned a basic action (like player.Say or whatever)
I need the condition to tell if player is in a room. Could be something like this?

Code: ags
if (player.Room(2)) { //OR if (player.Room == 2)) {


The second thing is totally different:

What scripting I need to use to check if the player has a certain score (I've used GiveScore(); to assign a score) and then made a GUI to return it.

Thanks

Vincent

#1
A quick response could be like this

Quote from: Gabarts on Mon 24/11/2014 12:37:45
-Checking if my player is in a certain room

Code: ags

if (player.Room == 1) //OR if (player.PreviousRoom == 1)


Quote from: Gabarts on Mon 24/11/2014 12:37:45
and then if item is used

Do you mean :

InventoryItem* Character.ActiveInventory

// This property is useful in "Use inventory on hotspot/character/etc" events, to find out which inventory item the player is trying to use on the target.


Quote from: Gabarts on Mon 24/11/2014 12:37:45
I need to use to check if the player has a certain score

Code: ags

// repeatedly_execute()
Label1.Text = String.Format("%d", game.score);



Quote from: Gabarts on Mon 24/11/2014 12:37:45
and then made a GUI to return it.

???

Gabarts

Sorry, it was unclear.

First thing ok, it's how I tought. I will use
Code: ags
if (player.Room == 2)


Second thing I meant that I've already made a GUI with @SCORE@ text inside.
I used GiveScore(); in my script

I need to call a function that check if player has a certain score (let say > 50) then display text (EX. "Congratulations"), else if  < 50 display "Very Bad!"

Matti

You don't need any function, just check the score like you'd do with any other variable.

Code: ags

if (game.score > 50)..
else..

Gabarts

Quote from: Matti on Tue 25/11/2014 00:36:10
You don't need any function, just check the score like you'd do with any other variable.

Code: ags

if (game.score > 50)..
else..


Oh... I've made many tries with the text Label inside the GUI and some other variables, didn't know was this simple. Thanks

SMF spam blocked by CleanTalk