juniper-wright / UtopianEngine

The Simple Text Adventure Game Engine
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

UtopiaScript - Roomstate Change #13

Closed juniper-wright closed 11 years ago

juniper-wright commented 11 years ago

Function syntax: roomstate [roomX roomY] stateNum;

This is a feature request for the UtopiaScript parser. References #1.

juniper-wright commented 11 years ago
private roomstateChange(String args)
{
    if(three arguments -- x, y, val)
        room[x][y].updateRoomstate(val)
    else
        room[curr_x][curr_y].updateRoomstate(val)
}
juniper-wright commented 11 years ago
public updateRoomstate(String val)
{
     if("+" in val) this.roomstate += val;
     else if("-" in val) this.roomstate -= val;
     else if(val is parsable to an int) this.roomstate = val;
     else return false;
}
juniper-wright commented 11 years ago

Make sure that changing the roomstate either sets the room's _seen to false, or calls:

_rooms[x][y].description(true);

Haven't decided yet.