Hi, I need some help with code ?

Blitz3D Forums/Blitz3D Programming/Hi, I need some help with code ?

Alis John(Posted 2015) [#1]
Hello everyone, I'm just missing around with Blitz3d code and I'm just trying to make a basic dialog, but I get an error saying (Too many parameter found 3 while this function expect 1 parameter.

I even tried Text 320,500
Now why I have the (1) is because my Test game Test_map looks for 1 then should print the text. But I get that error. Here is a look at how I have it setup.

This Is in side my Test_map

Text 320,500, 1, "You Just Clicked Me"
Text 320,500, 2, "Hello World"
Text 320,500, 3, "Hi there whats up"
Text 320,500, 4, "dont talk To me"
I thought It would be easy for me to have the text 1 say what ever the model is right clicked

So wood it be like this Text 320,500, 1, "You Just Clicked Me" It should Load the Action Script which is in a function like this on.

Function Main()
; On left mouse button click, Show text
Print 320,500, "You Just Clicked Me"(1)
End Function
I'm not sure how to make the code to open a new function in a new.bb file.

And this to
LoadActionScript( "buttonmouseenter", 1 )
LoadActionScript( "button_left-mouse-click", 2 )
LoadActionScript( "rbutton_right-mouse-click", 3 )
LoadActionScript( "button_mouse-exit", 4 )


Is that how it works because I don't know why it gives me that error, What I'm trying to do is, I have added a x model to my game and when I click on it I want it to say text, now I'm not sure if I need to us text or print. Please help


H&K(Posted 2015) [#2]
Text 320,500, "You Just Clicked Me"
not print


Alis John(Posted 2015) [#3]
Ok I got all the errors out now, but when I Left Click and Right Click, nothing happens but shows that its selected, but and no text is sown.

And I also addid this, and changed to to what it was before.

Text 320,500, "You Just Clicked Me", 1
Text 320,500, "You Just Clicked Me", 2
Text 320,500, "You Just Clicked Me", 3
Text 320,500, "You Just Clicked Me", 4

Is that the right way display text when click on a object, because now its not showing any thing.


steve_ancell(Posted 2015) [#4]
Print doesn't work too well with double buffering, best to stay well away from that nasty command.


Midimaster(Posted 2015) [#5]
Do you want to combine TEXT and MOUSE?
Why do you use this 1,2,3,4?

The code below is only symbolic. You have to devide your problem into three parts. First is finding out what the mouse did, second is printing text depending on the result. third is doing action depending on the result:

Global MouseState%=0

Repeat
    WhatMouseState
    TextOut MouseState
    Action MouseState
    .....
    Flip
Until KeyHit(1)

Function WhatMouseState()
   If MouseX()> ObjectX AND MouseX()<(ObjectX+ObjectWidth)
      Return 1
   Else
       ....
End Function


Function TextOut(MouseState%)
   Local t$
  Select MouseState
    Case 1
      t="button mouse enter"
    Case 2
      t="button mouse left"    
    Case 3
      t="button mouse right"    
    Case 4
      t="button mouse exit"
  End Select
  Text 320,500,t
End Function 


Function Action(MouseState%)
   Local t$
  Select MouseState
    Case 1
     LoadActionScript( "buttonmouseenter", 1 )
    Case 2
      LoadActionScript( "button_left-mouse-click", 1 )    
    Case 3
      LoadActionScript( "button_right-mouse-click", 1 )    
    Case 4
      LoadActionScript( "buttonmouseexit", 1 )
  End Select
  Text 320,500,t
End Function