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 - geork

#141
Hi
  Yep, works like a charm, albiet a data storing virtual sort of charm...
  Thankyou very much!
#142
Okay, taking your advice I've modified the code like this:
Code: ags

function LoadGame(/*Varibles*/){
  File *i = File.Open("Constants.dat",eFileWrite);
  i.WriteInt(Test);
  i.Close();
  RestoreGameSlot(LoadNum);
  File *j = File.Open("Constants.dat",eFileRead);
  Test = j.ReadInt();
  j.Close();

//let the restore game window close, then call: 
  Display("%d",Test);

  Unfortunately, no dice: "Test" still comes up with a 0 after I've loaded a previous save , even though before I did that "Test" was definately 1!
   Am I overlooking something again, or is there another solution?
    Thanks
#143
urrrggghhhh!
  I'm so sorry, you are, of course, completely right and I feel like such a moron for doing that mistake!
   But thanks for pointing it out, Otherwise I'd still be stuck ;)
    Cheers
#144
Hey all!
  I've been trying to make some 'constants', meaning Global Variables which remain the same even if you load a previous save. So if you save, then change some 'constant' variables, then reload your save, the 'constant' variable remain changed. I've been trying to use Files for this, but they don't seem to be working: here's the code I tried:
Code: ags

int Test //This is in GlobalVariables


function SaveGame( /*some unimportant variable in here*/){
  File *i = File.Open("Constants.dat",eFileWrite);
  i.WriteInt(Test);
  i.Close();
 //Game saving commands
}
function LoadGame(/*More unimportant variables*/){
  //Game loading commands
  File *i = File.Open("Constants.dat",eFileRead);
  Test = i.ReadInt();
  i.Close();
  Display("%d",Test);
}
 

  I saved the game when the variable "Test" had a value of 0, then I activated a trigger which would set "Test" to 1. I then loaded my save, but my display command showed "Test" to be 0 again!
  I figured that maybe Files are re-written when a game is loaded from a past save, so I changed my SaveGame() function to this:
Code: ags

function SaveGame( /*some unimportant variable in here*/){
  //Game saving commands, notice these now happen BEFORE the file is written!
  File *i = File.Open("Constants.dat",eFileWrite);
  i.WriteInt(Test);
  i.Close();
}

  But I still got the same result. Can anybody help solve this?
    Thanks
#145
 Thanks, that worked a treat! (It was the scrolling room that caused the problem)
#146
  Hey all!
  I have some code in on_mouse_click() which goes like this:
 
Code: ags

    if(mouse.Mode == eModeWalkto  &&  AYardsWalked < 1760.0){
    XTarget = mouse.x;
    YTarget = mouse.y;
   }
   

 then I have some code in repeatedly_execute():
 
Code: ags

    if(cEgo.x == XTarget  && cEgo.y == YTarget ){
    Display("Working...");
   }

  all in GlobalScript.asc
   The problem is that the code in repeatedly_execute() never runs, meaning that mouse.x is not giving a good value to XTarget and YTarget. At first I though it had to do with the character never really reaching exactly where the mouse clicked, so  tried this instead:
 
Code: ags

    [code]
      if((cEgo.x >= XTarget - 10 && cEgo.x <= XTarget + 10) && (cEgo.y >= YTarget - 10 && cEgo.y <= YTarget + 10)){
    Display("Working...");
   }

  but still nothing, my game never displayed "Working..."
  What can I do?
   Thanks[/code]
#147
  Thanks! That worked a treat!
 
  Also: great post Khris! I think the answer was something along the lines of:

> combine teady-bear with huge iron key

You open the door!
#148
  Hey all!
   I wrote some script yesterday, which worked fine
   I altered that script today, adding new lines and replacing old ones, but the game still ran as if it was using that old script, and not the new one! I tried everything, even editing the entire section out, but the game just plodded along as if it were using yesterdays script!
   Does anyone know how to fix this?
    Thanks
   
#149
General Discussion / a £ sign?
Mon 19/07/2010 19:01:44
 Hey all!
  This seemed like the right forum to post it on, it's a bit of a silly thread...
  Just wondering, is there a possibility of a £ sign in AGS? i don't feel like going through 300+ dialogs and changing all the £ signs into $ signs. besides, I like the £ signs.
  Right now it turns up as a ? sign. Maybe I could make a new currency in ?, but Europe might feel cheated....
     Thanks
#150
  This is very crude, but what you could do is have a bool global variable which is "true" once the player has the conversation, then have a statement checking whether this variable is true in the Room_Load of the first room, and if so set the object to be visible, maybe something like:
Code: ags

  //when player talks to NPC
  GlobalVariable = true //make up your own name for the global variable
  diaolg.start()
  //then later on in room 1
  Room_Load(){
    if(GlobalVariable == true){
       object.Visible = true;
     }
}
  


 As I said, could be done better but there is a crude way of doing it

   EDIT: Looks like a better solution got there first from Dualnames ;)
#151
 ...
I
Am
So
Sorry
About
This
Post  :(
unitUPG, NOT UnitUPG (capitol "U")
  sorry guys, that was quite the mistake I just made ;D
   Forgive me (please!) :=
  But thanks for all the help!
#152
 Nope, still doesn't work.
  Would it be helpful to note that in brackets the window says:
  "ACI version 3.12.1074" ?
  Thanks
#153
 The manual is a bit two sided on that one...
   Unfortunately, I tried this but it still comes up with the same error. Are there any other causes for the message box?
   Thanks
#154
Advanced Technical Forum / Unresolved Script?
Tue 01/06/2010 20:21:30
 I have a function in GlobalScript.asc which goes:
 
Code: ags
 function unitUPG(String Type, bool UPGable){ 


Then I have a function in GlobalScript.ash which goes:
 
Code: ags
 import function UnitUPG(String, bool); 


But when I try to run the game, a message box (!) comes up and tells me:
  "Unable to create local script: Runtime error: unresolved import 'Unit UPG' "

  I am calling UnitUPG from other rooms,  but I doubt that makes a difference
   How can I fix this?
   Thanks
#155
 Thanks, it works perfectly! ;D
#156
 Hey all!
  Just wondering whether it is possible to find a label from a GUI by it's ID. I know that all labels have an ID relative to the GUI, but that all GUI's  hav a unique ID. So I'm looking for something along the lines of:
Code: ags

  gui[number1].Label[number2] = stringValue;
  

  obviously, it's not that easy, but is there a way of doing this sort of thing?
   Thanks
#157
 Whoops, my bad, I forgot to do something while reassigning. My apologies
#158
 Hey All!
  Just wondering whether it is possible to alter/get rid of a DrawingSurface variable after it has been released, otherwise I will have a load of GUI's to make...
  Thanks
#159
 Thanks! works now ;)
#160
 Hey all!
  sorry if this is a stupid question, but It's the only explanation I could think of...
  I have an object exactly where a hotspot is, but it isn't visible. The hotspot works fine. Then, after a certain event, the object becomes visible, and the hotspot stops responding to my clicks. I'm 95% sure this isn't a coding problem
  Is the object blocking out the hotspot? if so, how can I prevent it?
  Thanks
SMF spam blocked by CleanTalk