Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: nmbr.added=true;  (Read 5596 times)

0 Members and 1 Guest are viewing this topic.

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
nmbr.added=true;
« on: March 09, 2004, 02:56:10 PM »

There's only ONE problem with the notepad system. I have defined each note lsomehow like this:
Code: [Select]
var note1;
note1.contents="Blaa";
note1.added=false;

Now, when I execute a function called AddNote() (which works like this: AddNote(note1) ), I would like it to set note1.added to true.

Code: [Select]
method AddNote(nmbr)
{

if(nmbr.added==false)
{

WinNotepad.DoStuff();

nmbr.added=true; // if nmbr was note1, this line would mean note1.added=true

}


}

But this doesn't work... Is there any way to make it work?

If's impossible to make it work, well, we have to resort to loads of state variables...

:D

Thanks!
« Last Edit: March 09, 2004, 03:03:09 PM by deadworm222 »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:nmbr.added=true;
« Reply #1 on: March 09, 2004, 04:13:22 PM »

Yeah, it doesn't work, it sucks, doesn't it? >:( It seems I'll have to implement some sort of "ref" parameters...

The only thing I can suggest at the moment is to store all the notes in a global array and only send a note number as a parameter.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Re:nmbr.added=true;
« Reply #2 on: March 10, 2004, 12:34:28 PM »

One thing I always hoped WME would support is the eval function JavaScript has. I don't really know what the real description of eval is, but is something doesn't work, use eval and it works :D
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:nmbr.added=true;
« Reply #3 on: March 10, 2004, 04:52:56 PM »

Jerrot already mentioned eval before, but it a little tricky, since the script compiler usually isn't part of the finished game (it's in a separated DLL). Anyway, do you think it would help in this case?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Jerrot

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 690
    • View Profile
Re:nmbr.added=true;
« Reply #4 on: March 10, 2004, 07:25:48 PM »

Jerrot already mentioned eval before, but it a little tricky, since the script compiler usually isn't part of the finished game (it's in a separated DLL). Anyway, do you think it would help in this case?

It was my first thought while reading the thread, too. But in most cases a workaround with arrays should work fine, you mostly use it to add numbers to variable names anyway...

So if it would eat speed from the engine, don't even think about realizing it. ;)

Logged
Mooh!

creatorbri

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 61
  • I'm a llama!
    • View Profile
Re:nmbr.added=true;
« Reply #5 on: March 11, 2004, 09:04:23 PM »

Jussi, are there any major drawbacks to using a global array?

Incidentally, since the WMScript is based on objects, it would make sense to be able to pass objects around by reference. In fact... Mnemonic, what if you took the PHP5 route, and force the engine to pass objects by reference? Would that cause any major problems?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:nmbr.added=true;
« Reply #6 on: March 11, 2004, 09:08:13 PM »

Mnemonic, what if you took the PHP5 route, and force the engine to pass objects by reference? Would that cause any major problems?

I'm not sure, I will have to investigate what would it take to implement it. I've added it to my ToDo list, I'll look into it.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

deadworm222

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 197
  • Wintermute Army
    • View Profile
Re:nmbr.added=true;
« Reply #7 on: March 12, 2004, 12:04:11 PM »

Jussi, are there any major drawbacks to using a global array?

I remember I only hypothetically considered this approach and found it problematic, but perhaps it can be done after all.
« Last Edit: March 12, 2004, 12:06:30 PM by deadworm222 »
Logged
 

Page created in 0.025 seconds with 21 queries.