ID:157506
 
How would I do a pop-up. I'm working on a small game and can't get the help to come up as a pop-up.


Thanks in advance.
if you're talking about a window
winshow(usr,"WindowName",1)


-Zorro
Thanks.

How to use it?

mob/verb/help()
set category = "Game"
winshow(usr,"WindowName",1)
usr << ("This should be a pop-up")


Can't quite figure it out.
In response to Blafblabla
Blafblabla wrote:
Thanks.

How to use it?

mob/verb/help()
> set category = "Game"
> winshow(usr,"WindowName",1)
> usr << ("This should be a pop-up")

Can't quite figure it out.

What you have there should work, however, remember that "WindowName" should be the name of the window in your interface file. I'm not sure if it's case sensitive..

Either way, In your interface file, go the windows section and create(if not already done) a new window, name the window whatever you want, and make sure that the window name is the same in your winshow(blah).

example: create a window named Help. Remember to make it invisible, i believe they are visible by default?

then to show the window named Help you put:
winshow(usr,"Help",1)
In response to Jarquille
Ah OK thanks. I haven't used interface files yet.


But now the output isn't working.
In response to Blafblabla
Also,

if(1 +=20 2)


That is not working. How to fix?
In response to Blafblabla
What are you trying to do? 0.o That's almost right in C++, but not in DM.
In response to Ripiz
Ah. I'm trying to see if 1 is 20 more than 2.
In response to Blafblabla
/* maybe like this? */ if(1*20>2) /* I didn't really understand what you mean to be honest */
In response to Ripiz
I'm trying to do, if the quantity of 1 is 20 more than 2, do something else.

my current error is:


runtime error: Undefined operation: "50" * 20
proc name: test (/mob/verb/test)
usr: Blafblabla (/mob)
src: Blafblabla (/mob)
call stack:
Blafblabla (/mob): test()
In response to Blafblabla
What you are asking is... Not possible, or you're explaining it very poorly.

How can 1 be more than 2? That is just not mathematically possible.
Unless 1 and 2 are variables, but then I do not think that is possible, and if it is, you're doing really bad coding, as 1 is also a number and it could result in a lot of errors and bugs.
You should always try to make variables easy to recognize and unique. Naming them 1, 2, 3 and so on is just really bad.

Anyway, if 1 and 2 are variables, then if(a>b+20) is what you want to do (a is variable 1, b is variable 2).
In response to Blafblabla
The only conclusion I can come to is that your trying to use 1 as a variable, which you cannot do.
In response to The Magic Man
Well, what I'm trying to do is:

if(a>b+20)
usr << "a is 20 more than b!"
else
usr << "a is not 20 more than b.


In response to Blafblabla
Excluding the issue with indentation, that is exactly how you would do it.

Think of it this way. If 'a' is 15 and 'b' is 2, then what the computer is reading is.
if(15>2+20) ( or if(15>22) )
In response to The Magic Man
OK. I've decided to change the names of the proc and look at the issue a different way.

var/time
var/speed
var/guess_speed


mob/verb/hit_the_ball()
set category = "Game"
guess_speed = input("What speed is the ball going at?")
time = input("How many seconds do you want to hit the ball after?")
if(guess_speed == speed)
usr << "You guessed the speed right!"
if(time>20+guess_speed == speed)
usr << "You swung the bat at the right time and hit the ball!"


Also, showing an icon if they get the time and speed right.